[Openal] Multiple local players
Chris Robinson
chris.kcat at gmail.com
Sat Nov 24 11:51:05 PST 2007
On Saturday 24 November 2007 09:39:43 am Charles Pence wrote:
> Hello list--
>
> Has anyone ever attempted a OpenAL-based sound solution with multiple
> local players? I know having "two listeners" isn't supported by AL, but
> is there some cheap-trick method that one could conceivably use to fake
> the illusion of more than one listener on the local machine?
Technically, you can create more than one listener. Just create multiple
contexts (one context = one listener). Unfortunately, the OpenAL spec doesn't
gaurantee being able to create more than one context per device.
Alternatively, you can simply open two devices and get a single context from
each. This, however, may not work on Windows (judging by the old Windows
source, the mixer has improper assumptions about the current context), and it
will *not* work using the SI (Unix implementation).
The (psuedo-)good news is that OpenAL Soft does work correctly with multiple
devices/contexts. As long as your card/driver supports it, just open the same
device twice, and get one context from each. Each context will then be one
listener. Make sure to set the correct context before manipulating its
sources, and you're good.
Hopefully OpenAL Soft will become the "default" Unix implementation. It works
on Windows too, but I doubt Windows users will care to use it over Creative's
version. For Windows, just bother Creative to fix the bug if it's still
around. ;) You can check out OpenAL Soft here, if you're interested:
http://kcat.strangesoft.net/openal.html
If you don't want to go that route, then I can't think of anything that will
work correctly. Even with fudging the per-source parameters to make them
behave as if controlled by a second listener, some parameters can't be done
properly and the real listener may cause interference (eg. with coning).
More information about the Openal
mailing list