sound and camera position problem
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
Is it a mono sound?
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!
it seams that that was the problem
Cool! Glad you got it sorted!
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...
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.
seems to work, thanks^^
but, do i have to set it for each sound? is there no function to change the default values?
Yeah, those are per Sound values, so you'll need to set them for each Sound.
Hey guys, I followed the advice here and converted my stereo sound to mono, and now it wont play at all! Any ideas?
What happens? crash, silence?
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?
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.
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~~~