const double sampleRate,
void *refCon )
{
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
+ AudioComponentDescription desc;
+ AudioComponent comp;
+#else
ComponentDescription desc;
Component comp;
+#endif
/*An Apple TN suggests using CAStreamBasicDescription, but that is C++*/
AudioStreamBasicDescription desiredFormat;
OSStatus result = noErr;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
/* -- find the component -- */
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
+ comp = AudioComponentFindNext( NULL, &desc );
+#else
comp = FindNextComponent( NULL, &desc );
+#endif
if( !comp )
{
DBUG( ( "AUHAL component not found." ) );
return paUnanticipatedHostError;
}
/* -- open it -- */
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
+ result = AudioComponentInstanceNew( comp, audioUnit );
+#else
result = OpenAComponent( comp, audioUnit );
+#endif
if( result )
{
DBUG( ( "Failed to open AUHAL component." ) );
#undef ERR_WRAP
error:
+
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
+ AudioComponentInstanceDispose( *audioUnit );
+#else
CloseComponent( *audioUnit );
+#endif
*audioUnit = NULL;
if( result )
return PaMacCore_SetError( result, line, 1 );
}
if( stream->outputUnit && stream->outputUnit != stream->inputUnit ) {
AudioUnitUninitialize( stream->outputUnit );
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
+ AudioComponentInstanceDispose( stream->outputUnit );
+#else
CloseComponent( stream->outputUnit );
+#endif
}
stream->outputUnit = NULL;
if( stream->inputUnit )
{
AudioUnitUninitialize( stream->inputUnit );
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
+ AudioComponentInstanceDispose( stream->inputUnit );
+#else
CloseComponent( stream->inputUnit );
+#endif
stream->inputUnit = NULL;
}
if( stream->inputRingBuffer.buffer )