This is a reference implementation for openAl (namely openal-soft) featuring pulseaudio as backend. This code is already usable and was tested with a 4 speaker setup which worked stable. This code is not perfect and all points are marked with a TODO in the pulseaudio.c file.

Current state: This project is not developed any further, it's dead

Since the maintainer of openal-soft (a good reimplementation of openal from creative) was not convinced of the concepts behind pulseaudio and since my code in it's current state didn't match his high quality standard it wasn't included in the main release. Since openal seems to be pretty unimportant for the main pulseaudio developer Lennart Poettering on the other side I decided to stop development on this plugin.

I'm very sad about this. I'm also sad about the political situation since none of these developers sees the real benefit of my current work. Most of the users can use the pulseaudio wrapper (which does only stereo) on bad soundcards (which don't have hardwaremixing for more virtual streams) this might be not that bad you think - maybe yes.

All those who want surround or more complex speaker setups have to use alsa and this dmix crap which tends not to work. If one wants 'pulseaudio' as backend one can make use of my backend.

Have fun...

Contents

Foreword

Pulseaudio [1] is what linux users might be searching for quite some time yet. Since i use pulseaudio now nearly everywhere i start to see ALSA more as a driver with a nice configuration API around. But ALSA has it's limitations and the problem is that this hasn't changed for years with a very bad influence on linux sound experience of new and even of pro uses as i would consider myself.

The main problem with ALSA is that it's:

  • platform dependant (linux only)
  • very complex while poorly documented
  • is seen as the future of linux audio

Especially the last point makes a real working standard a hard thing.

what is pulseaudio

basically i see pulseaudio as a abstraction layer above soundcards which helps to mix audio streams what alsa only could (if at all) do if you use the alsa library. the native driver doesn't have to implement that which is why alsa suckz for most users since there are many soundcards (as laptop soundcards/onboard cards in normal pcs) which don't do mixing in hardware BUT in software and that is what alsa can only do with a plugin. anyway pulseaudio is much more and has a lot of features which make a really good experience using it. Be warned that the setup might be not that easy since it's still on top of ALSA ;-)

The top feature i love about pulseaudio is the fact that every applications subscribes a unique stream with a "label" and a "description" so that volume levels can be tuned individually.

interest in pulseaudio

my biggest interest using pulseaudio natively (without any alsa2pulse) wrapper where to make the openAL SI library a native pulseaudio client since pulseaudio is crossplatform. the problem was that openAL SI seems to be unmaintained for some time now and the codebase is really ugly. after a while i discovered openAL-soft [3] which is a neat drop-in replacement. my pulseaudio plugin for this software is still alpha (after 7 days working on it) but it's working great (with a big buffer - meaning a big delay) and once i fixed all TODOs it's likely to be a robust backend. the openAL code for the pulseaudio backend can be found in [4] on my project folder OR via a git (see below) which is more likely what you want.

For how you have to download the whole directory openAL and install it yourself. That said note that it's only meant for developers to test and debug code. Once it's stable you should search for a new openAL - soft release which includes the pulseaudio backend.

openAl-soft pulesaudio backend download

My openAL-soft pulseaudio extension can be downloaded with:

Next build it with:

  • cmake .
  • make

And afterwards read the documentation how to use/install (found in):

  • Alc/pulseaudio.c

how to use / test

after you built the library called openal.so in /tmp/openal-soft/libopenal.so you can do:

The pulseaudio extension to openal-soft was created using:
 - parts from the pulseaudio documentation
 - parts from the gst pulse plugin
 - parts from other plugins from within this project (alsa backend)
All code was put together by Joachim Schiele <js@dune2.de>

I personally want to thank Chris Robinson for his insightfully and patient help
with all the code/questions I bothered him.

if you want to try the pulseaudio backend or if you want to help improving it:
 git clone http://lastlog.de/git/openal-soft-pulseaudio

you need to modify ~/.openalrc to make it use the pulseaudio backend called "pulseaudio" 
- instead of alsa, sdl or null... whatever. see alsoftrc.sample

Once you compiled the library you can test it without having to install it.
'cd' into the directory containing libopenal.so and then simply do:
  export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
  ln -s libopenal.so libopenal.so.0
And next you should check if your application uses the library with ldd
For example the game "spring" uses this (Without the export of LD_LIBRARY_PATH):
 ldd /usr/games/bin/spring | grep -i open
       libopenal.so.0 => /usr/lib/libopenal.so.0 (0xb7ade000)
       libGL.so.1 => //usr//lib/opengl/ati/lib/libGL.so.1 (0xb79c7000)
And after the export it's:
 ldd /usr/games/bin/spring | grep -i open
       libopenal.so.0 => ./libopenal.so.0 (0xb7a9e000)
       libGL.so.1 => //usr//lib/opengl/ati/lib/libGL.so.1 (0xb7987000)
The last step is to create a openal-soft config file to which uses the pulseaudio backend.
      See alsoftrc.sample
Now you can launch you application from this terminal using the local library.
NOTE: this change is only temporary. To make it permanent copy this library 'over'
      the library found in /usr/lib/  (see the exact openal path in the first ldd output)
NOTE: if you want to test ut/ut2004 with pulseaudio you have to replace the
      library (for instance) /opt/ut2004/System/openal.so with the one you just built.

ebuild for gentoo

# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-libs/openal/openal-1.6.372.ebuild,v 1.9  2009/02/04 21:38:21 armin76 Exp $ 

EGIT_REPO_URI="http://lastlog.de/git/openal-soft-pulseaudio"

inherit eutils cmake-utils git

MY_P=${PN}-soft-${PV}

DESCRIPTION="A software implementation of the OpenAL 3D audio API"
HOMEPAGE="http://lastlog.de/wiki/index.php/Pulseaudio"

LICENSE="LGPL-2"
SLOT="0"
KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ~ppc64 sparc x86 ~x86-fbsd"
IUSE="alsa oss debug"

DEPEND="alsa? ( media-libs/alsa-lib )"

S=${WORKDIR}/${MY_P}

DOCS="alsoftrc.sample"

src_unpack() {
	git_src_unpack
} 

src_compile() {
	local mycmakeargs=""
	use alsa || mycmakeargs="${mycmakeargs} -DALSA=OFF"
	use oss || mycmakeargs="${mycmakeargs} -DOSS=OFF"
	use debug && mycmakeargs="${mycmakeargs} -DCMAKE_BUILD_TYPE=Debug"
	cmake-utils_src_compile
}

pkg_postinst() {
	einfo "If you have performance problems using this library, then"
	einfo "try add these lines to your ~/.alsoftrc config file:"
	einfo "[alsa]"
	einfo "mmap = off"
}


references

Powered by MediaWiki