From 7920fe9d110f8b21f2b20143eb334494dc29b59e Mon Sep 17 00:00:00 2001 From: Stephane Letz Date: Tue, 21 Aug 2012 11:00:24 +0200 Subject: [PATCH] Update JackCoreAudioDriver and JackCoreAudioAdapter with more recent API. --- macosx/coreaudio/JackCoreAudioAdapter.cpp | 31 +++++++++++++++++++++++-------- macosx/coreaudio/JackCoreAudioDriver.cpp | 31 +++++++++++++++++++++++-------- 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/macosx/coreaudio/JackCoreAudioAdapter.cpp b/macosx/coreaudio/JackCoreAudioAdapter.cpp index e485888a..ab255633 100644 --- a/macosx/coreaudio/JackCoreAudioAdapter.cpp +++ b/macosx/coreaudio/JackCoreAudioAdapter.cpp @@ -908,16 +908,31 @@ int JackCoreAudioAdapter::OpenAUHAL(bool capturing, } // AUHAL - ComponentDescription cd = {kAudioUnitType_Output, kAudioUnitSubType_HALOutput, kAudioUnitManufacturer_Apple, 0, 0}; - Component HALOutput = FindNextComponent(NULL, &cd); + SInt32 major; + SInt32 minor; + Gestalt(gestaltSystemVersionMajor, &major); + Gestalt(gestaltSystemVersionMinor, &minor); - err1 = OpenAComponent(HALOutput, &fAUHAL); - if (err1 != noErr) { - jack_error("Error calling OpenAComponent"); - printError(err1); - goto error; + if (major == 10 && minor >= 6) { + AudioComponentDescription cd = {kAudioUnitType_Output, kAudioUnitSubType_HALOutput, kAudioUnitManufacturer_Apple, 0, 0}; + AudioComponent HALOutput = AudioComponentFindNext(NULL, &cd); + err1 = AudioComponentInstanceNew(HALOutput, &fAUHAL); + if (err1 != noErr) { + jack_error("Error calling AudioComponentInstanceNew"); + printError(err1); + goto error; + } + } else { + ComponentDescription cd = {kAudioUnitType_Output, kAudioUnitSubType_HALOutput, kAudioUnitManufacturer_Apple, 0, 0}; + Component HALOutput = FindNextComponent(NULL, &cd); + err1 = OpenAComponent(HALOutput, &fAUHAL); + if (err1 != noErr) { + jack_error("Error calling OpenAComponent"); + printError(err1); + goto error; + } } - + err1 = AudioUnitInitialize(fAUHAL); if (err1 != noErr) { jack_error("Cannot initialize AUHAL unit"); diff --git a/macosx/coreaudio/JackCoreAudioDriver.cpp b/macosx/coreaudio/JackCoreAudioDriver.cpp index 4c2a3f2b..840ad947 100644 --- a/macosx/coreaudio/JackCoreAudioDriver.cpp +++ b/macosx/coreaudio/JackCoreAudioDriver.cpp @@ -1616,14 +1616,29 @@ int JackCoreAudioDriver::OpenAUHAL(bool capturing, } // AUHAL - ComponentDescription cd = {kAudioUnitType_Output, kAudioUnitSubType_HALOutput, kAudioUnitManufacturer_Apple, 0, 0}; - Component HALOutput = FindNextComponent(NULL, &cd); - - err1 = OpenAComponent(HALOutput, &fAUHAL); - if (err1 != noErr) { - jack_error("Error calling OpenAComponent"); - printError(err1); - goto error; + SInt32 major; + SInt32 minor; + Gestalt(gestaltSystemVersionMajor, &major); + Gestalt(gestaltSystemVersionMinor, &minor); + + if (major == 10 && minor >= 6) { + AudioComponentDescription cd = {kAudioUnitType_Output, kAudioUnitSubType_HALOutput, kAudioUnitManufacturer_Apple, 0, 0}; + AudioComponent HALOutput = AudioComponentFindNext(NULL, &cd); + err1 = AudioComponentInstanceNew(HALOutput, &fAUHAL); + if (err1 != noErr) { + jack_error("Error calling AudioComponentInstanceNew"); + printError(err1); + goto error; + } + } else { + ComponentDescription cd = {kAudioUnitType_Output, kAudioUnitSubType_HALOutput, kAudioUnitManufacturer_Apple, 0, 0}; + Component HALOutput = FindNextComponent(NULL, &cd); + err1 = OpenAComponent(HALOutput, &fAUHAL); + if (err1 != noErr) { + jack_error("Error calling OpenAComponent"); + printError(err1); + goto error; + } } err1 = AudioUnitInitialize(fAUHAL); -- 2.11.4.GIT