[Scummvm-devel] Audio volume control (proposed mixer/imuse/... changes)

Jamieson Christian jamiesonc at tds.net
Sun Nov 28 11:17:03 CET 2004

Max Horn wrote:

> My idea is to unify and simplify this. Here's what I suggest:
> * we add a AudioDataType enum to the mixer; with audio types "none", 
> "sfx", "speech", "music" (possibly more in the future)
> * we add a method (or methods) to the mixer to set the volumes for 
> each of the times
> * when starting playback via the mixer, or when setting a premix hook, 
> you can specify the audio type this is
> * the data is then volume-scaled based on the volume set for that type
> * type "none" is not volume scaled at all, which still allows engines 
> to do their own volume effects if needed
> * note: these are the "base" volumes; of course the ability to change 
> the volume/balance of each sound directly will be retained!
> * we need to discuss whether we want to / need to retain the global 
> "master" volume. If we keep it, it should effect *everything*; setting 
> it to 0 would effectively mute all sound.
> As a consequence, we could simplify the audio options in SCUMM, get 
> rid of the extra volume processing in IMuseDigitial, hopefully 
> simplify the code in some of the other backends too, and overall end 
> up with a more transparent yet more powerful SoundMixer.

Sounds like a step in the right direction. As you're designing this, 
recall too that the "music" volume affect event-based (e.g. MIDI) music 
engines as well, not just the digital audio music engines. If you want 
to centralize volume scaling for those, it will have to be done in the 
MidiDriver, since that is the only common denominator amongst our 
event-based music engines (despite my overly-zealous attempts to get 
everything routed through the iMuse infrastructure for improved state 
management). You will also want to give consideration to those 
situations where an event-based music engine also becomes the feed for 
the digital audio stream, e.g. Adlib or YM2612. In THOSE cases, you want 
the volume scaling to affect EITHER the event-based engine OR the 
digital audio stream, but not both.

Jamieson Christian
SF.net: Jamieson630

More information about the Scummvm-devel mailing list