Re: Two more questions

Chris Robinson <[email protected]> Fri, 16 Nov 2012 10:43:07 -0800
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
On 11/16/2012 07:22 AM, [email protected] wrote:
> Let's say I have a PC, and it has a sound card.  That's one Device, right?

That depends on your OS and system configuration. My built-in sound card 
has two outputs, for instance: an analog output and a digital (IEC958) 
output. ALSA exposes both of them, although PulseAudio only shows the 
analog output.

Bluetooth or USB headphones also appear as their own devices.

> That one Device.  Can I have two, or three, or twenty Contexts opened up
> on that same Device?

With OpenAL Soft you can. I don't believe Creative's Generic Hardware 
and Generic Software drivers support multiple contexts. I'm not sure how 
Apple's implementation or Creative's device-specific drivers work, though.

> Can those Contexts be in different modes (one in Stereo, another in 5.1
> Surround)?  Does the answer depend on the capabilities of the device?

Not with OpenAL Soft. Each open device has one output mode, and all 
contexts on the device adhere to that. However, different devices can be 
in different modes.

> The reason for this question is that there are other parts of JMRI that
> also generate sounds (things like ambient noises, control panel beeps and
> clicks, and so on), and I would like to know how much independence VSD can
> have in controlling its own Context vs. having to share with the other
> sound-generating parts of JMRI.

Generally speaking, you should only need one context to handle playback. 
Different sources can be set to play based on their individual roles 
(with or without reverb, with or without 3D positioning, different 
volumes, etc) within a single context.

You should only ever need a separate context if you either need to 
output to a different device (in which case it's created from a separate 
device), or if you need two independent context states (so changing one 
context doesn't affect the other).

> Do I understand correctly that Sources cannot be shared... i.e. if I want
> to play the same buffer in two different Contexts, I have to have a
> separate Source in each Context, with those two (or more) Sources linked
> to the same Buffer, right?

Right. Sources are per-context and buffers are shared between contexts 
on one device. However, two different devices don't share buffers.

> So those are the basics so far.  I'm sure there will be more as i move
> forward.  As you might guess from my earlier question about loopback, one
> of the goals is to stream the train sounds out to users who are
> controlling their train from a smart phone app, so they can listen to
> their own "cab view" sounds on headphones.

It sounds like each separate "view" would need its own device, with its 
own context. One device for one output stream, so if you're sending 
different streams to different smart phones, they each need to be 
rendered from separate devices.

> Thanks a bunch!  OpenAL is very cool, and is really helping me turn this
> into something fun.

Cool. :) Glad it's working out for you.
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal