Is there a way to get left/right speaker volume after specializing the sound?

Say the listener is to the left of a sound source, the right speaker should have a higher volume than left.

I tired get metering info, but perhaps because the sound source is a mono file it only has one channel for the rms reading. Out of the 32 channels, only the first channel has reading.

I also tried using getMixMatrix but couldn’t seem to get it working. If this is the right path, is there an example I can refer to?

NVM I was targeting the wrong DSP, got it working through getMeterInfo. Still curious how getMixMatrix works though.

The mix matrix is a 2D array of floats used by ChannelControl and DSPConnection to map input channels (columns) to output channels (rows) - it isn’t related to metering.

By default, the mix matrix should be an identity/unit matrix that maps a given input channel only to its corresponding output channel:

// Quadraphonic -> Quadraphonic Identity Matrix
               Inputs
             ___________
             FL FR RL RR
        | FL 1  0  0  0
        | FR 0  1  0  0
Outputs | RL 0  0  1  0
        | RR 0  0  0  1

but you can use it to arbitrarily route any combination of input channels to any output channel. For example, you could use it to:

  • Remove the right channel from a stereo signal
// Stereo -> Stereo Mix Matrix
  L R
L 1 0
R 0 0
  • Route all 6 channels of a 5.1 signal solely to the Centre channel
// 6.1 -> 6.1 mix matrix
    FL FR C LFE SL SR
FL  0  0  0  0  0  0
FR  0  0  0  0  0  0
C   1  1  1  1  1  1
LFE 0  0  0  0  0  0
SL  0  0  0  0  0  0
SR  0  0  0  0  0  0

and so on. You can attenuate the signal of a given mapping by specifying a value between 0 and 1, amplify it with a value above 1, and/or additionally invert the signal by using a value below 0. Mix matrices also allow you to downmix from a lower amount of input channels to a higher amount of output channels, or upmix with the inverse opposite.

I’d recommend reading the ChannelControl::getMixMatrix and ChannelControl::setMixMatrix documentation for more information.

2 Likes