我想我错误地传递SuperpoweredAndroidAudioIO
了SuperpoweredRecorder
'process()
方法。
我的流程回调如下所示:
bool SuperpoweredExample::process(short int *audioIO, unsigned int numberOfSamples) {
if (recording) {
recordProcess(audioIO, numberOfSamples);
}
return true;
记录过程:
void SuperpoweredExample::recordProcess(short *input, unsigned int numberOfSamples) {
SuperpoweredShortIntToFloat(input, stereoBuffer, numberOfSamples);
__android_log_print(ANDROID_LOG_VERBOSE, "SuperpoweredExample", "%i",
recorder->process(stereoBuffer, NULL, numberOfSamples));
}
SuperpoweredRecorder
'process()
总是返回 0,所以它还没有开始记录。我认为这是因为我没有正确地将输入传递给它。
更多相关代码:
stereoBuffer = (float *) memalign(16, (buffersize + 16) * sizeof(float) * 2);
audioSystem = new SuperpoweredAndroidAudioIO(samplerate, buffersize, true, true,
audioProcessing, this, -1, SL_ANDROID_STREAM_MEDIA,
buffersize * 2);
我的记录():
void SuperpoweredExample::onRecord(bool record) {
if (!record) {
recording = false;
recorder->stop();
} else {
recording = true;
__android_log_print(ANDROID_LOG_VERBOSE, "SuperpoweredExample", "%s", tempPath.c_str());
recorder->start((tempPath + "_TEMP").c_str());
};
}
如何SuperpoweredRecorder
创建文件?
我尝试创建另一个缓冲区仅用于录制,但我遇到了同样的问题。我应该使用createWav()
吗?它说仅将其用于离线处理。