Discussion:
Memory backend and multiple instances
Juan Font
2012-06-13 17:06:43 UTC
Permalink
Hi,

I'm trying to create a... well, I don't really know how it is called what
I'm trying to create. The thing is: I want to "render" audio from the same
process (and different sources) to different (runtime-defined, may be more
than 100) memory buffers. At the same time. With different audio parameters
(frequency, number of channels,...).

To start, I think I should write is a backend (based on the current wave
backend, probably) which is able to output to a memory address. The problem
is how I code the multiple output functionality.

At this moment, I have two possible approaches:

a) To Create many instances of the same backend. The way I would implement
the different-memory-output-buffer functionality is by passing/hiding a
pointer to a struct that would encapsulate the required information
(frequency, number of channels, a pointer to the buffer where I want the
audio to be copied in) in the place of the ALCchar* at
backend_open_playback(ALCdevice *device, ALCchar* struct). Yes. It's dirty.
Very dirty. And I’ll have problems when working from the same thread
(getcurrentcontext)...

b) To Create a single instance of the backend. Create multiple ALContext's,
extending the information they store in order to define parameters like
frequency, nb channels and, of course, the memory address where the mixture
of the audio buffers from that context should be copied in.

Which option do you think is cleaner? I’m forgetting some hidden and
magical OpenAL functionality?


Thanks!

Juan Font
University of A Coruña
Chris Robinson
2012-06-14 03:31:36 UTC
Permalink
Hi.

OpenAL Soft 1.14 includes the ability to render audio to a memory buffer,
using the ALC_SOFT_loopback extension:
http://kcat.strangesoft.net/openal-extensions/SOFT_loopback.txt

You can create as many loopback devices as you want (using
alcLoopbackOpenDeviceSOFT), which can each have its own format+context and set
of sources to play. You also specify when and where each device renders
samples (using alcRenderSamplesSOFT). The format of the rendered audio is
controlled by the attributes passed to alcCreateContext.

If there's anything more you need or aren't sure of, feel free to ask. :)
Juan Font
2012-06-18 19:36:49 UTC
Permalink
Hi,

thanks! That was exactly what I was looking for. I've just finished an
initial implementation and it's working fine (along with
ALC_EXT_thread_local_context
<- very useful too).

Thanks, again :-)

Juan
Post by Chris Robinson
Hi.
OpenAL Soft 1.14 includes the ability to render audio to a memory buffer,
http://kcat.strangesoft.net/openal-extensions/SOFT_loopback.txt
You can create as many loopback devices as you want (using
alcLoopbackOpenDeviceSOFT), which can each have its own format+context and set
of sources to play. You also specify when and where each device renders
samples (using alcRenderSamplesSOFT). The format of the rendered audio is
controlled by the attributes passed to alcCreateContext.
If there's anything more you need or aren't sure of, feel free to ask. :)
_______________________________________________
Openal mailing list
http://opensource.creative.com/mailman/listinfo/openal
Loading...