diff --git a/configure b/configure index 124b7cdbdcb..89bfefab10c 100755 --- a/configure +++ b/configure @@ -5764,6 +5764,7 @@ for ac_header in \ ApplicationServices/ApplicationServices.h \ AudioToolbox/AudioConverter.h \ AudioUnit/AudioUnit.h \ + AudioUnit/AudioComponent.h \ CL/cl.h \ Carbon/Carbon.h \ CoreAudio/CoreAudio.h \ @@ -6526,8 +6527,14 @@ fi fi if test "$ac_cv_header_CoreAudio_CoreAudio_h" = "yes" -a "$ac_cv_header_AudioUnit_AudioUnit_h" = "yes" then - COREAUDIO="-framework CoreAudio -framework AudioUnit -framework CoreServices -framework AudioToolbox -framework CoreMIDI" + if test "$ac_cv_header_AudioUnit_AudioComponent_h" = "yes" + then + COREAUDIO="-framework CoreFoundation -framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreMIDI" + else + COREAUDIO="-framework CoreAudio -framework AudioUnit -framework CoreServices -framework AudioToolbox -framework CoreMIDI" + + fi fi if test "$ac_cv_header_OpenAL_al_h" = "yes" then diff --git a/configure.ac b/configure.ac index eb7b4a1b2b9..c0a9d7fe5c0 100644 --- a/configure.ac +++ b/configure.ac @@ -371,6 +371,7 @@ AC_CHECK_HEADERS(\ ApplicationServices/ApplicationServices.h \ AudioToolbox/AudioConverter.h \ AudioUnit/AudioUnit.h \ + AudioUnit/AudioComponent.h \ CL/cl.h \ Carbon/Carbon.h \ CoreAudio/CoreAudio.h \ @@ -711,8 +712,13 @@ case $host_os in fi if test "$ac_cv_header_CoreAudio_CoreAudio_h" = "yes" -a "$ac_cv_header_AudioUnit_AudioUnit_h" = "yes" then - dnl CoreServices needed by AudioUnit - AC_SUBST(COREAUDIO,"-framework CoreAudio -framework AudioUnit -framework CoreServices -framework AudioToolbox -framework CoreMIDI") + if test "$ac_cv_header_AudioUnit_AudioComponent_h" = "yes" + then + AC_SUBST(COREAUDIO,"-framework CoreFoundation -framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreMIDI") + else + dnl CoreServices needed by AudioUnit + AC_SUBST(COREAUDIO,"-framework CoreAudio -framework AudioUnit -framework CoreServices -framework AudioToolbox -framework CoreMIDI") + fi fi if test "$ac_cv_header_OpenAL_al_h" = "yes" then diff --git a/dlls/winecoreaudio.drv/audiounit.c b/dlls/winecoreaudio.drv/audiounit.c index bef882b346c..5191669e9a1 100644 --- a/dlls/winecoreaudio.drv/audiounit.c +++ b/dlls/winecoreaudio.drv/audiounit.c @@ -24,7 +24,9 @@ #define ULONG CoreFoundation_ULONG #define HRESULT CoreFoundation_HRESULT +#ifndef HAVE_AUDIOUNIT_AUDIOCOMPONENT_H #include +#endif #include #include #undef ULONG @@ -35,6 +37,28 @@ #include "coreaudio.h" #include "wine/debug.h" +#ifndef HAVE_AUDIOUNIT_AUDIOCOMPONENT_H +/* Define new AudioComponent Manager functions for compatibility's sake */ +typedef Component AudioComponent; +typedef ComponentDescription AudioComponentDescription; +typedef ComponentInstance AudioComponentInstance; + +static inline AudioComponent AudioComponentFindNext(AudioComponent ac, AudioComponentDescription *desc) +{ + return FindNextComponent(ac, desc); +} + +static inline OSStatus AudioComponentInstanceNew(AudioComponent ac, AudioComponentInstance *aci) +{ + return OpenAComponent(ac, aci); +} + +static inline OSStatus AudioComponentInstanceDispose(AudioComponentInstance aci) +{ + return CloseComponent(aci); +} +#endif + WINE_DEFAULT_DEBUG_CHANNEL(wave); WINE_DECLARE_DEBUG_CHANNEL(midi); @@ -68,8 +92,8 @@ extern OSStatus CoreAudio_wiAudioUnitIOProc(void *inRefCon, int AudioUnit_CreateDefaultAudioUnit(void *wwo, AudioUnit *au) { OSStatus err; - Component comp; - ComponentDescription desc; + AudioComponent comp; + AudioComponentDescription desc; AURenderCallbackStruct callbackStruct; TRACE("\n"); @@ -80,11 +104,11 @@ int AudioUnit_CreateDefaultAudioUnit(void *wwo, AudioUnit *au) desc.componentFlags = 0; desc.componentFlagsMask = 0; - comp = FindNextComponent(NULL, &desc); + comp = AudioComponentFindNext(NULL, &desc); if (comp == NULL) return 0; - err = OpenAComponent(comp, au); + err = AudioComponentInstanceNew(comp, au); if (err != noErr || *au == NULL) return 0; @@ -102,7 +126,7 @@ int AudioUnit_CreateDefaultAudioUnit(void *wwo, AudioUnit *au) int AudioUnit_CloseAudioUnit(AudioUnit au) { - OSStatus err = CloseComponent(au); + OSStatus err = AudioComponentInstanceDispose(au); return (err == noErr); } @@ -198,8 +222,8 @@ int AudioUnit_CreateInputUnit(void* wwi, AudioUnit* out_au, UInt32* outFrameCount) { OSStatus err = noErr; - ComponentDescription description; - Component component; + AudioComponentDescription description; + AudioComponent component; AudioUnit au; UInt32 param; AURenderCallbackStruct callback; @@ -220,17 +244,17 @@ int AudioUnit_CreateInputUnit(void* wwi, AudioUnit* out_au, description.componentFlags = 0; description.componentFlagsMask = 0; - component = FindNextComponent(NULL, &description); + component = AudioComponentFindNext(NULL, &description); if (!component) { - ERR("FindNextComponent(kAudioUnitSubType_HALOutput) failed\n"); + ERR("AudioComponentFindNext(kAudioUnitSubType_HALOutput) failed\n"); return 0; } - err = OpenAComponent(component, &au); + err = AudioComponentInstanceNew(component, &au); if (err != noErr || au == NULL) { - ERR("OpenAComponent failed: %08lx\n", err); + ERR("AudioComponentInstanceNew failed: %08lx\n", err); return 0; } @@ -343,7 +367,7 @@ int AudioUnit_CreateInputUnit(void* wwi, AudioUnit* out_au, error: if (au) - CloseComponent(au); + AudioComponentInstanceDispose(au); return 0; } @@ -353,7 +377,7 @@ error: int SynthUnit_CreateDefaultSynthUnit(AUGraph *graph, AudioUnit *synth) { OSStatus err; - ComponentDescription desc; + AudioComponentDescription desc; AUNode synthNode; AUNode outNode; diff --git a/include/config.h.in b/include/config.h.in index dab00b2901d..5cae81b1384 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -40,6 +40,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_AUDIOTOOLBOX_AUDIOCONVERTER_H +/* Define to 1 if you have the header file. */ +#undef HAVE_AUDIOUNIT_AUDIOCOMPONENT_H + /* Define to 1 if you have the header file. */ #undef HAVE_AUDIOUNIT_AUDIOUNIT_H