aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatthew Gregan <[email protected]>2012-12-03 13:39:38 +1300
committerMatthew Gregan <[email protected]>2012-12-03 13:39:38 +1300
commitf76c996cae249665c71e4a9272d219f121a75d9e (patch)
tree8881215589c47b009ba82c9a52384e4dcb82f22a
parentaebe03df937eccda1d0a07300973678b9ea30a07 (diff)
downloadcubeb-f76c996cae249665c71e4a9272d219f121a75d9e.tar.gz
cubeb-f76c996cae249665c71e4a9272d219f121a75d9e.zip
audiounit: fix build on 10.5.
-rw-r--r--configure.ac2
-rw-r--r--src/cubeb_audiounit.c21
2 files changed, 20 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 9b87570..5bd0695 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,7 +59,7 @@ elif test "x$ac_cv_header_alsa_asoundlib_h" = "xyes"; then
platform_lib="-lasound"
elif test "x$ac_cv_header_AudioUnit_AudioUnit_h" = "xyes"; then
platform_api="coreaudio"
- platform_lib="-framework AudioUnit"
+ platform_lib="-framework CoreServices -framework AudioUnit"
elif test "x$ac_cv_header_sndio_h" = "xyes"; then
platform_api="sndio"
platform_lib="-lsndio -lm"
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);