在使用 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/