diff options
author | Matthew Gregan <[email protected]> | 2012-12-03 13:39:38 +1300 |
---|---|---|
committer | Matthew Gregan <[email protected]> | 2012-12-03 13:39:38 +1300 |
commit | f76c996cae249665c71e4a9272d219f121a75d9e (patch) | |
tree | 8881215589c47b009ba82c9a52384e4dcb82f22a /src | |
parent | aebe03df937eccda1d0a07300973678b9ea30a07 (diff) | |
download | cubeb-f76c996cae249665c71e4a9272d219f121a75d9e.tar.gz cubeb-f76c996cae249665c71e4a9272d219f121a75d9e.zip |
audiounit: fix build on 10.5.
Diffstat (limited to 'src')
-rw-r--r-- | src/cubeb_audiounit.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/cubeb_audiounit.c b/src/cubeb_audiounit.c index 4a5966c..168fb45 100644 --- a/src/cubeb_audiounit.c +++ b/src/cubeb_audiounit.c @@ -63,7 +63,7 @@ audio_unit_output_callback(void * user_ptr, AudioUnitRenderActionFlags * flags, return noErr; } - if (got < nframes) { + if ((UInt32) got < nframes) { size_t got_bytes = got * stm->sample_spec.mBytesPerFrame; size_t rem_bytes = (nframes - got) * stm->sample_spec.mBytesPerFrame; @@ -105,9 +105,14 @@ cubeb_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_n void * user_ptr) { AudioStreamBasicDescription ss; +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 + ComponentDescription desc; + Component comp; +#else AudioComponentDescription desc; - cubeb_stream * stm; AudioComponent comp; +#endif + cubeb_stream * stm; AURenderCallbackStruct input; unsigned int buffer_size; OSStatus r; @@ -161,7 +166,11 @@ cubeb_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_n desc.componentManufacturer = kAudioUnitManufacturer_Apple; desc.componentFlags = 0; desc.componentFlagsMask = 0; +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 + comp = FindNextComponent(NULL, &desc); +#else comp = AudioComponentFindNext(NULL, &desc); +#endif assert(comp); stm = calloc(1, sizeof(*stm)); @@ -179,7 +188,11 @@ cubeb_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_n stm->frames_played = 0; stm->frames_queued = 0; +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 + r = OpenAComponent(comp, &stm->unit); +#else r = AudioComponentInstanceNew(comp, &stm->unit); +#endif if (r != 0) { cubeb_stream_destroy(stm); return CUBEB_ERROR; @@ -228,7 +241,11 @@ cubeb_stream_destroy(cubeb_stream * stm) if (stm->unit) { AudioOutputUnitStop(stm->unit); AudioUnitUninitialize(stm->unit); +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 + CloseComponent(stm->unit); +#else AudioComponentInstanceDispose(stm->unit); +#endif } r = pthread_mutex_destroy(&stm->mutex); |