android - SuperpoweredAndroidAudioIO环回,只输出到左耳

标签 android c++ audio superpowered

在使用 Superpowered SDK 在 Android 中实现音频环回(从麦克风输入到标准输出)后,我发现只能通过耳机的一侧听到输出。

这就是我初始化 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
);

在 SLES/OpenSLES_AndroidConfiguration.h 中将 inputStreamType 或 outputStreamType 切换为其他选项无助于解决问题。

我的 liveAudioProcessing 回调函数如下所示:

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;
}

问题出现在clientdata为false和true时,与均衡器无关。

最佳答案

也许您的 Android 设备仅在左侧提供麦克风数据?如果回调中只有“return true”而没有其他内容,会发生什么情况?

关于android - SuperpoweredAndroidAudioIO环回,只输出到左耳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53021707/

相关文章:

C++17/C++1z 并行使用 std::for_each

c++ - MPI 通讯器管理

java - Android:使用 MediaRecorder 中的 getMaxAmplitude(),同时使用 TarsosDSP 中的 PercussionOnsetDetector

java - Android:摩托罗拉 MC40 设备无法识别用于调试应用程序

java - 无法使用 android :Theme. AppCompat.Light

android - 删除操作栏隐藏/取消隐藏时的闪烁

c++ - 计算间隔内值数量的更有效方法?

java - 如何用Java处理声音?

silverlight - 在Silverlight中反向播放mp3

android - CountDownTimer on version 4.4.2 - 4.4.4 无法取消