Jump to content
  • Advertisement
Sign in to follow this  
codyc

Cannot get sound to change by moving the Listeners position in OpenAL?

This topic is 4913 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My problem is that i cannot get the sound to get louder or softer by moving the position of the Listener away from or to the source. What puzzles me is the Source works fine. I can move its position all around and the sound will change accordingly. I am using the default distance model. I use this function to set the Listeners position to the cameras position. float cameraPos[3]; alListenerfv(AL_POSITION, cameraPos); Am I not doing something right before I set the Listeners position or do I have to set something up for it to recognize when the listeners position has moved or am i not using the correct function to set the position? Why does it work when the Sources postion moves and doesnt when the Listeners position moves? Can anyone help.

Share this post


Link to post
Share on other sites
Advertisement
With the code you gave below ... all I can get is you are not initializing the cameraPos array. If that doesnt work then try ...

alListener3f (AL_POSITION, X, Y, Z);

where X, Y & Z are the Listener's value on X, Y & Z Axis.

Hope that helps.

Share this post


Link to post
Share on other sites
[edit] First try The Lion King's post, I think he/she is correct. I didn't see that till later [embarrass]. Make sure to set: cameraPos[0], cameraPos[1], and cameraPos[2] to valid numbers! If that does not work, try mine, but the King's suggestion should fix it for you.

Quote:
Original post by codyc
Why does it work when the Sources postion moves and doesnt when the Listeners position moves?
Can anyone help.


The last time that I helped someone with this exact problem, they did not have the updated sound drivers for their computer. They were relucant to update, but finally gave in and it fixed their problem. I would suggest that you try the same thing as well as make sure you have the most recent OpenAL runtime installed.

- Drew

Share this post


Link to post
Share on other sites
Thanks for the try but thats not it. I didnt put the code in there that initializes the cameraPos. I put the cameraPos in there to show what i was passing in for the other parameter of the function. I did think that was the problem at first too and checked it. The Listener is actually getting the position when i set it but for some reason it doesnt make a difference. I also checked to see if the Sources position was somehow following the Listeners but its not.

Share this post


Link to post
Share on other sites
Well ... there are other means of setting up the listener position. See the documentation for it. If even that doesnt work ... then I would suggest that get updated sound drivers and get a working dll from someone who has done that.

The current one in OpenAl.org is buggy and deosnt do a couple of things I am sure about. There are a few bugs in it.

This can be one too. One in the old one was that the pause didnt work.

You will have to check it ... cause things get pretty frustrated when you work with OpenAL :)

Share this post


Link to post
Share on other sites
Besides the file/driver update, I can only think that maybe this. I know that the listener and the source position/rotation/whatever must be set before playing the sound when you want to see the difference. If you are looping the sound then changing the listener pos, it won't work. You have to play each time you move the listener. I had this problem and I fixed it this way. That may be it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!