个人工具

UbuntuHelp:OpenSound

来自Ubuntu中文

Wikibot讨论 | 贡献2008年10月19日 (日) 16:43的版本 (新页面: {{From|https://help.ubuntu.com/community/OpenSound}} {{Languages|UbuntuHelp:OpenSound}} == Introduction == The Open Sound System (OSS) project provides low-level audio drivers for users a...)

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航, 搜索

Introduction

The Open Sound System (OSS) project provides low-level audio drivers for users and a common Application Programming Interface (API) for developers. By default, Ubuntu uses the Advanced Linux Sound Architecture (ALSA) to provide audio drivers. This document will guide you in replacing ALSA with the latest version of OSS. To begin, open up a terminal interface (Applications -> Accessories -> Terminal). You can paste the commands found in this guide into the terminal with a Ctrl+Shift+v keystroke. Note: You may hear some people (e.g. Linux kernel developers) refer to OSS as "deprecated" or "replaced with ALSA". This is referring to OSS 3.x. Development of OSS 4.x is alive and well. Many applications use the OSS API for sound because it is well-documented and portable across several platforms (Linux, Solaris, BSD, etc.).

Does OSS Support My Hardware?

Probably. Check the list here - [[https://help.ubuntu.com/community/OpenSound?action=AttachFile&do=get&target=devices.list%5D%5D Note that onboard audio chips are listed by their south bridge, and not the codec. For example, ICH9 includes codecs from Realtek, Sigmatel, ADI, Conexant, etc. Also, some devices may not have full functionality (e.g. the X-fi module is limited to stereo output at the time of this writing). If you're in doubt, consult the "Additional Support" sources found towards the end of this document.

Stopping ALSA

sudo chmod 776 /etc/modprobe.d/blacklist
sudo cat /lib/linux-sound-base/noALSA.modprobe.conf >> /etc/modprobe.d/blacklist

The block of text that follows is one command! (copy and paste the entire cell):

sudo echo "blacklist snd_hda_intel 
blacklist snd_mixer_oss 
blacklist snd_pcm
blacklist snd_timer
blacklist snd_page_alloc
blacklist snd_hwdep
blacklist snd
blacklist soundcore" >> /etc/modprobe.d/blacklist

Configuring linux-sound-base

sudo dpkg-reconfigure linux-sound-base

You will be greeted with an explanatory message. Press [Enter]. You will now be prompted to select the default sound output for Ubuntu. Use the arrow keys to select OSS, and press the Tab key to highlight 'OK'. Press [Enter].

Installing Prerequisite Packages

The second command isn't strictly necessary, but practically every system using OSS will have those packages installed.

sudo apt-get install -y build-essential binutils linux-headers-`uname -r` gawk libtool libgtk2.0-dev mercurial
sudo apt-get install -y libesd0 libsdl1.2debian-oss

System Sounds on GNOME

If you want the ability to hear system sounds (such as the login/logout jingle) with OSS, you'll need to install the Enlightenment Sound Daemon (ESD)

sudo apt-get install -y esound esound-clients esound-common libesd0

System Sounds on KDE

Make sure you have the aRts system installed:

sudo apt-get install -y arts

Building OSS

OSS 4.0-1016 is available in .deb packaging, but this version is relatively old at the time of this writing. Instead, we'll use the commands below to obtain and build the latest OSS 4.1 release candidate source. Before you build OSS, Reboot your system so that the ALSA modules will not load or interfere with it. When you log back in, go back to the terminal and proceed:

Special Instructions for Ubuntu 8.10 (intrepid)

Ubuntu 8.10 uses gcc 4.3.x, which treats warnings as errors and prevents OSS from building. One can work around this by installing gcc 4.2 and redirecting the /usr/bin/gcc symbolic link like so:

sudo apt-get install gcc-4.2
sudo apt-get install gcc-4.2-multilib  ;<-- this command is only for x86_64 users
sudo rm /usr/bin/gcc
sudo ln -s /usr/bin/gcc-4.2 /usr/bin/gcc

Obtaining the OSS Source using latest testing tarball

wget -A '*.bz2' -nd -r -l 1 http://www.4front-tech.com/developer/sources/testing/gpl/
tar xf oss-v4.1*.tar.bz2 -C /usr/src
mv /usr/src/oss-v4.1* /usr/src/oss-devel

Obtaining the OSS Source using Mercurial

cd /usr/src
sudo hg clone http://mercurial.opensound.com/ oss-devel

Creating a Build Directory

OSS needs an empty directory to build in. Using the example below will create a directory in your /home folder (~)

cd ~/
mkdir oss41build
cd oss41build/

We Can Build It!

sudo sh /usr/src/oss-devel/configure
sudo make
sudo make install

Updating Your OSS Build

This only works if you fetched the source using mercurial rather than the testing tarball. Check <http://mercurial.opensound.com/> to see if any changes have been added that could affect you. Here's how I update to the latest version of OSS4.1. Note that I just re-use the build directory from my last build. If you don't want to do that or are scared of the rm command, just create and cd to another directory in your /home folder.

cd /usr/src/oss-devel
sudo hg pull
sudo hg update
cd ~/oss41build
sudo rm -rf *
sudo rm -rf .*

Now follow the "We Can Build It!" directions again to build your updated OSS.

Configuring Applications to Use OSS

You'll have to tell applications to use OSS output instead of ALSA. Some applications (like Audacious) have user-friendly controls for this. Others require command line input or configuring a text file. See the OSS wiki for help with this. I've listed procedures for common apps below.

Mixers

The OSS Mixer App

Add a new custom application launcher to the panel that runs the command: ossxmix - (That's ossxmix, not ossmix), Name the launcher whatever you want and pick an icon. I named mine "Mixer" and chose /usr/share/icons/gnome/32x32/status/stock_volume-med.png as my icon. If you're new to Ubuntu/GNOME, this primer will help for this task. I'm sure you can add an ossxmix launcher to the KDE or Xfce panel too.

The GNOME Mixer/Volume Control

The gstreamer-based volume control in Ubuntu 8.04.x is incompatible with OSS, because it uses an older version of gstreamer-plugins (Ubuntu 8.10 is compatible), which means your mouse wheel won't control the volume as is. To remedy the issue, try Clive Wright's patch. 32-bit version - [[https://help.ubuntu.com/community/OpenSound?action=AttachFile&do=get&target=gstreamer-ossv4-x86-32bit.tar.gz%5D%5D , 64-bit version - [[https://help.ubuntu.com/community/OpenSound?action=AttachFile&do=get&target=gstreamer-ossv4-amd64.tar.gz%5D%5D. Make sure to read the instructions; the patch is already applied to the included library file (libgstoss.so), but is included in the archive as a reference and to satisfy the terms of the General Public License (GPL). Alternatively, if you're comfortable with building software, you can build the latest version of the gstreamer plugins (at least base, good, bad).

kmix on KDE 3.5.9

Thanks to "cesium" for this explanation: "The patch has been integrated into kmix: https://bugs.kde.org/show_bug.cgi?id=166591#5 and https://bugs.kde.org/show_bug.cgi?id=166591#13. The commiter would like to have this tested more. For that, you'll have to fetch kdemultimedia from the SVN branch for KDE 3.5, replace /usr/include/sys/soundcard.h with the file /usr/lib/oss/include/sys/soundcard.h, and (try to) use kmix from the complied kdemultimedia."

kmix on KDE 3.5.10

kmix should work.

kmix on KDE 4.x

kmix does not work at this time. Use ossxmix or, if you'd prefer to map commands to your shortcut keys, here are some scripts to use (at the bottom of the page).

Flash

Make sure you remove existing versions of libflashsupport.so, including the Ubuntu repository package, which is for PulseAudio.

sudo apt-get remove libflashsupport

Save [[https://help.ubuntu.com/community/OpenSound?action=AttachFile&do=get&target=libflashsupport.so.gz%5D%5D to your Desktop, and then:

cd ~/Desktop
gunzip libflashsupport.so.gz
sudo mv libflashsupport.so /usr/lib
sudo ln -s /usr/lib/libflashsupport.so /usr/lib/firefox/plugins
sudo ln -s /usr/lib/libflashsupport.so /usr/lib/mozilla/plugins
sudo ln -s /usr/lib/libflashsupport.so /usr/lib/firefox-addons/plugins
sudo ldconfig

64-bit users

Follow the directions in the Flash section and execute these commands:

sudo cp /usr/lib/libflashsupport.so /usr/lib32/
sudo ldconfig

Advanced

Build your own copy of libflashsupport.c (See this)

Troubleshooting

If you run into problems, follow these steps first:

Recovering From a Failed .deb Install

If you use the .deb package and it fails to install completely, use this procedure to remove it.

Consult the OSS wiki

The wiki's Troubleshooting page may already have an answer to the problems you have.

Additional Support

If you have OSS installed properly, but still have issues, the OpenSound project has free user support forums and an IRC channel. Be sure to include the output from these commands so the experts don't have to prompt you for them

uname -a
ossmix
ossinfo -v3

Also, you'll want to note if the osstest command works

Forums

You can make a thread on the OpenSound user forums.

IRC

Freenode hosts the OSS support channel (#oss). You can paste your support information from the aforementioned commands here

Reverting to ALSA

NOTE: I've tested this procedure (on an Intrepid install) and was successful, but some people are complaining that it does not work. If you see any errors, please respond to the forum post or e-mail the page maintainer. Some users wish to revert back to ALSA to try Creative's X-fi drivers or maintain complete Ubuntu compatibility. Click here for the procedure.

Contributing to OSS

OSS has been recently open-sourced, so a community of developers and knowledgeable Linux users is just starting to grow around the project. While the creators of OSS are grateful for the extra technical support, they are essentially giving away something that they used to charge for. Theoretically, the hardware manufacturers should financially and/or technically support their products. Unfortunately, the PC audio aftermarket is dominated by an extremely litigious, proprietary company (name starts with a 'C') that minimally supports open-source development. If you happen to own a card from that company, I suggest you send an e-mail to them and demand more backing for Linux. If you wish to contribute to OSS developement there are several ways:

  • Order an OSS license. In this way you will also get free technical support for two years.
  • Send a PayPal payment (any amount) to [email protected].
  • Contribute code via the developers' community. To subscribe to the OSS developers' list, Click Here
  • Add content to the OSS wiki
  • Help other OSS4 users on the OpenSound forums and/or at the #oss Freenode channel.
  • Spread the word about OSS4 on the Ubuntu forums when you see a user having problems with ALSA

External Links

Page Maintainer(s)

dtl131 (Dave Lentz)