[Openal] How to capture Listener output?
Chris Robinson
chris.kcat at gmail.com
Wed Mar 12 13:20:42 PDT 2008
On Wednesday 12 March 2008 12:36:56 pm Brad Aisa wrote:
> I want to use OpenAL in a robotics simulation context. What I
> want to do, is capture the audio stream of the Listener, for
> input into my robot's auditory processing subsystem.
>
> How can I do this?
Hi Brad.
It should be possible as long as you can configure your audio card to capture
its own output. Under Windows' mixer settings, it's likely a "Stereo Mix"
capture option. Then you can open a sound device for OpenAL output, and open
a device for OpenAL capture, and the capture would get the listener's output.
You would need to be careful because it would also capture other system
sounds, however.
Depending on your OS and implementation though, there may be other ways to do
it, too. Under Linux with ALSA, you can redirect the 'default' device to
write to a fifo (using ~/.asoundrc), then have your app watch and read that
fifo. Additionally, using OpenAL Soft in Unix-like systems, you can configure
the wave file writer to write to a fifo and do the same thing, without the
need for a sound card.
But do note, regardless of the available methods, OpenAL processes
asynchronously. It would be constantly processing data in the background in
real time as you updated the listener and sources, without a way to tell it
to processes a specific amount at a specific time. If it's outputting to a
fifo, processing will block as long as you're not reading from it, but this
isn't terribly exact.
More information about the Openal
mailing list