mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-25 18:30:21 +00:00
Cemented new meaningof the audio queue delegate callout.
This commit is contained in:
parent
988bbb5ab1
commit
f6b6ec7009
@ -11,8 +11,7 @@
|
|||||||
@class CSAudioQueue;
|
@class CSAudioQueue;
|
||||||
|
|
||||||
@protocol CSAudioQueueDelegate
|
@protocol CSAudioQueueDelegate
|
||||||
- (void)audioQueueDidCompleteBuffer:(nonnull CSAudioQueue *)audioQueue; // TODO: rename this to audioQueueNeedsData or something, to indicate that
|
- (void)audioQueueIsRunningDry:(nonnull CSAudioQueue *)audioQueue;
|
||||||
// it means something more along the lines of 'may run out soon'
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -21,8 +21,10 @@
|
|||||||
|
|
||||||
- (void)audioQueue:(AudioQueueRef)theAudioQueue didCallbackWithBuffer:(AudioQueueBufferRef)buffer
|
- (void)audioQueue:(AudioQueueRef)theAudioQueue didCallbackWithBuffer:(AudioQueueBufferRef)buffer
|
||||||
{
|
{
|
||||||
_queuedSamples -= (size_t)(buffer->mAudioDataByteSize / sizeof(int16_t));
|
size_t samplesInBuffer = (size_t)(buffer->mAudioDataByteSize / sizeof(int16_t));
|
||||||
if(_queuedSamples < 128) [self.delegate audioQueueDidCompleteBuffer:self];
|
if(_queuedSamples >= 128 && _queuedSamples - samplesInBuffer < 128) [self.delegate audioQueueIsRunningDry:self];
|
||||||
|
_queuedSamples -= samplesInBuffer;
|
||||||
|
|
||||||
AudioQueueFreeBuffer(_audioQueue, buffer);
|
AudioQueueFreeBuffer(_audioQueue, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ class MachineDocument:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK: CSAudioQueueDelegate
|
// MARK: CSAudioQueueDelegate
|
||||||
final func audioQueueDidCompleteBuffer(_ audioQueue: CSAudioQueue) {
|
final func audioQueueIsRunningDry(_ audioQueue: CSAudioQueue) {
|
||||||
bestEffortUpdater.update()
|
bestEffortUpdater.update()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user