Re: OpenAL .. Directional Effects .. Need Help

Chris Robinson <[email protected]>
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
On Thursday, January 20, 2011 12:59:16 am Cherukuri Jyothi Swaroop wrote:
> Hi
> 
> I ported OpenAL to our platform and able to play the wav files.
> I wrote a sample openal application and try to produce some sound effects.
> Play back of audio is working but sound effects are not working.
> 
> I am using jungle.wav which is mono channel sound wave file as input

...

> I am expecting the sound to be played in the right headphone/speaker.
> 
> But the sound is played in both the headphones.

Hi.

I think the cause is here:

    SourcesPos[0] = 200;
    SourcesPos[1] = 200;
    SourcesPos[2] = 25;

This sets the source to the right side, but also high up and a bit behind the 
listener. This causes the sound to pan towards the center since it's not 
strictly on the right side. It shouldn't be perfectly centered (it should be a 
bit less than half way to the right), but it does make OpenAL produce sound on 
the left speaker as well as the right. If you set that to:

    SourcesPos[0] = 200;
    SourcesPos[1] = 0;
    SourcesPos[2] = 0;

Does it play on the right side that way? If so, that's just how the panning 
algorithm works. The farther a source is from a strict right position, the 
more it pans towards the left so it can make a smooth transition as it circles 
around the listener.


Also, on a side note:

    alGenBuffers(NUM, Buffers);
    Buffer[0]= alutCreateBufferFromFile("/Res/jungle.wav");

This is causing a leak. alGenBuffers creates NUM buffer IDs and writes them to 
the Buffers array, but alutCreateBufferFromFile is creating another buffer ID 
and overwriting Buffers[0]. The Buffers[0] that alGenBuffers created is lost, 
replaced by the one alutCreateBufferFromFile created.


Hope that helps. :)
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.