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