Ticket #54125: patch-src__hostapi__coreaudio__pa_mac_core.c

File patch-src__hostapi__coreaudio__pa_mac_core.c, 3.1 KB (added by RJVB (René Bertin), 8 years ago)
Line 
1diff --git src/hostapi/coreaudio/pa_mac_core.c src/hostapi/coreaudio/pa_mac_core.c
2index 257e9dedc3f66248b1108537d63bae7128c5e87f..2f778acef72fc7d5a25318d04aecb6939616ece1 100644
3--- src/hostapi/coreaudio/pa_mac_core.c
4+++ src/hostapi/coreaudio/pa_mac_core.c
5@@ -1173,8 +1173,8 @@ static PaError OpenAndSetupOneAudioUnit(
6                                    const double sampleRate,
7                                    void *refCon )
8 {
9-    ComponentDescription desc;
10-    Component comp;
11+    AudioComponentDescription desc;
12+    AudioComponent comp;
13     /*An Apple TN suggests using CAStreamBasicDescription, but that is C++*/
14     AudioStreamBasicDescription desiredFormat;
15     OSStatus result = noErr;
16@@ -1245,7 +1245,7 @@ static PaError OpenAndSetupOneAudioUnit(
17     desc.componentFlags        = 0;
18     desc.componentFlagsMask    = 0;
19     /* -- find the component -- */
20-    comp = FindNextComponent( NULL, &desc );
21+    comp = AudioComponentFindNext( NULL, &desc );
22     if( !comp )
23     {
24        DBUG( ( "AUHAL component not found." ) );
25@@ -1254,7 +1254,7 @@ static PaError OpenAndSetupOneAudioUnit(
26        return paUnanticipatedHostError;
27     }
28     /* -- open it -- */
29-    result = OpenAComponent( comp, audioUnit );
30+    result = AudioComponentInstanceNew( comp, audioUnit );
31     if( result )
32     {
33        DBUG( ( "Failed to open AUHAL component." ) );
34@@ -1607,7 +1607,7 @@ static PaError OpenAndSetupOneAudioUnit(
35 #undef ERR_WRAP
36 
37     error:
38-       CloseComponent( *audioUnit );
39+       AudioComponentInstanceDispose( *audioUnit );
40        *audioUnit = NULL;
41        if( result )
42           return PaMacCore_SetError( result, line, 1 );
43@@ -2645,13 +2645,13 @@ static PaError CloseStream( PaStream* s )
44        }
45        if( stream->outputUnit && stream->outputUnit != stream->inputUnit ) {
46           AudioUnitUninitialize( stream->outputUnit );
47-          CloseComponent( stream->outputUnit );
48+          AudioComponentInstanceDispose( stream->outputUnit );
49        }
50        stream->outputUnit = NULL;
51        if( stream->inputUnit )
52        {
53           AudioUnitUninitialize( stream->inputUnit );
54-          CloseComponent( stream->inputUnit );
55+          AudioComponentInstanceDispose( stream->inputUnit );
56           stream->inputUnit = NULL;
57        }
58        if( stream->inputRingBuffer.buffer )
59@@ -2711,12 +2711,12 @@ static PaError StartStream( PaStream *s )
60 
61 // it's not clear from appl's docs that this really waits
62 // until all data is flushed.
63-static ComponentResult BlockWhileAudioUnitIsRunning( AudioUnit audioUnit, AudioUnitElement element )
64+static OSStatus BlockWhileAudioUnitIsRunning( AudioUnit audioUnit, AudioUnitElement element )
65 {
66     Boolean isRunning = 1;
67     while( isRunning ) {
68        UInt32 s = sizeof( isRunning );
69-       ComponentResult err = AudioUnitGetProperty( audioUnit, kAudioOutputUnitProperty_IsRunning, kAudioUnitScope_Global, element,  &isRunning, &s );
70+       OSStatus err = AudioUnitGetProperty( audioUnit, kAudioOutputUnitProperty_IsRunning, kAudioUnitScope_Global, element,  &isRunning, &s );
71        if( err )
72           return err;
73        Pa_Sleep( 100 );