Jump to content
  • Advertisement
Sign in to follow this  
DrWhatsisname

OpenAL distance scaling

This topic is 2031 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

I am working on a project in lwjgl which uses OpenAL for its audio. The library seems to be primarily built for 3D sound, but I am attempting to use it in a 2D game. I'm having an issue where OpenAL seems to be interpreting the distances and velocities that I give as much larger than they need to be.

j2g3nDW.png

The picture above is a screen shot from the game. Its a top-down shooter and the enemies really aren't that far away. I'm playing a firing sound from the location of each of the enemies you see on screen whenever they fire a shot, but when they do, it is essentially inaudible. If I turn up the volume and move towards or away from the enemies as they fire, the pitch of the sound will bend (due to the Doppler shift) outside of the audible range, or potentially the frequency range of my speakers.

 

I have tried explicitly setting the AL_REFERENCE_DISTANCE and AL_MAX_DISTANCE values to 1.0f and the max value of a float respectively which does nothing presumably since these are the default values. The  problem could potentially have to do with the fact that my coordinates are in terms of pixels, so the enemies on screen are some 250 units away and the player is moving at 240 units per second. Is this a cause of the problem? How can I fix it?

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!