⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sound-setup.html

📁 FreeBSD操作系统的详细使用手册
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="generator" content="HTML Tidy, see www.w3.org" /><title>Setting Up the Sound Card</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD Handbook" href="index.html" /><link rel="UP" title="Multimedia" href="multimedia.html" /><link rel="PREVIOUS" title="Multimedia" href="multimedia.html" /><link rel="NEXT" title="MP3 Audio" href="sound-mp3.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /></head><body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"alink="#0000FF"><div class="NAVHEADER"><table summary="Header navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><th colspan="3" align="center">FreeBSD Handbook</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="multimedia.html"accesskey="P">Prev</a></td><td width="80%" align="center" valign="bottom">Chapter 7 Multimedia</td><td width="10%" align="right" valign="bottom"><a href="sound-mp3.html"accesskey="N">Next</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="SOUND-SETUP" name="SOUND-SETUP">7.2 Setting Up the SoundCard</a></h1><i class="AUTHORGROUP"><span class="CONTRIB">Contributed by</span> Moses Moore.</i> <iclass="AUTHORGROUP"><span class="CONTRIB">Enhanced for FreeBSD&nbsp;5.X by</span> MarcFonvieille.</i> <div class="SECT2"><h2 class="SECT2"><a id="SOUND-DEVICE" name="SOUND-DEVICE">7.2.1 Configuring theSystem</a></h2><p>Before you begin, you should know the model of the card you have, the chip it uses,and whether it is a PCI or ISA card. FreeBSD supports a wide variety of both PCI and ISAcards. Check the supported audio devices list of the <ahref="http://www.FreeBSD.org/releases/5.2.1R/hardware.html" target="_top">HardwareNotes</a> to see if your card is supported. This document will also mention which driversupports your card.</p><p>To use your sound device, you will need to load the proper device driver. This may beaccomplished in one of two ways. The easiest way is to simply load a kernel module foryour sound card with <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=kldload&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">kldload</span>(8)</span></a> which caneither be done from the command line:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">kldload snd_emu10k1</kbd></pre><p>or by adding the appropriate line to the file <ttclass="FILENAME">/boot/loader.conf</tt> like this:</p><pre class="PROGRAMLISTING">snd_emu10k1_load="YES"</pre><p>These examples are for a Creative <span class="TRADEMARK">SoundBlaster</span>&reg;Live! sound card. Other available loadable sound modules are listed in <ttclass="FILENAME">/boot/defaults/loader.conf</tt>. If you are not sure which driver touse, you may try to load the <tt class="FILENAME">snd_driver</tt> module:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">kldload snd_driver</kbd></pre><p>This is a metadriver loading the most common device drivers at once. This speeds upthe search for the correct driver. It is also possible to load all sound drivers via the<tt class="FILENAME">/boot/loader.conf</tt> facility.</p><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> Under FreeBSD&nbsp;4.X, to load all sound drivers, you have to load the<tt class="FILENAME">snd</tt> module instead of <tt class="FILENAME">snd_driver</tt>.</p></blockquote></div><p>A second method is to statically compile in support for your sound card in yourkernel. The section below provides the information you need to add support for yourhardware in this manner. For more information about recompiling your kernel, please see<a href="kernelconfig.html">Chapter 8</a>.</p><div class="SECT3"><h3 class="SECT3"><a id="AEN8240" name="AEN8240">7.2.1.1 Configuring a Custom Kernel withSound Support</a></h3><p>The first thing to do is adding the generic audio driver <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=sound&sektion=4"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">sound</span>(4)</span></a> to thekernel, for that you will need to add the following line to the kernel configurationfile:</p><pre class="PROGRAMLISTING">device sound</pre><p>Under FreeBSD&nbsp;4.X, you would use the following line:</p><pre class="PROGRAMLISTING">device pcm</pre><p>Then we have to add the support for our sound card. Therefore, we need to know whichdriver supports the card. Check the supported audio devices list of the <ahref="http://www.FreeBSD.org/releases/5.2.1R/hardware.html" target="_top">HardwareNotes</a>, to determine the correct driver for your sound card. For example, a Creative<span class="TRADEMARK">SoundBlaster</span> Live! sound card is supported by the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=snd_emu10k1&sektion=4"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">snd_emu10k1</span>(4)</span></a> driver.To add the support for this card, use the following:</p><pre class="PROGRAMLISTING">device snd_emu10k1</pre><p>Be sure to read the manual page of the driver for the syntax to use. Informationregarding the syntax of sound drivers in the kernel configuration can also be found inthe <tt class="FILENAME">/usr/src/sys/conf/NOTES</tt> file (<ttclass="FILENAME">/usr/src/sys/i386/conf/LINT</tt> for FreeBSD&nbsp;4.X).</p><p>Non-PnP ISA cards may require you to provide the kernel with information on the soundcard settings (IRQ, I/O port, etc). This is done via the <ttclass="FILENAME">/boot/device.hints</tt> file. At system boot, the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=loader&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">loader</span>(8)</span></a> will readthis file and pass the settings to the kernel. For example, an old Creative <spanclass="TRADEMARK">SoundBlaster</span> 16 ISA non-PnP card will use the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=snd_sbc&sektion=4"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">snd_sbc</span>(4)</span></a> driver,with the following line added to the kernel configuration file:</p><pre class="PROGRAMLISTING">device sbc</pre><p>as well as the following in <tt class="FILENAME">/boot/device.hints</tt>:</p><pre class="PROGRAMLISTING">hint.sbc.0.at="isa"hint.sbc.0.port="0x220"hint.sbc.0.irq="5"hint.sbc.0.drq="1"hint.sbc.0.flags="0x15"</pre><p>In this case, the card uses the <var class="LITERAL">0x220</var> I/O port and the IRQ<var class="LITERAL">5</var>.</p><p>The syntax used in the <tt class="FILENAME">/boot/device.hints</tt> file is covered inthe sound driver manual page. On FreeBSD&nbsp;4.X, these settings are directly written inthe kernel configuration file. In the case of our ISA card, we would only use thisline:</p><pre class="PROGRAMLISTING">device sbc0 at isa? port 0x220 irq 5 drq 1 flags 0x15</pre><p>The settings shown above are the defaults. In some cases, you may need to change theIRQ or the other settings to match your card. See the <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=snd_sbc&sektion=4"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">snd_sbc</span>(4)</span></a> manual pagefor more information.</p><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> Under FreeBSD&nbsp;4.X, some systems with built-in motherboard sounddevices may require the following option in the kernel configuration:</p><pre class="PROGRAMLISTING">options PNPBIOS</pre></blockquote></div></div></div><div class="SECT2"><h2 class="SECT2"><a id="SOUND-TESTING" name="SOUND-TESTING">7.2.2 Testing the SoundCard</a></h2><p>After rebooting with the modified kernel, or after loading the required module, thesound card should appear in your system message buffer (<ahref="http://www.FreeBSD.org/cgi/man.cgi?query=dmesg&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">dmesg</span>(8)</span></a>) as somethinglike:</p><pre class="SCREEN">pcm0: &lt;Intel ICH3 (82801CA)&gt; port 0xdc80-0xdcbf,0xd800-0xd8ff irq 5 at device 31.5 on pci0pcm0: [GIANT-LOCKED]pcm0: &lt;Cirrus Logic CS4205 AC97 Codec&gt;</pre><p>The status of the sound card may be checked via the <ttclass="FILENAME">/dev/sndstat</tt> file:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">cat /dev/sndstat</kbd>FreeBSD Audio Driver (newpcm)Installed devices:pcm0: &lt;Intel ICH3 (82801CA)&gt; at io 0xd800, 0xdc80 irq 5 bufsz 16384kld snd_ich (1p/2r/0v channels duplex default)</pre><p>The output from your system may vary. If no <tt class="DEVICENAME">pcm</tt> devicesshow up, go back and review what was done earlier. Go through your kernel configurationfile again and make sure the correct device is chosen. Common problems are listed in <ahref="sound-setup.html#TROUBLESHOOTING">Section 7.2.2.1</a>.</p><p>If all goes well, you should now have a functioning sound card. If your CD-ROM orDVD-ROM drive is properly coupled to your sound card, you can put a CD in the drive andplay it with <a href="http://www.FreeBSD.org/cgi/man.cgi?query=cdcontrol&sektion=1"><span

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -