[Solved] All sounds get equal volumes

taz0k

19-11-2008 20:53:53

My sounds all sound from both speakers at the same volume even when they are at different positions from my listener, i.e. I can't get 3D positioning to work. My sounds are mono wavs. And I have tried the to replace my sounds with the sounds in the OgreOggSound demo.

I create and init the sound manager with:
new OgreOggSound::OgreOggSoundManager();
if(!OgreOggSound::OgreOggSoundManager::getSingleton().init()){
LOG_ERROR("SoundManager failed to initialize.");
}
OgreOggSound::OgreOggSoundManager::getSingleton().setDistanceModel(AL_LINEAR_DISTANCE)



I attach the listener like this:
node->attachObject(SoundSystem::getSingleton().getListener());


And attach sounds to nodes like this:
OgreOggSound::OgreOggISound* sound =
OgreOggSound::OgreOggSoundManager::getSingleton().createSound(soundName, filename);

sound->setMaxDistance(250);
sound->setReferenceDistance(50);

node->attachObject(sound);



Earlier I have used OgreAL in much the same manner, but with OgreAL I got 3D positioning to work (for a while til the usual OgreAL bugs kick in). OgreOggSound seems to be more stable so I gave it a shot, but now I am stuck.

Help would be much appreciated.

stickymango

20-11-2008 10:24:12

The node you are attaching the listener to is the camera not the same as the sound nodes isn't it?

Its not obvious from your code snippet

something like:mCamera->getParentSceneNode()->attachObject(OgreOggSoundManager::getSingleton().getListener());
The only other issue is non mono sounds..

Anonymous

20-11-2008 10:54:39

Thanks!

You are right I could have bee more specific.
I attach the listener to the camera and the sounds to other nodes moving in the world.

(I guess the best thing to do would be to create a very small minimal examples and see if it works. And if it don't then post the code here. Gonna do that as soon as I have time)

stickymango

20-11-2008 10:57:56

Are you calling OgreOggSoundManager::update(fTime) in your idle loop?

taz0k

21-11-2008 21:37:37

Thanks!
I didn't, but now I do.
Stereo and attenuation works flawlessy, but only I after I also removed the line:
OgreOggSound::OgreOggSoundManager::getSingleton().setDistanceModel(AL_LINEAR_DISTANCE);
That is when I do not specify a distance model.


When/if I change the distance model to AL_LINEAR_DISTANCE, AL_INVERSE_DISTANCE or AL_EXPONENT_DISTANCE, then the sounds will be played at the maximum volume not depending on distance. I have tried different values for MaxDistance, ReferenceDistance, and RolloffFactor, but they don't seem to have any noticable effect when I use any of the above mentioned models.

stickymango

22-11-2008 09:50:34

Hmmm, thats strange as I generally only use AL_LINEAR_DISTANCE and have no problems. :?

NoodlesOnMyBack

25-11-2008 07:02:15

Im having the same problem here, removed that line and everything worked.

stickymango

25-11-2008 10:14:43

Hmmm, does the demo still work okay?

NoodlesOnMyBack

25-11-2008 19:18:10

Didnt tried the demo very much, but the yellow monsters should emit a 3d sound? I dont think its working either, later i'll give you a better answer, since right now i can barely test it.


17:21:05: ***********************************
17:21:05: *** --- Initialising OpenAL --- ***
17:21:05: ***********************************
17:21:05: *** --- OpenAL version 1.1
17:21:05: *** --- AVAILABLE DEVICES --- ***
17:21:05: *** --- Generic Hardware
17:21:05: *** --- Generic Software
17:21:05: *** --- Choosing: Generic Hardware (Default device)
17:21:05: *** --- OpenAL Device successfully created
17:21:05: *** --- OpenAL Context successfully created
17:21:05: *** --- SUPPORTED FORMATS
17:21:05: *** --- AL_FORMAT_MONO16 -- Monophonic Sound
17:21:05: *** --- AL_FORMAT_STEREO16 -- Stereo Sound
17:21:05: *** --- AL_FORMAT_QUAD16 -- 4 Channel Sound
17:21:05: *** --- AL_FORMAT_51CHN16 -- 5.1 Surround Sound
17:21:05: *** --- AL_FORMAT_61CHN16 -- 6.1 Surround Sound
17:21:05: *** --- AL_FORMAT_71CHN16 -- 7.1 Surround Sound
17:21:05: *** --- EFX Detected
17:21:05: *** --- 1 Auxiliary Effect Slot(s)
17:21:05: *** --- 1 Auxiliary Send(s) per Source
17:21:05: *** --- EFFECTS SUPPORTED:
17:21:05: *** --- 'Reverb' Support: YES
17:21:05: *** --- 'EAX Reverb' Support: YES
17:21:05: *** --- 'Chorus' Support: NO
17:21:05: *** --- 'Distortion' Support: NO
17:21:05: *** --- 'Echo' Support: NO
17:21:05: *** --- 'Flanger' Support: NO
17:21:05: *** --- 'Frequency shifter' Support: NO
17:21:05: *** --- 'Vocal Morpher' Support: NO
17:21:05: *** --- 'Pitch shifter' Support: NO
17:21:05: *** --- 'Ring modulator' Support: NO
17:21:05: *** --- 'Autowah' Support: NO
17:21:05: *** --- 'Compressor' Support: NO
17:21:05: *** --- 'Equalizer' Support: NO
17:21:05: *** --- FILTERS SUPPORTED:
17:21:05: *** --- 'Low Pass' Support: YES
17:21:05: *** --- 'High Pass' Support: NO
17:21:05: *** --- 'Band Pass' Support: NO
17:21:05: *** --- XRAM NOT Detected
17:21:05: *** --- EAX 2.0 Detected
17:21:05: *** --- Created 22 sources for simultaneous sounds
17:21:05: *** --- Using BOOST threads for streaming
17:21:05: ***********************************
17:21:05: *** --- OpenAL Initialised --- ***
17:21:05: ***********************************

stickymango

25-11-2008 21:06:14

If you could check that would be great, also could you try initialising with:OgreOggSoundManager::init("Generic Software")
and see if that works differently...

tdep

24-03-2009 18:21:36

I get the same error. Unless I use software mode, all sounds are played at equal volume no matter what distance model I use. If I don't force software mode though and don't add a distance model, I get 3d sound.

Should I force software mode on, to be sure that every one using the program will get the same experience?

stickymango

25-03-2009 09:46:25

It would seem that it always works if you use 'Generic Software' mode, however that shouldn't be necessary, I think the bottom line is a driver problem with your current hardware which you should try to rectify.

tdep

25-03-2009 11:42:12

I'll try and update the driver, and get a log before and after. Unless I can detect whats causing it, I'll have to force software mode, as I wouldn't want people that have the same issues to get a sound overload when they start the program.

stickymango

25-03-2009 12:01:11

I'm pretty certain its nothing to do with the library as I have a duff soundcard on one of my test machines which exhibits this same behaviour, it also didn't attenuate properly, i.e. on the OgreAL Directional demo it only updated the attenuation when you stopped/started the playback, flying around made no difference to attenuation, however every other machine I tested on worked fine, as did using 'Generic Software' mode on the duff machine, so I can only assume some soundcards/drivers have issues with OpenAL 3D playback...

For final deployment, as long you offer the user a sound card choice and maybe add a troubleshoot section explaining the possible issue, I think you can safely default to 'Generic Hardware'. If you manage to correct the problem on your system then add that info too, let me know how you sorted it if you do!

HTH

tdep

25-03-2009 12:13:24

I promish. I'm at work right now, and can't test the hardware problem here, as the soundcards at work have no issues, but I'll try updating when I get home, and then later let openAL/OgreOggSound choose a default, with a user option to override like you suggested.

Thanks

tdep

25-03-2009 21:45:14

I updated my realtek audio driver, and now I have 3d sound using hardware. There arn't any difference in the ogreoggsound logging between the two drivers, so I'm assuming it must be OpenAL that's having trouble detecting the correct settings, as fmod worked with 3d sound.

Anyway, I will do as you say, and add an override in setup, plus a adding to the troubleshoot section that updating audio drivers might solve it if people experience trouble.

Ty for your help

stickymango

26-03-2009 09:27:04

So its working okay now?

tdep

26-03-2009 09:44:19

Yep - the driver update did the trick.

stickymango

26-03-2009 09:50:13

Excellent! :D

tdep

26-03-2009 10:28:14

Yep :)

giova

13-04-2009 03:34:58

That is "fun" i used to have the same problem, so i placed a OgreManager.Update call into my idle loop.

Now the Orgre object witch has the sound attached to it, cannot hit other objects ! it simply pass threw everything :)
if i remove the Update, then collision come back, but then volume still equal all the time again.

i'll do more test tomorow (sooo late now 5am). But this behavior is funny isn't it? :)

stickymango

13-04-2009 13:29:23

Interesting, I've looked through the code and noticed that I wasn't calling some subclassed virtual functions in my implementations, namely in _notifyMoved(), don't know if this maybe causing your issues but I've committed a fix to the SVN version of the lib, try downloading it and see if it fixes the issues.

giova

15-04-2009 20:31:11

I've test it, and it's works fine now !

You re the King :)

Thank you for your fast reaction.

I keep testing your library that looks very good, my teamates and I will probably use it for our futur game.
Thanks again

stickymango

16-04-2009 12:23:57

Woohoo! thats great news, thanks for spotting it! :D