This patch does the following:

- comments out some authors
- tightens up some headings
- some word-smithing
- changes examples to more modern sound cards

Approved by:	bcr (mentor)
This commit is contained in:
Dru Lavigne 2013-10-13 19:40:10 +00:00
parent deabc6ee4c
commit 1d2fcefcf3
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=42949

View file

@ -61,7 +61,7 @@
</listitem> </listitem>
<listitem> <listitem>
<para>Playback DVDs, <filename>.mpg</filename>, and <para>Play DVDs, <filename>.mpg</filename>, and
<filename>.avi</filename> files.</para> <filename>.avi</filename> files.</para>
</listitem> </listitem>
@ -80,52 +80,38 @@
<listitem> <listitem>
<para>Configure an image scanner.</para> <para>Configure an image scanner.</para>
</listitem> </listitem>
<listitem>
<para>How to configure an image scanner.</para>
</listitem>
</itemizedlist> </itemizedlist>
<para>Before reading this chapter, you should:</para> <para>Before reading this chapter, you should:</para>
<itemizedlist> <itemizedlist>
<listitem><para>Know how to configure and install a new kernel <listitem><para>Know how to install applications as described in
(<xref linkend="kernelconfig"/>).</para></listitem> <xref linkend="ports"/>.</para></listitem>
</itemizedlist> </itemizedlist>
<warning>
<para>Audio CDs have specialized encodings which differ from the
usual ISO-filesystem. This means that they should not be
mounted using &man.mount.8;.</para>
</warning>
</sect1> </sect1>
<sect1 id="sound-setup"> <sect1 id="sound-setup">
<!--
<sect1info> <sect1info>
<authorgroup> <authorgroup>
<author> <author>
<firstname>Moses</firstname> <firstname>Moses</firstname>
<surname>Moore</surname> <surname>Moore</surname>
<contrib>Contributed by </contrib> <contrib>Contributed by in November 2000</contrib>
<!-- 20 November 2000 -->
</author> </author>
</authorgroup> </authorgroup>
<authorgroup> <authorgroup>
<author> <author>
<firstname>Marc</firstname> <firstname>Marc</firstname>
<surname>Fonvieille</surname> <surname>Fonvieille</surname>
<contrib>Enhanced by </contrib> <contrib>Enhanced by in September 2004</contrib>
<!-- 13 September 2004 -->
</author> </author>
</authorgroup> </authorgroup>
</sect1info> </sect1info>
-->
<title>Setting Up the Sound Card</title> <title>Setting Up the Sound Card</title>
<sect2 id="sound-device">
<title>Configuring the System</title>
<indexterm><primary>PCI</primary></indexterm> <indexterm><primary>PCI</primary></indexterm>
<indexterm><primary>sound cards</primary></indexterm> <indexterm><primary>sound cards</primary></indexterm>
<para>Before beginning the configuration, determine the model of <para>Before beginning the configuration, determine the model of
@ -140,19 +126,19 @@
<secondary>configuration</secondary> <secondary>configuration</secondary>
</indexterm> </indexterm>
<para>In order to use the sound device, the proper device driver <para>In order to use the sound device, its device driver
must be loaded. This may be accomplished in one of two ways. must be loaded.
The easiest way is to load a kernel module for the sound card The easiest way is to load a kernel module for the sound card
with &man.kldload.8;. This example loads the driver for a with &man.kldload.8;. This example loads the driver for a
Creative &soundblaster; Live! sound card:</para> built-in audio chipset based on the Intel specification:</para>
<screen>&prompt.root; <userinput>kldload snd_emu10k1</userinput></screen> <screen>&prompt.root; <userinput>kldload snd_hda</userinput></screen>
<para>To automate the loading of this driver at boot time, add the <para>To automate the loading of this driver at boot time, add the
driver to <filename>/boot/loader.conf</filename>. The line for driver to <filename>/boot/loader.conf</filename>. The line for
this driver is:</para> this driver is:</para>
<programlisting>snd_emu10k1_load="YES"</programlisting> <programlisting>snd_hda_load="YES"</programlisting>
<para>Other available sound modules are listed in <para>Other available sound modules are listed in
<filename>/boot/defaults/loader.conf</filename>. When unsure <filename>/boot/defaults/loader.conf</filename>. When unsure
@ -171,32 +157,28 @@
after loading the <filename>snd_driver</filename> metadriver, after loading the <filename>snd_driver</filename> metadriver,
type <command>cat /dev/sndstat</command>.</para> type <command>cat /dev/sndstat</command>.</para>
<para>Users who prefer to statically compile in support for the <sect2>
sound card in a custom kernel should refer to the instructions
in the next section. For more information about recompiling a
kernel, refer to <xref linkend="kernelconfig"/>.</para>
<sect3>
<title>Configuring a Custom Kernel with Sound Support</title> <title>Configuring a Custom Kernel with Sound Support</title>
<para>This section is for users who prefer to statically compile in support for the
sound card in a custom kernel. For more information about recompiling a
kernel, refer to <xref linkend="kernelconfig"/>.</para>
<para>When using a custom kernel to provide sound support, make <para>When using a custom kernel to provide sound support, make
sure that the audio framework driver exists in the custom kernel sure that the audio framework driver exists in the custom kernel
configuration file:</para> configuration file:</para>
<programlisting>device sound</programlisting> <programlisting>device sound</programlisting>
<para>Next, add support for the sound card. Therefore, you need <para>Next, add support for the sound card. To continue the example
to know which driver supports the card. To continue the example of the built-in audio chipset based on the Intel specification from the
of the Creative &soundblaster; Live! sound card from the
previous section, use the following line in the custom kernel previous section, use the following line in the custom kernel
configuration file:</para> configuration file:</para>
<programlisting>device snd_emu10k1</programlisting> <programlisting>device snd_hda</programlisting>
<para>Be sure to read the manual page of the driver for the <para>Be sure to read the manual page of the driver for the
syntax to use. The explicit syntax for the kernel device name to use for the driver.</para>
configuration of every supported sound driver can also be
found in <filename>/usr/src/sys/conf/NOTES</filename>.</para>
<para>Non-PnP ISA sound cards may require the IRQ and I/O port <para>Non-PnP ISA sound cards may require the IRQ and I/O port
settings of the card to be added to settings of the card to be added to
@ -233,57 +215,62 @@ hint.sbc.0.flags="0x15"</programlisting>
cases, the IRQ or other settings may need to be changed to cases, the IRQ or other settings may need to be changed to
match the card. Refer to &man.snd.sbc.4; for more information match the card. Refer to &man.snd.sbc.4; for more information
about this card.</para> about this card.</para>
</sect3>
</sect2> </sect2>
<sect2 id="sound-testing"> <sect2 id="sound-testing">
<title>Testing the Sound Card</title> <title>Testing Sound</title>
<para>After rebooting into the custom kernel, or after loading <para>After loading
the required module, the sound card should appear in the system the required module or rebooting into the custom kernel,
message buffer. Run &man.dmesg.8; and look for a message the sound card should be detected.
like:</para> To confirm, run <command>dmesg | grep pcm</command>. This
example is from a system with a built-in Conexant CX20590 chipset:</para>
<screen>pcm0: &lt;Intel ICH3 (82801CA)&gt; port 0xdc80-0xdcbf,0xd800-0xd8ff irq 5 at device 31.5 on pci0 <screen>pcm0: &lt;NVIDIA (0x001c) (HDMI/DP 8ch)&gt; at nid 5 on hdaa0
pcm0: [GIANT-LOCKED] pcm1: &lt;NVIDIA (0x001c) (HDMI/DP 8ch)&gt; at nid 6 on hdaa0
pcm0: &lt;Cirrus Logic CS4205 AC97 Codec&gt;</screen> pcm2: &lt;Conexant CX20590 (Analog 2.0+HP/2.0)&gt; at nid 31,25 and 35,27 on hdaa1</screen>
<para>The status of the sound card may also be checked using this <para>The status of the sound card may also be checked using this
command:</para> command:</para>
<screen>&prompt.root; <userinput>cat /dev/sndstat</userinput> <screen>&prompt.root; <userinput>cat /dev/sndstat</userinput>
FreeBSD Audio Driver (newpcm) FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64)
Installed devices: Installed devices:
pcm0: &lt;Intel ICH3 (82801CA)&gt; at io 0xd800, 0xdc80 irq 5 bufsz 16384 pcm0: &lt;NVIDIA (0x001c) (HDMI/DP 8ch)&gt; (play)
kld snd_ich (1p/2r/0v channels duplex default)</screen> pcm1: &lt;NVIDIA (0x001c) (HDMI/DP 8ch)&gt; (play)
pcm2: &lt;Conexant CX20590 (Analog 2.0+HP/2.0)&gt; (play/rec) default</screen>
<para>The output may vary between systems. If no <para>The output will vary depending upon the sound card. If no
<devicename>pcm</devicename> devices are listed, go back and <devicename>pcm</devicename> devices are listed, double-check that the correct
review the kernel configuration file and make sure the correct device driver was loaded or compiled into the kernel. The
device driver was chosen. Common problems are listed in <xref next section lists some common problems and their solutions.</para>
linkend="troubleshooting"/>.</para>
<para>If all goes well, the sound card should now work in os;. If <para>If all goes well, the sound card should now work in os;. If
the CD-ROM or DVD-ROM drive's audio-out pins are properly the <acronym>CD</acronym> or <acronym>DVD</acronym> drive is properly
connected to the sound card, one can insert an audio CD in the connected to the sound card, one can insert an audio CD in the
drive and play it with &man.cdcontrol.1;:</para> drive and play it with &man.cdcontrol.1;:</para>
<screen>&prompt.user; <userinput>cdcontrol -f /dev/acd0 play 1</userinput></screen> <screen>&prompt.user; <userinput>cdcontrol -f /dev/acd0 play 1</userinput></screen>
<warning>
<para>Audio CDs have specialized encodings which means that they should not be
mounted using &man.mount.8;.</para>
</warning>
<para>Various applications, such as <filename <para>Various applications, such as <filename
role="package">audio/workman</filename> provide a friendlier role="package">audio/workman</filename>, provide a friendlier
interface. The <filename role="package">audio/mpg123</filename> interface. The <filename role="package">audio/mpg123</filename>
port can be installed to listen to MP3 audio files.</para> port can be installed to listen to MP3 audio files.</para>
<para>Another quick way to test the card is to send data to <para>Another quick way to test the card is to send data to
<filename>/dev/dsp</filename>:</para> <devicename>/dev/dsp</devicename>:</para>
<screen>&prompt.user; <userinput>cat <replaceable>filename</replaceable> &gt; /dev/dsp</userinput></screen> <screen>&prompt.user; <userinput>cat <replaceable>filename</replaceable> &gt; /dev/dsp</userinput></screen>
<para>where <para>where
<filename><replaceable>filename</replaceable></filename> can <filename><replaceable>filename</replaceable></filename> can
be any file. This command should produce some noise, confirming be any type of file. This command should produce some noise, confirming
that the sound card is actually working.</para> that the sound card is working.</para>
<note> <note>
<para>The <devicename>/dev/dsp*</devicename> device nodes will <para>The <devicename>/dev/dsp*</devicename> device nodes will
@ -291,19 +278,21 @@ kld snd_ich (1p/2r/0v channels duplex default)</screen>
do not exist and will not appear in the output of do not exist and will not appear in the output of
&man.ls.1;.</para> &man.ls.1;.</para>
</note> </note>
</sect2>
<para>Sound card mixer levels can be changed using &man.mixer.8;. <sect2 id="troubleshooting">
More details can be found in &man.mixer.8;.</para> <title>Troubleshooting Sound</title>
<sect3 id="troubleshooting">
<title>Common Problems</title>
<indexterm><primary>device nodes</primary></indexterm> <indexterm><primary>device nodes</primary></indexterm>
<indexterm><primary>I/O port</primary></indexterm> <indexterm><primary>I/O port</primary></indexterm>
<indexterm><primary>IRQ</primary></indexterm> <indexterm><primary>IRQ</primary></indexterm>
<indexterm><primary>DSP</primary></indexterm> <indexterm><primary>DSP</primary></indexterm>
<informaltable frame="none" pgwide="1"> <para>Table 8.1 lists some common error messages and their
solutions:</para>
<table frame="none" pgwide="1">
<title>Common Error Messages</title>
<tgroup cols="2"> <tgroup cols="2">
<thead> <thead>
<row> <row>
@ -337,8 +326,8 @@ kld snd_ich (1p/2r/0v channels duplex default)</screen>
<row> <row>
<entry><errorname>xxx: can't open <entry><errorname>xxx: can't open
/dev/dsp!</errorname></entry> /dev/dsp!</errorname></entry>
<entry><para>Check with <command>fstat | grep <entry><para>Type <command>fstat | grep
dsp</command> if another application is holding the dsp</command> to check if another application is holding the
device open. Noteworthy troublemakers are device open. Noteworthy troublemakers are
<application>esound</application> and <application>esound</application> and
<application>KDE</application>'s sound <application>KDE</application>'s sound
@ -346,13 +335,13 @@ kld snd_ich (1p/2r/0v channels duplex default)</screen>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </table>
<para>Another issue is that modern graphics cards often come <para>Modern graphics cards often come
with their own sound driver, for use with with their own sound driver for use with
<acronym>HDMI</acronym> and similar. This sound device will <acronym>HDMI</acronym>. This sound device is
sometimes be enumerated before the sound card and the sound sometimes enumerated before the sound card meaning that the sound
card will subsequently not be used as the default playback card will not be used as the default playback
device. To check if this is the case, run device. To check if this is the case, run
<application>dmesg</application> and look for <application>dmesg</application> and look for
<literal>pcm</literal>. The output looks something like <literal>pcm</literal>. The output looks something like
@ -376,7 +365,7 @@ pcm6: &lt;HDA Realtek ALC889 PCM #2 Digital&gt; at cad 2 nid 1 on hdac1
pcm7: &lt;HDA Realtek ALC889 PCM #3 Digital&gt; at cad 2 nid 1 on hdac1 pcm7: &lt;HDA Realtek ALC889 PCM #3 Digital&gt; at cad 2 nid 1 on hdac1
...</programlisting> ...</programlisting>
<para>Here the graphics card (<literal>NVidia</literal>) has <para>In this example, the graphics card (<literal>NVidia</literal>) has
been enumerated before the sound card (<literal>Realtek been enumerated before the sound card (<literal>Realtek
ALC889</literal>). To use the sound card as the default ALC889</literal>). To use the sound card as the default
playback device, change <varname>hw.snd.default_unit</varname> playback device, change <varname>hw.snd.default_unit</varname>
@ -384,17 +373,17 @@ pcm7: &lt;HDA Realtek ALC889 PCM #3 Digital&gt; at cad 2 nid 1 on hdac1
<screen>&prompt.root; <userinput>sysctl hw.snd.default_unit=<replaceable>n</replaceable></userinput></screen> <screen>&prompt.root; <userinput>sysctl hw.snd.default_unit=<replaceable>n</replaceable></userinput></screen>
<para>Here, <literal>n</literal> is the number of the sound <para>where <literal>n</literal> is the number of the sound
device to use. In this example, it should be device to use. In this example, it should be
<literal>4</literal>. Make this change permanent by adding <literal>4</literal>. Make this change permanent by adding
the following line to the following line to
<filename>/etc/sysctl.conf</filename>:</para> <filename>/etc/sysctl.conf</filename>:</para>
<programlisting>hw.snd.default_unit=<replaceable>4</replaceable></programlisting> <programlisting>hw.snd.default_unit=<replaceable>4</replaceable></programlisting>
</sect3>
</sect2> </sect2>
<sect2 id="sound-multiple-sources"> <sect2 id="sound-multiple-sources">
<!--
<sect2info> <sect2info>
<authorgroup> <authorgroup>
<author> <author>
@ -404,34 +393,32 @@ pcm7: &lt;HDA Realtek ALC889 PCM #3 Digital&gt; at cad 2 nid 1 on hdac1
</author> </author>
</authorgroup> </authorgroup>
</sect2info> </sect2info>
-->
<title>Utilizing Multiple Sound Sources</title> <title>Utilizing Multiple Sound Sources</title>
<para>It is often desirable to have multiple sources of sound that <para>It is often desirable to have multiple sources of sound that
are able to play simultaneously. &os; uses <emphasis>Virtual are able to play simultaneously. &os; uses <quote>Virtual
Sound Channels</emphasis>, which can be enabled using Sound Channels</quote> to multiplex the
&man.sysctl.8;. Virtual channels allow one to multiplex the
sound card's playback by mixing sound in the kernel.</para> sound card's playback by mixing sound in the kernel.</para>
<para>To set the number of virtual channels, three <para>Three
&man.sysctl.8; knobs are available:</para> &man.sysctl.8; knobs are available for configuring virtual channels:</para>
<screen>&prompt.root; <userinput>sysctl dev.pcm.0.play.vchans=4</userinput> <screen>&prompt.root; <userinput>sysctl dev.pcm.0.play.vchans=4</userinput>
&prompt.root; <userinput>sysctl dev.pcm.0.rec.vchans=4</userinput> &prompt.root; <userinput>sysctl dev.pcm.0.rec.vchans=4</userinput>
&prompt.root; <userinput>sysctl hw.snd.maxautovchans=4</userinput></screen> &prompt.root; <userinput>sysctl hw.snd.maxautovchans=4</userinput></screen>
<para>The above example allocates four virtual channels, which <para>This example allocates four virtual channels, which
is a practical number for everyday use. Both is a practical number for everyday use. Both
<varname>dev.pcm.0.play.vchans=4</varname> and <varname>dev.pcm.0.play.vchans=4</varname> and
<varname>dev.pcm.0.rec.vchans=4</varname> are the number of <varname>dev.pcm.0.rec.vchans=4</varname> are configurable after a device has been
attached and represent the number of
virtual channels <devicename>pcm0</devicename> has for playback virtual channels <devicename>pcm0</devicename> has for playback
and recording, and are configurable after a device has been and recording. Since the
attached. <literal>hw.snd.maxautovchans</literal> is the number
of virtual channels a new audio device is given when it is
attached using &man.kldload.8;. Since the
<devicename>pcm</devicename> module can be loaded independently <devicename>pcm</devicename> module can be loaded independently
of the hardware drivers, <varname>hw.snd.maxautovchans</varname> of the hardware drivers, <varname>hw.snd.maxautovchans</varname>
indicates how many virtual channels will be given to devices indicates how many virtual channels will be given to an audio device
when they are attached. Refer to &man.pcm.4; for more when it is attached. Refer to &man.pcm.4; for more
information.</para> information.</para>
<note> <note>
@ -447,6 +434,7 @@ pcm7: &lt;HDA Realtek ALC889 PCM #3 Digital&gt; at cad 2 nid 1 on hdac1
</sect2> </sect2>
<sect2> <sect2>
<!--
<sect2info> <sect2info>
<authorgroup> <authorgroup>
<author> <author>
@ -456,16 +444,17 @@ pcm7: &lt;HDA Realtek ALC889 PCM #3 Digital&gt; at cad 2 nid 1 on hdac1
</author> </author>
</authorgroup> </authorgroup>
</sect2info> </sect2info>
-->
<title>Setting Default Values for Mixer Channels</title> <title>Setting Default Values for Mixer Channels</title>
<para>The default values for the different mixer channels are <para>The default values for the different mixer channels are
hardcoded in the source code of the &man.pcm.4; driver. There hardcoded in the source code of the &man.pcm.4; driver. While
are many different applications and daemons that allow values to sound card mixer levels can be changed using &man.mixer.8; or
be set for the mixer that are remembered between invocations, third-party applications and daemons, this is not a permanent solution.
but this is not a clean solution. It is possible to set default To instead set default
mixer values at the driver level. This is accomplished by mixer values at the driver level,
defining the appropriate values in define the appropriate values in
<filename>/boot/device.hints</filename>, as seen in this <filename>/boot/device.hints</filename>, as seen in this
example:</para> example:</para>
@ -478,16 +467,17 @@ pcm7: &lt;HDA Realtek ALC889 PCM #3 Digital&gt; at cad 2 nid 1 on hdac1
</sect1> </sect1>
<sect1 id="sound-mp3"> <sect1 id="sound-mp3">
<!--
<sect1info> <sect1info>
<authorgroup> <authorgroup>
<author> <author>
<firstname>Chern</firstname> <firstname>Chern</firstname>
<surname>Lee</surname> <surname>Lee</surname>
<contrib>Contributed by </contrib> <contrib>Contributed by in Sept 2001</contrib>
</author> </author>
</authorgroup> </authorgroup>
<!-- 11 Sept 2001 -->
</sect1info> </sect1info>
-->
<title>MP3 Audio</title> <title>MP3 Audio</title>