Hello all,
I’m trying to figure out how to play a sample so the sound appears to
move from the left to the right relative to the listener.
First I register the sound effect function and the channel to use.
right?
Mix_RegisterEffect(1, AUD_Effects, NULL, NULL);
Here’s the function itself.
static void
AUD_Effects
( int chan, void *stream, int len, void *udata )
{
Mix_SetPanning( 1, 90, 100 );
}
And. inside my sample object, is my play function.
if( (m_iChannel = Mix_PlayChannelTimed( iChannel, m_pChunk, iLoops,
iTimeLimit )) < 0 )
m_iChannel being passed in as 1.
So.It didn’t magically go left to right which was a huge disappointment
So I tried calling the Mix_SetPanning inside a for loop with the
left and right values as variable. lowering the left and
Increasing the right. That was ineffective.and complained a great deal.
I’ve had a few passing notions as to how to accomplish this. but I’m
still fairly new to programming. Googling for examples on sample
modification for effects and stuff turned up little.
I also looked at OpenAl. but it seemed a bit too much for my purposes. I
just wanted some simple panning in all directions on a 2d plane.
I appreciate any advice, pointers to good resources or an outright
solution!
Thanks!
-Kevin