[SOLVED] Audio "master volume"?

Its strange that I never thought of this before.

Is there a way to set a “master volume” that will affect all the sounds playing, rather than modify the volume of each sound?

What if I want to have separate volume sliders for “sfx”, “music” and “GUI sounds”? I thought of making 3 parents and changing their volume instead, but I dont see any child-parent relations for sound effects.

Yeah, you can set the volume on the audio manager rather than the individual audio sounds.

That was fast.

And if I want to group sounds under “Music”, “SFX” and “GUI” and change their volume, then what?

By GUI I mean the rollover and click sounds loaded as parameters.

Use a different audio manager for each group.

David

OK.

Wait.
How can I create a new audioManager?
How can I set music and sfx to another audioManager?
I cant find anything in the API ref and manual.

Why is that sfx is in a list but music is in a single audioManager object? Optimization?

By default, ShowBase creates one AudioManager for music and stores it in base.musicManager. It also creates one AudioManager for sound effects and stores it in base.sfxManagerList[0], with room for more in case you want more. The theory is that you might want multiple sfx managers, but probably only one music manager. Of course, that’s really up to you; you can use any of these AudioManagers for whatever purpose you like. And you can create another one of them with a call AudioManager.createAudioManager(), as many times as you like.

Use loader.loadSound() to load a sound with the AudioManager of your choice, specified as the first parameter. Note that loader.loadSfx() maps to loader.loadSound() with base.sfxManagerList[0] as the first parameter, and loader.loadMusic() maps to loader.loadSound() with base.musicManager as the first parameter.

All of this information can be readily gleaned by examining ShowBase.py. :slight_smile:

David

Sorry, dont know why I asked

Its weird, if I change the volume of Sfx like this:

base.sfxManagerList[0].setVolume(x)

then my background music’s volume will change as well, though Ive loaded it with

loader.loadMusic('')

What can be the problem? I havent done anything else.

I don’t know. That does sound weird. Which sound API are you using, FMod or OpenAL? Have you tried switching to the other one, to see if it might be a bug in that particular sound interface?

David

Youre right, its a bug when using FMOD.
But OpenAL has loads of other bugs, ‘clipping’, framerate drops and complete python crash, so I would like to see this fixed.
(using Windows7 and latest builds)

I actually fixed this some time ago, but I don’t think it ever got integrated.
Here are my FMOD source files, they are based on the SVN source from Sept. 4th.
http://novuscom.net/~spacebullet/audiotraits.zip
This allows separate volume control on each AudioManager, as well as separate DSP effects.
Some day I will rewrite that nasty DSP system. :wink:

OK, why isnt the fix integrated yet??

I suppose it got missed the first time I posted it.
But the squeaky wheel gets the grease as they say.

OK, committed your changes. I’ll take your word for it that it works.

Next time, consider posting a patch instead of posting a zipfile. That makes it much easier to apply. Also, the files you sent had DOS newlines instead of UNIX newlines.

It was a while ago when I did it and I’ve made a new repository since then so the history was gone.
Most of those files probably weren’t even modified, sorry about that.
The newlines, well that’s just how they are over here. :slight_smile:

OK, cool.
Included in the latest build.