mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Have withdrawn attempt to be clever with client notification here, as it was having no effect in the current environment, making it hard to build up any confidence.
This commit is contained in:
parent
b12f2f2796
commit
7c33c34b0c
@ -14,22 +14,13 @@
|
||||
@implementation CSAudioQueue
|
||||
{
|
||||
AudioQueueRef _audioQueue;
|
||||
size_t _queuedSamples;
|
||||
BOOL _hasHad256;
|
||||
}
|
||||
|
||||
#pragma mark - AudioQueue callbacks
|
||||
|
||||
- (void)audioQueue:(AudioQueueRef)theAudioQueue didCallbackWithBuffer:(AudioQueueBufferRef)buffer
|
||||
{
|
||||
size_t samplesInBuffer = (size_t)(buffer->mAudioDataByteSize / sizeof(int16_t));
|
||||
if(_queuedSamples >= 128 && _queuedSamples - samplesInBuffer < 128 && _hasHad256)
|
||||
{
|
||||
_hasHad256 = NO;
|
||||
[self.delegate audioQueueIsRunningDry:self];
|
||||
}
|
||||
_queuedSamples -= samplesInBuffer;
|
||||
|
||||
[self.delegate audioQueueIsRunningDry:self];
|
||||
AudioQueueFreeBuffer(_audioQueue, buffer);
|
||||
}
|
||||
|
||||
@ -106,8 +97,6 @@ static void audioOutputCallback(
|
||||
{
|
||||
AudioQueueBufferRef newBuffer;
|
||||
size_t bufferBytes = lengthInSamples * sizeof(int16_t);
|
||||
_queuedSamples += lengthInSamples;
|
||||
_hasHad256 |= (_queuedSamples >= 256);
|
||||
|
||||
AudioQueueAllocateBuffer(_audioQueue, (UInt32)bufferBytes, &newBuffer);
|
||||
memcpy(newBuffer->mAudioData, buffer, bufferBytes);
|
||||
|
Loading…
Reference in New Issue
Block a user