Replace usage of deprecated component manager APIs on 10.6+
These APIs are deprecated in 10.8+ and are disabled on 11.0(10.16)+ https://developer.apple.com/documentation/coreservices/carbon_core/component_manager?language=objc > "This application, or a library it uses, is using the deprecated Component Manager for hosting Audio Components. This is not supported when rebuilding against the 10.16 or later SDK. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h."
This commit is contained in:
parent
6a90e596b6
commit
b1a0902852
1 changed files with 26 additions and 0 deletions
|
|
@ -1173,8 +1173,13 @@ static PaError OpenAndSetupOneAudioUnit(
|
||||||
const double sampleRate,
|
const double sampleRate,
|
||||||
void *refCon )
|
void *refCon )
|
||||||
{
|
{
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
|
||||||
|
AudioComponentDescription desc;
|
||||||
|
AudioComponent comp;
|
||||||
|
#else
|
||||||
ComponentDescription desc;
|
ComponentDescription desc;
|
||||||
Component comp;
|
Component comp;
|
||||||
|
#endif
|
||||||
/*An Apple TN suggests using CAStreamBasicDescription, but that is C++*/
|
/*An Apple TN suggests using CAStreamBasicDescription, but that is C++*/
|
||||||
AudioStreamBasicDescription desiredFormat;
|
AudioStreamBasicDescription desiredFormat;
|
||||||
OSStatus result = noErr;
|
OSStatus result = noErr;
|
||||||
|
|
@ -1245,7 +1250,11 @@ static PaError OpenAndSetupOneAudioUnit(
|
||||||
desc.componentFlags = 0;
|
desc.componentFlags = 0;
|
||||||
desc.componentFlagsMask = 0;
|
desc.componentFlagsMask = 0;
|
||||||
/* -- find the component -- */
|
/* -- 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 );
|
comp = FindNextComponent( NULL, &desc );
|
||||||
|
#endif
|
||||||
if( !comp )
|
if( !comp )
|
||||||
{
|
{
|
||||||
DBUG( ( "AUHAL component not found." ) );
|
DBUG( ( "AUHAL component not found." ) );
|
||||||
|
|
@ -1254,7 +1263,11 @@ static PaError OpenAndSetupOneAudioUnit(
|
||||||
return paUnanticipatedHostError;
|
return paUnanticipatedHostError;
|
||||||
}
|
}
|
||||||
/* -- open it -- */
|
/* -- open it -- */
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
|
||||||
|
result = AudioComponentInstanceNew( comp, audioUnit );
|
||||||
|
#else
|
||||||
result = OpenAComponent( comp, audioUnit );
|
result = OpenAComponent( comp, audioUnit );
|
||||||
|
#endif
|
||||||
if( result )
|
if( result )
|
||||||
{
|
{
|
||||||
DBUG( ( "Failed to open AUHAL component." ) );
|
DBUG( ( "Failed to open AUHAL component." ) );
|
||||||
|
|
@ -1607,7 +1620,12 @@ static PaError OpenAndSetupOneAudioUnit(
|
||||||
#undef ERR_WRAP
|
#undef ERR_WRAP
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
|
||||||
|
AudioComponentInstanceDispose( *audioUnit );
|
||||||
|
#else
|
||||||
CloseComponent( *audioUnit );
|
CloseComponent( *audioUnit );
|
||||||
|
#endif
|
||||||
*audioUnit = NULL;
|
*audioUnit = NULL;
|
||||||
if( result )
|
if( result )
|
||||||
return PaMacCore_SetError( result, line, 1 );
|
return PaMacCore_SetError( result, line, 1 );
|
||||||
|
|
@ -2645,13 +2663,21 @@ static PaError CloseStream( PaStream* s )
|
||||||
}
|
}
|
||||||
if( stream->outputUnit && stream->outputUnit != stream->inputUnit ) {
|
if( stream->outputUnit && stream->outputUnit != stream->inputUnit ) {
|
||||||
AudioUnitUninitialize( stream->outputUnit );
|
AudioUnitUninitialize( stream->outputUnit );
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
|
||||||
|
AudioComponentInstanceDispose( stream->outputUnit );
|
||||||
|
#else
|
||||||
CloseComponent( stream->outputUnit );
|
CloseComponent( stream->outputUnit );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
stream->outputUnit = NULL;
|
stream->outputUnit = NULL;
|
||||||
if( stream->inputUnit )
|
if( stream->inputUnit )
|
||||||
{
|
{
|
||||||
AudioUnitUninitialize( 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 );
|
CloseComponent( stream->inputUnit );
|
||||||
|
#endif
|
||||||
stream->inputUnit = NULL;
|
stream->inputUnit = NULL;
|
||||||
}
|
}
|
||||||
if( stream->inputRingBuffer.buffer )
|
if( stream->inputRingBuffer.buffer )
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue