[Openal] Artifacts - Alternating from left to right channels?
Daniel PEACOCK
dpeacock at creativelabs.com
Mon Mar 2 03:12:36 PST 2009
Hi Ash,
> Sorry for not replying sooner, I got caught up in some other stuff last
> week. I managed to have another go at it yesterday. I noticed that
moving
> the engine position further from the listener resulted in more consistent
> sound, also updating the POSITION of the sound before the VOLUME and
PITCH
> seemed to make a positive difference. It isn't quite perfect though.
>
> I haven't tried the AL_SOURCE_RELATIVE flag yet as I was hoping I could
get
> a solution that would work for both the player and network cars, and also
> for replays.
The problem with not using the AL_SOURCE_RELATIVE flag for sounds that are
tied to the listener's position is that you may introduce some unwanted
movement in the sounds that are typically closest to the listener (and
therefore the loudest and most obvious). e.g Imagine a sound that is at
0,0,-1 and the listener at 0,0,0. In the next frame the listener moves
forward and left to -0.1, 0, -0.1. If the game sets the listener position,
and it is committed by the AL render (either immediately or because the
next timer update happens to be called), then for a moment the sound's
relative position to the listener is actually 0.1, 0, -0.9 (slightly to the
right). When the source's position is set again, presumably to -0.1, 0,
-1.1 (because it is moving with the listener) it's relative position will
be restored to 0,0,-1. This could possibly explain the problems you are
seeing.
> I don't currently reuse buffers, everything is static for the moment. Is
> there some kind of buffer pool addon that can be used when I add network
car
> sound?
Just to be clear on terminology - you can have lots of Buffers (containers
for audio samples), but you can only have a relatively small number of
Sources (the object that actually plays or renders the samples from an
attached Buffer or queue of Buffers). There is no high-level source
management functionality in OpenAL - but various schemes that you can use
for deciding which Sources to play include ... sound priorities, loudness
(a function of distance and gain), and time left to play (e.g bump the
sound that is closest to finishing playing).
Dan
Creative Labs, UK
More information about the Openal
mailing list