From 6f7f96a8b5d6571eb7960a924d722e0528e37a06 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Letz?= Date: Thu, 22 Nov 2012 13:25:25 +0100 Subject: [PATCH] Correct JackCoreAudioAdapter and JackCoreAudioDriver. --- macosx/coreaudio/JackCoreAudioAdapter.cpp | 41 +++++++++++++---------------- macosx/coreaudio/JackCoreAudioDriver.cpp | 43 ++++++++++++++----------------- 2 files changed, 37 insertions(+), 47 deletions(-) diff --git a/macosx/coreaudio/JackCoreAudioAdapter.cpp b/macosx/coreaudio/JackCoreAudioAdapter.cpp index ab255633..3cf08ad6 100644 --- a/macosx/coreaudio/JackCoreAudioAdapter.cpp +++ b/macosx/coreaudio/JackCoreAudioAdapter.cpp @@ -908,30 +908,25 @@ int JackCoreAudioAdapter::OpenAUHAL(bool capturing, } // AUHAL - 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; - } +#ifdef MAC_OS_X_VERSION_10_5 + 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; } +#else + 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; + } +#endif err1 = AudioUnitInitialize(fAUHAL); if (err1 != noErr) { diff --git a/macosx/coreaudio/JackCoreAudioDriver.cpp b/macosx/coreaudio/JackCoreAudioDriver.cpp index fefa7f20..790e63a2 100644 --- a/macosx/coreaudio/JackCoreAudioDriver.cpp +++ b/macosx/coreaudio/JackCoreAudioDriver.cpp @@ -1617,32 +1617,27 @@ int JackCoreAudioDriver::OpenAUHAL(bool capturing, jack_error("No input and output channels..."); return -1; } - - // AUHAL - 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; - } + // AUHAL +#ifdef MAC_OS_X_VERSION_10_5 + 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; + } +#else + 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; } +#endif err1 = AudioUnitInitialize(fAUHAL); if (err1 != noErr) { -- 2.11.4.GIT