Skip to content

Commit

Permalink
AudioController: audio reset when call flush
Browse files Browse the repository at this point in the history
  • Loading branch information
raymond1012 authored and raymondzheng committed Nov 6, 2017
1 parent a1ad9d4 commit e4bbe70
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,17 @@ - (void)flush
@synchronized(_lock) {
if (_isStopped)
return;

AudioQueueFlush(_audioQueueRef);
AudioQueueReset(_audioQueueRef);
for (int i = 0; i < kIJKAudioQueueNumberBuffers; i++)
{
if (_audioQueueBufferRefArray[i]) {
AudioQueueFreeBuffer(_audioQueueRef, _audioQueueBufferRefArray[i]);
}
AudioQueueAllocateBuffer(_audioQueueRef, _spec.size, &_audioQueueBufferRefArray[i]);
_audioQueueBufferRefArray[i]->mAudioDataByteSize = _spec.size;
memset(_audioQueueBufferRefArray[i]->mAudioData, 0, _spec.size);
AudioQueueEnqueueBuffer(_audioQueueRef, _audioQueueBufferRefArray[i], 0, NULL);
}
}
}

Expand Down

0 comments on commit e4bbe70

Please sign in to comment.