Yesterday, I talked about volume in general, today I want to drill into volume more detail.
In Vista, for any given audio stream, there are actually 4 different volume controls.
- Stream Volume
- Simple Volume
- Channel Volume
- Endpoint Volume
Each of these is a gain stage, so each of them is applied linearly to the input audio samples to create the final output audio stream.
I’m going to steal my “big picture” from my “Audio in Vista, the Big Picture” post from last year:
Each of the WASAPI instances in this picture represents an audio stream, the streams are combined together in a mixer and streamed to the audio driver. The Stream, Simple, and Channel volumes are implemented with a single volume APO inserted on the individual audio streams, the endpoint volume is implemented either with a volume APO inserted post mix or with a hardware volume control depending on the capabilities of the users audio solution.
So how do these various volumes interrelate?
First off, the stream volume. The stream volume is a multi-channel volume control that is applied to each audio stream. It’s intended for use by applications that want to do really simple 3d effects (using the multichannel per-stream volume to simulate position information when bouncing an animated ball across the screen, for example). It also can be used if your application wants to let the system handle managing volume control for individual audio streams, but the scenarios for this are relatively rare.
Next, the channel volume. The channel volume is a per-session volume and is applied to all the streams in a session (if you remember from the “big picture” post, a session is a container for audio streams). The channel volume exists for one reason only: the waveOutSetVolume API – since the wave volume is a multichannel (ok, it’s only stereo) volume, we needed to have an analog in WASAPI. Again, the scenarios for using this volume are relatively rare – changing the channel volume is typically done as a system setup task (room correction) from the control panel (so it affects all applications, not just one application).
Then there’s the “simple” volume. The simple volue is a per-session volume and is applied to all the streams in a session. The simple volume is a uniform volume control – it applies to all channels equally. This is the volume control that we expect most applications to use – it provides a very simple mechanism to control an applications volume and mute state, which should be sufficient for the vast majority of applications out there. It’s also the volume that is shown in the per-application volume slider in the Vista sound mixer.
Logically you can consider these three volumes as being applied in series (it’s not really true, they’re all applied at the same time) to create the final volume for each audio stream.
Finally, there’s the endpoint volume. As I’ve mentioned before, the endpoint volume represents the “master volume” for outputs. It is applied to the post-mix audio stream, and functions as the master volume for the particular endpoint.
Next: Some subtleties in Vista’s volume control.