[Openal] porting questions
Daniel PEACOCK
dpeacock at creativelabs.com
Thu Jun 7 10:53:24 PDT 2007
Hi Dave,
> > So, if you generate 60 Sources then you will know that you can play
> back
> > 60
> > 3D mono buffers simultaneously. NOTE : If you are playing buffers
> with
> > more than 1 channel then they require additional resources (e.g stereo
> > takes 2 voices on hardware, 5.1 takes 6 voices, etc ...). You can
> either
> > keep track of this yourself (e.g with 60 Sources if you play one
> stereo
> > then you can only play 58 mono buffers), or you can use the alc
> Context
> > creation hint ALC_STEREO_SOURCES to tell OpenAL to reserve Sources to
> > enable playback of a certain number of stereo buffers simultaneously.
>
> Hi Dan,
>
> That is an interesting titbit I did not pickup from the docs.
>
> I am currently creating as many sources as are possible at startup, and
> then assigning these buffers as the app progresses.
>
> So presumably from what you have just said, if I was only able to
> generate 30 sources at startup (using alGenSources) and I then assigned
> one of these a stereo buffer (using alSourceQueueBuffers), I would only
> be able to use 28 if the remaining sources.
>
> So what happens to the remaining (already generated) source?
> (I generated 30, 1 is playing a stereo buffer, 28 are playing mono
> buffers so 1 remains)
The tricky part here is that the OpenAL API doesn't differentiate between
Sources that play mono vs stereo (or multichannel) buffers. The API
assumes that a Source can be used to play anything - but in reality
hardware doesn't work that way - more resources are required for stereo vs
mono playback.
If you have 30 Sources generated - then you could play 30 monos
simultaneously at one point in time, and then 28 monos and 1 stereo
simultanesouly at another point in time.
> Does this source just fail to accept buffers?
> Does it accept buffers but fail to play them?
I'll have to check into this ... but I have a feeling that some AL
implementations may refuse to accept Buffers, and some may fail to play the
Source.
> Is there some way to determine that this source is 'no longer working'
> before I try to use it?
If you *know* that you will only need a certain number of Stereo buffers to
be simultaneously (e.g 1 music track) then I would recommend using the
Context Creation attribute. This means that you won't run into any issues
because you will always be able to play 1 stereo and n - 1 monos (where n
is the number of sources you generated).
Otherwise I would recommend keeping track of the number of channels
yourself.
Dan
More information about the Openal
mailing list