[Openal] Transparently mixing many sounds
Nolan Darilek
nolan at thewordnerd.info
Tue Sep 26 19:42:06 PDT 2006
Hi all, new here. I'm not entirely sure how to accomplish this, so
hopefully I'll find a solution here.
I'm trying to design an object-oriented sound system between OpenAL
and a 3-D game engine. The system should be highly transparent--users
of the 3-D engine attach a SoundNode to game objects, set its sample
or stream and the sound's velocity/position/orientation are updated
accordingly. Ideally, the developer need do no more than set/change
the sound and various high-level properties, letting the lower-level
layer handle everything else.
And I have it mostly working. Where it fails is when I try to
allocate more sounds than were initially requested--the game explodes
rather messily. Ideally, this shouldn't happen.
First, does OpenAL include any elegant way of handling this? If not:
I have this idea to catch the exception when it is thrown, storing
the number of playing sounds as the maximum that can be allocated.
Then, whenever that maximum is reached, the system enables sounds
based on a) whether a priority flag is set and b) their perceived
loudness. In this way, sounds that are less perceptive are
deactivated while the more obvious ones drown them out, so to speak.
Given a distance from the listener, gain and roll-off factor, plus
perhaps the reference distance and other variables which I may not
yet be considering, is there some way to calculate the sound's
perceived volume? It need not be in any actual units--I simply need
to determine how loud the source is when compared with others. It
also need not be exact--just some reasonable approximation would be
great.
Thanks.
More information about the Openal
mailing list