sound and camera position problem

winder

12-02-2008 23:42:36

hello all

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

http://www.youtube.com/watch?v=MOjD6rJkThA

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);
sound->setRelativeToListener(false);
boatNode->attachObject(sound);
mgr->getSceneNode("FreeCamNode")->attachObject(soundManager->getListener());


thanks in advance

stickymango

13-02-2008 00:18:23

Is it a mono sound?

CaseyB

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!

winder

14-02-2008 01:55:04

thanks guys

it seams that that was the problem ;)

CaseyB

14-02-2008 05:47:59

Cool! Glad you got it sorted!

pra

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);
mNode->attachObject(mSnd);
mSnd->setRelativeToListener(false);
mSnd->setGain(0.5);
mSnd->play();

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...

CaseyB

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.

pra

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?

CaseyB

04-03-2008 22:24:59

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

chilligirl

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?

stickymango

16-10-2008 17:45:25

What happens? crash, silence?

chilligirl

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?

stickymango

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.

singbol

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();
pTrackCamera->getParentSceneNode()->attachObject(SoundManager::getSingletonPtr()->getListener());
...
pSound = soundMgr.createSound(m_strSoundName, val);
pSound->play();
pSound->setRelativeToListener(false);
m_Handle->attachObject(pSound);

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