[xiph-commits] r17714 - trunk/ao/src/plugins/macosx

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Fri Dec 3 14:41:50 PST 2010


Author: xiphmont
Date: 2010-12-03 14:41:50 -0800 (Fri, 03 Dec 2010)
New Revision: 17714

Modified:
   trunk/ao/src/plugins/macosx/Makefile.am
   trunk/ao/src/plugins/macosx/ao_macosx.c
Log:
Run AUHAL in its own default mainloop so that hardware status events
are processed (and playback doesn't block indefinitely waiting for
them to be processed).  Fixes Trac #1724, #1725, #1731



Modified: trunk/ao/src/plugins/macosx/Makefile.am
===================================================================
--- trunk/ao/src/plugins/macosx/Makefile.am	2010-12-03 17:12:39 UTC (rev 17713)
+++ trunk/ao/src/plugins/macosx/Makefile.am	2010-12-03 22:41:50 UTC (rev 17714)
@@ -19,7 +19,7 @@
 libdir = $(plugindir)
 lib_LTLIBRARIES = $(macosxltlibs)
 
-libmacosx_la_LDFLAGS = @PLUGIN_LDFLAGS@ -framework AudioUnit
+libmacosx_la_LDFLAGS = @PLUGIN_LDFLAGS@ -framework AudioUnit -framework CoreAudio -framework CoreServices
 libmacosx_la_SOURCES = $(macosxsources)
 
 EXTRA_DIST = ao_macosx.c

Modified: trunk/ao/src/plugins/macosx/ao_macosx.c
===================================================================
--- trunk/ao/src/plugins/macosx/ao_macosx.c	2010-12-03 17:12:39 UTC (rev 17713)
+++ trunk/ao/src/plugins/macosx/ao_macosx.c	2010-12-03 22:41:50 UTC (rev 17714)
@@ -33,6 +33,7 @@
    audio samples rather than having them pushed at it (which is nice
    when you are wanting to do good buffering of audio).  */
 
+#include <CoreAudio/CoreAudio.h>
 #include <CoreServices/CoreServices.h>
 #include <AudioUnit/AudioUnit.h>
 #include <AudioUnit/AUComponent.h>
@@ -202,6 +203,16 @@
   device->internal = internal;
   device->output_matrix_order = AO_OUTPUT_MATRIX_COLLAPSIBLE;
   device->output_matrix = strdup("L,R,C,LFE,BL,BR,CL,CR,BC,SL,SR");
+
+  CFRunLoopRef theRunLoop = NULL;
+  AudioObjectPropertyAddress theAddress = {
+    kAudioHardwarePropertyRunLoop,
+    kAudioObjectPropertyScopeGlobal,
+    kAudioObjectPropertyElementMaster
+  };
+  AudioObjectSetPropertyData(kAudioObjectSystemObject, &theAddress, 0,
+                             NULL, sizeof(CFRunLoopRef), &theRunLoop);
+
   return 1; /* Memory alloc successful */
 }
 



More information about the commits mailing list