Search code examples
superpowered

SuperpoweredMixer Meter Values


I have a 2-part question. An incomplete version of my audioProcessing callback is below to provide context.

1) For SuperpoweredStereoMixer->process, the documentation states that the "inputMeters" and "outputMeters" parameters "Returns the maximum values for metering." and that the SuperpoweredPeak function "Returns the peak value." Are the Peak function and the mixer's meter values the same thing? I assume so, I just want to confirm.

2) When I increase or decrease the input volumes in the self->inputLevelsA, I can see the meter values returned in self->outputMeters increase/decrease as expected. However, I'm not seeing the values increase/decrease in self->inputMetersA. In fact when I decrease the volumes in inputLevelsA to 0.0f I do not see the input meter values decrease at all. Is SuperpoweredStereoMixer->process returning the input meter values before the input volume levels are applied to the signal or after?

Thanks!

static bool audioProcessing(void *clientdata, float **inputBuffers, unsigned int inputChannels, float **outputBuffers, unsigned int outputChannels, unsigned int numberOfSamples, unsigned int samplerate, uint64_t hostTime) {
    __unsafe_unretained SuperpoweredFrequencies *self = (__bridge SuperpoweredFrequencies *)clientdata;
  hasAudio1 = self->player1->process(self->musicInterleavedBuffer1, false, numberOfSamples, 1.0f);
    hasAudio2 = self->player2->process(self->musicInterleavedBuffer2, false, numberOfSamples, 1.0f);

    SuperpoweredInterleave(inputBuffers[0], inputBuffers[1], self->microphoneInterleavedBuffer, numberOfSamples);
self->inputsA[0] = self->musicInterleavedBuffer1; 
    self->inputsA[1] = self->musicInterleavedBuffer2; 
    self->inputsA[2] = self->microphoneInterleavedBuffer;
    self->inputsA[3] = NULL;
    self->outputsA[0] = self->outputInterleavedBufferA;
    self->outputsA[1] = NULL;
    self->stereoMixerA->process(self->inputsA, self->outputsA, self->inputLevelsA, self->outputLevelsA, self->inputMetersA, self->outputMeters, numberOfSamples);


SuperpoweredDeInterleave(self->outputsA[0], outputBuffers[0], outputBuffers[1], numberOfSamples);
hasAudio = hasAudio1 || hasAudio2 || micHasAudio;
    return hasAudio;
}

Solution

  • 1) Yes, SuperpoweredPeak returns with the same value. 2) Yes, the inputMeters will measure the loudness before mixing. Outputmeters measure the output's loudness.