Mustanshir Soni Mustanshir Soni - 10 months ago 69
Android Question

Mute Left/Right Audio Effect using Superpowered sdk

I have integrated superpowered CrossExample successfully and now i need to apply mute right/left audio effect, and i have checked

SuperpoweredMixer.h , SuperpoweredSimple.h

these files but unable to find relevant methods to apply this effect,

so are there any other methods to do this thing ?

Answer Source

Just simply zero every even or odd sample, with some simple ramp when it turns on or off to prevent 'clicks'.

Superpowered doesn't really offer a function for such tiny task. You can do it with the SuperpoweredStereoMixer, but it may be too complex for this simple job.

Here is code snippet

bool Tempo::process(short int *output, unsigned int numberOfSamples) {
    bool silence = !playerA->process(stereoBuffer, false, numberOfSamples, volA);
    echo->process(stereoBuffer, stereoBuffer, numberOfSamples);
    reverb->process(stereoBuffer, stereoBuffer, numberOfSamples);

    float *mixerInputs[4] = {stereoBuffer, NULL, NULL, NULL};

    float *mixerOutputs[2] = {stereoBuffer, NULL};

    float mixerInputLevels[8] = {1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};

    float mixerOutputLevels[2] = {left, right};

    mixer->process(mixerInputs, mixerOutputs, mixerInputLevels, mixerOutputLevels, NULL, NULL,

    if (!silence) {
        SuperpoweredFloatToShortInt(mixerOutputs[0], output, numberOfSamples);
    return !silence;