]> Repos - portaudio/commitdiff
added and removed dummy property listener as this may be required by OS X 10.6. Also...
authorbjornroche <bjornroche@0f58301d-fd10-0410-b4af-bbb618454e57>
Wed, 2 Dec 2009 17:48:05 +0000 (17:48 +0000)
committerbjornroche <bjornroche@0f58301d-fd10-0410-b4af-bbb618454e57>
Wed, 2 Dec 2009 17:48:05 +0000 (17:48 +0000)
src/hostapi/coreaudio/pa_mac_core_utilities.c

index b1059a60e3b7d583ea6b1cf5ac9c70c412936f0c..b58b82202281f2541a8ce9176eb3964ee2a6af73 100644 (file)
@@ -363,14 +363,14 @@ PaError AudioDeviceSetPropertyNowAndWaitForChange(
    /* Ideally, we'd use a condition variable to determine changes.
       we could set that up here. */
 
-   /* If we were using a cond variable, we'd add a property listener here.
-      No more notes on that, but don't forget to remove the listener as well! */
-   //macErr = AudioDeviceAddPropertyListener( inDevice, inChannel, isInput,
-   //                                inPropertyID, propertyProc,
-   //                                NULL ); 
-   //if( macErr )
-   //   /* we couldn't add a listener. */
-   //   goto failMac;
+   /* If we were using a cond variable, we'd do something useful here,
+      but for now, this is just to make 10.6 happy. */
+   macErr = AudioDeviceAddPropertyListener( inDevice, inChannel, isInput,
+                                   inPropertyID, propertyProc,
+                                   NULL ); 
+   if( macErr )
+      /* we couldn't add a listener. */
+      goto failMac;
 
    /* set property */
    macErr  = AudioDeviceSetProperty( inDevice, NULL, inChannel,
@@ -397,6 +397,7 @@ PaError AudioDeviceSetPropertyNowAndWaitForChange(
       }
       /* and compare... */
       if( 0==memcmp( outPropertyData, inPropertyData, outPropertyDataSize ) ) {
+         AudioDeviceRemovePropertyListener( inDevice, inChannel, isInput, inPropertyID, propertyProc );
          return paNoError;
       }
       /* No match yet, so let's sleep and try again. */
@@ -405,9 +406,11 @@ PaError AudioDeviceSetPropertyNowAndWaitForChange(
    }
    DBUG( ("Timeout waiting for device setting.\n" ) );
    
-   return paUnanticipatedHostError;
+   AudioDeviceRemovePropertyListener( inDevice, inChannel, isInput, inPropertyID, propertyProc );
+   return paNoError;
 
  failMac:
+   AudioDeviceRemovePropertyListener( inDevice, inChannel, isInput, inPropertyID, propertyProc );
    return ERR( macErr );
 }