1

After implementing audio loopback (from the microphone input to standard output) in Android using the Superpowered SDK I found that the output was only heard through one side of the headset.

This is how I initialised the SuperpoweredAndroidAudioIO:

    audioIO = new SuperpoweredAndroidAudioIO (
        samplerate,                     // sampling rate
        buffersize,                     // buffer size
        true,                           // enableInput
        true,                           // enableOutput
        liveAudioProcessing,            // process callback function
        process,                        // clientData
        -1   ,                          // inputStreamType (-1 = default)
        -1,                             // outputStreamType (-1 = default)
        buffersize * 2                  // latencySamples
);

Switching the inputStreamType or outputStreamType to other options in SLES/OpenSLES_AndroidConfiguration.h did not help to resolve the issue.

My liveAudioProcessing callback function looks like this:

static bool liveAudioProcessing (
        void * clientdata,          // custom pointer to processing bool
        short int *audio,           // buffer of interleaved samples
        int numberOfFrames,         // number of frames to process
        int __unused samplerate     // sampling rate
) {
    SuperpoweredShortIntToFloat(audio, floatBuffer, (unsigned int)numberOfFrames);
    if (*(bool *) clientdata and eq != nullptr) {
        eq->process(floatBuffer, floatBuffer, (unsigned int) numberOfFrames);
    }
    SuperpoweredFloatToShortInt(floatBuffer, audio, (unsigned int)numberOfFrames);
    return true;
}

The problem occurs when both clientdata is false and true, it has thus nothing to do with the equalizer.

Ali Khaki
  • 1,184
  • 1
  • 13
  • 24
Devin
  • 11
  • 1

1 Answers1

0

Maybe your Android device provides microphone data on the left side only? What happens if only a "return true" is inside the callback and nothing else?

Gabor Szanto
  • 1,329
  • 8
  • 12
  • I am sorry for my late reply, it turned out to be a problem with the device itself (Huawei Mate 10 Lite) and does luckily not occur on other devices. Thank you for your response though! – Devin Dec 12 '18 at 13:10