sound and camera position problem


12-02-2008 23:42:36

hello all

i'm having a sound problem with my powerboat race game...

I execute the folowing code, but the "Engine" sound is not dependant on the camera position and orientation.
it's just steady... always centered and the same intensity. I checked the demos and it seems like I'm not doing anything different.
But why doesn't it work?

soundManager = new OgreAL::SoundManager();
OgreAL::Sound *sound = soundManager->createSound("Engine", "Engine.wav", true);

thanks in advance


13-02-2008 00:18:23

Is it a mono sound?


13-02-2008 01:01:18

Yup, stickymango is right to ask. OpenAL can only position monophonic sounds in 3D space. Have a look at that. By the way, your game looks AMAZING! I can't wait to give it a try!


14-02-2008 01:55:04

thanks guys

it seams that that was the problem ;)


14-02-2008 05:47:59

Cool! Glad you got it sorted!


04-03-2008 17:03:11

I have a similar problem: i try to shoot ellipsoids with sounds attached to them, and i do not hear any difference as they move away. I'm using the wavs from the example for testing. I suppose they are mono...

I create the sounds like this:
mSnd = OgreAL::SoundManager::getSingletonPtr()->createSound(sndName,sndFile,true);

with mNode being the ellipsoid's SceneNode, which is attached to a moving OgreNewt::Body.

Could the problem be that I scaled everything down so that 1 unit = 1 meter? If yes, how can I make OgreAL use the same scale?

edit: just noticed that I forgot to attach the listener to my camera. Now the sound comes from the right direction, but the volume still doesn't change with the distance...


04-03-2008 18:43:43

1 unit = 1 meter is what OgreAL defaults to anyway so that shouldn't be the problem. You can try adjusting the Reference Distance, Rolloff Factor and Max Distance. This will cause the sound to fade out faster.


04-03-2008 20:28:50

seems to work, thanks^^

but, do i have to set it for each sound? is there no function to change the default values?


04-03-2008 22:24:59

Yeah, those are per Sound values, so you'll need to set them for each Sound.


16-10-2008 17:41:25

Hey guys, I followed the advice here and converted my stereo sound to mono, and now it wont play at all! Any ideas?


16-10-2008 17:45:25

What happens? crash, silence?


16-10-2008 18:07:06

No, I got it to play now, dodgy export from audition, I exported it correctly now, but now I cant get it to fade. I have a pretty big environment, and I have a character that I talk to in first person. I need it to fade between 0 and 300, what do you think is a good rolloff factor?


17-10-2008 09:38:51

Off-hand I don't know, you need to calculate it based on your scene unit size and take a look at the OpenAL manual to see the calculation for the attenuation model which you could use to work out the correct values.

If you want future support I'd suggest moving to OgreOggSound for the time being, it should slot into your existing application easily and it now has its own active forum for any help.


03-08-2009 10:14:05

Hi, Have u solved this problem?I just run into the same situation,my codes looks like:
Camera *pTrackCamera = OgitorsRoot::getSingleton().GetViewport()->GetCameraEditor()->GetCamera();
pSound = soundMgr.createSound(m_strSoundName, val);

I have tried to set the rolloff factor、max distance and reference distance,but they didn't work yet~~~
help~~3 q!