mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-19 23:29:05 +00:00
Eliminate AudioQueueBufferMaxLength
.
This commit is contained in:
parent
75f3f1a77f
commit
dcb68c16fe
@ -10,8 +10,6 @@
|
|||||||
@import AudioToolbox;
|
@import AudioToolbox;
|
||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
|
|
||||||
#define AudioQueueBufferMaxLength 8192
|
|
||||||
|
|
||||||
#define OSSGuard(x) { \
|
#define OSSGuard(x) { \
|
||||||
const OSStatus status = x; \
|
const OSStatus status = x; \
|
||||||
assert(!status); \
|
assert(!status); \
|
||||||
@ -45,9 +43,11 @@
|
|||||||
|
|
||||||
_samplingRate = samplingRate;
|
_samplingRate = samplingRate;
|
||||||
|
|
||||||
// Determine preferred buffer size as being the first power of two less than
|
// Determine preferred buffer size as being the first power of two
|
||||||
_preferredBufferSize = AudioQueueBufferMaxLength;
|
// not less than 1/100th of a second.
|
||||||
while((Float64)_preferredBufferSize*100.0 > samplingRate) _preferredBufferSize >>= 1;
|
_preferredBufferSize = 1;
|
||||||
|
const NSUInteger oneHundredthOfRate = (NSUInteger)(samplingRate / 100.0);
|
||||||
|
while(_preferredBufferSize < oneHundredthOfRate) _preferredBufferSize <<= 1;
|
||||||
|
|
||||||
// Describe a 16bit stream of the requested sampling rate.
|
// Describe a 16bit stream of the requested sampling rate.
|
||||||
AudioStreamBasicDescription outputDescription;
|
AudioStreamBasicDescription outputDescription;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user