[xiph-cvs] cvs commit: ao/src/plugins/macosx ao_macosx.c

Ralph Giles giles at xiph.org
Tue Jun 24 05:15:00 PDT 2003



giles       03/06/24 08:15:00

  Modified:    src/plugins/macosx ao_macosx.c
  Log:
  Apply patch from Ben Hines. The macosx device now works!

Revision  Changes    Path
1.5       +10 -5     ao/src/plugins/macosx/ao_macosx.c

Index: ao_macosx.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/macosx/ao_macosx.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ao_macosx.c	25 Oct 2001 09:44:01 -0000	1.4
+++ ao_macosx.c	24 Jun 2003 12:15:00 -0000	1.5
@@ -190,6 +190,11 @@
     }
 
     propertySize = sizeof(internal->outputBufferByteCount);
+    
+    internal->outputBufferByteCount = 8192;
+    status = AudioDeviceSetProperty(internal->outputDeviceID, 0, 0, false, kAudioDevicePropertyBufferSize,
+        propertySize, &internal->outputBufferByteCount);
+        
     status = AudioDeviceGetProperty(internal->outputDeviceID, 0, false, kAudioDevicePropertyBufferSize, &propertySize, &internal->outputBufferByteCount);
     if (status) {
         fprintf(stderr, "ao_macosx_open: AudioDeviceGetProperty returned %d when getting kAudioDevicePropertyBufferSize\n", (int)status);
@@ -200,7 +205,7 @@
 
     // It appears that AudioDeviceGetProperty lies about this property in DP4
     // Set the actual value
-    internal->outputBufferByteCount = 32768;
+    //internal->outputBufferByteCount = 32768;
 
     // Set the IO proc that CoreAudio will call when it needs data, but don't start
     // the stream yet.
@@ -383,10 +388,10 @@
     // Find the first valid frame and the number of valid frames
     pthread_mutex_lock(&internal->mutex);
 
-    bytesToCopy = internal->outputBufferByteCount;
+    bytesToCopy = internal->outputBufferByteCount/2;
     validByteCount = internal->validByteCount;
-    outBuffer = (float *)outOutputData;
-
+    outBuffer = (float *)outOutputData->mBuffers[0].mData;
+    
     if (validByteCount < bytesToCopy && !internal->isStopping) {
         // Not enough data ... let it build up a bit more before we start copying stuff over.
         // If we are stopping, of course, we should just copy whatever we have.
@@ -424,8 +429,8 @@
         sample++;
     }
     
-    pthread_cond_signal(&internal->condition);
     pthread_mutex_unlock(&internal->mutex);
+    pthread_cond_signal(&internal->condition);
     
     return 0;
 }

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list