我正在尝试混合 SuperpoweredAdvancedAudioPlayers 并写入 wav 文件。我打电话recorder->start(path)
and recorder->stop()
,但没有任何东西写入磁盘。我的清单中有正确的存储权限。我用谷歌搜索了其他人的代码并想出了这个:
我的过程:
bool SuperpoweredExample::process(short int *output, unsigned int numberOfSamples) {
double masterBpm = players[0]->currentBpm;
double msElapsedSinceLastBeat = players[0]->msElapsedSinceLastBeat;
uint16_t i;
bool silence = true;
for (i=rs=0; i<NUMPLAYERS; i++) {
if (players[i]->process(stereoBuffer, !silence, numberOfSamples, volume[i] * 0.25, masterBpm, msElapsedSinceLastBeat))
silence = false;
}
if (!silence) {
recorder->process(stereoBuffer, 0, buffersize);
}
if (!silence) {
SuperpoweredFloatToShortInt(stereoBuffer, output, numberOfSamples);
}
return !silence;
}
初始化:
recorder = new SuperpoweredRecorder(tempPath, samplerate, 1);
audioSystem = new SuperpoweredAndroidAudioIO(samplerate, buffersize, false, true, audioProcessing, this, -1, SL_ANDROID_STREAM_MEDIA, buffersize * 2);
有任何想法吗?