mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-05 21:32:55 +00:00
Don't use kAudioQueueProperty_IsRunning
as it seems not to be trustworthy.
This commit is contained in:
parent
79f8cab5e2
commit
4c031bd335
@ -16,7 +16,7 @@
|
|||||||
(void)status; \
|
(void)status; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define IsDry(x) (x) < 3
|
#define IsDry(x) (x) < 2
|
||||||
|
|
||||||
@implementation CSAudioQueue {
|
@implementation CSAudioQueue {
|
||||||
AudioQueueRef _audioQueue;
|
AudioQueueRef _audioQueue;
|
||||||
@ -84,6 +84,9 @@
|
|||||||
[queue->_queueLock unlock];
|
[queue->_queueLock unlock];
|
||||||
|
|
||||||
const int buffers = atomic_fetch_add(&queue->_enqueuedBuffers, -1) - 1;
|
const int buffers = atomic_fetch_add(&queue->_enqueuedBuffers, -1) - 1;
|
||||||
|
if(!buffers) {
|
||||||
|
OSSGuard(AudioQueuePause(queue->_audioQueue));
|
||||||
|
}
|
||||||
|
|
||||||
id<CSAudioQueueDelegate> delegate = queue.delegate;
|
id<CSAudioQueueDelegate> delegate = queue.delegate;
|
||||||
[queue->_deallocLock unlock];
|
[queue->_deallocLock unlock];
|
||||||
@ -135,9 +138,7 @@
|
|||||||
OSSGuard(AudioQueueEnqueueBuffer(_audioQueue, newBuffer, 0, NULL));
|
OSSGuard(AudioQueueEnqueueBuffer(_audioQueue, newBuffer, 0, NULL));
|
||||||
|
|
||||||
// Start the queue if it isn't started yet, and there are now some packets waiting.
|
// Start the queue if it isn't started yet, and there are now some packets waiting.
|
||||||
UInt32 isRunning = 0, bytesReceived = sizeof(UInt32);
|
if(enqueuedBuffers > 1) {
|
||||||
OSSGuard(AudioQueueGetProperty(_audioQueue, kAudioQueueProperty_IsRunning, &isRunning, &bytesReceived));
|
|
||||||
if(!isRunning && enqueuedBuffers > 2) {
|
|
||||||
OSSGuard(AudioQueueStart(_audioQueue, NULL));
|
OSSGuard(AudioQueueStart(_audioQueue, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user