2012-03-10 54 views
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; 
} 

请帮忙:)谢谢。

回答

0

好吧,它只是关于在使用者停止后对augraph进行初始化并重新初始化