0
我有一個基於音頻單元的Objective-C音頻應用程序,我的問題是當我播放聲音然後停止播放另一個聲音時,我聽到第一個聲音中的最後一個緩衝區。我想我應該只是釋放ioData或其他東西,但我所有的嘗試都失敗了。刪除從內存中播放的最後一個緩衝區
static OSStatus playbackCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData)
{
RemoteIOPlayer *remoteIOplayer = (__bridge RemoteIOPlayer *)inRefCon;
for (int i = 0 ; i < ioData->mNumberBuffers; i++)
{
AudioBuffer buffer = ioData->mBuffers[i];
UInt32 *frameBuffer = buffer.mData;
for (int j = 0; j < inNumberFrames; j++)
{
frameBuffer[j]= [[remoteIOplayer inMemoryAudioFile] getNextPacket:inBusNumber];
}
}
return noErr;
}
請幫忙:)謝謝。