summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-09-14 12:44:51 -0500
committerGitHub <noreply@github.com>2016-09-14 12:44:51 -0500
commitbd6a7118483fe92aa25589edda6f22a2e783b442 (patch)
tree0de9becc7b0f457b27e499d880b63fafd1e5591f
parent8f4a897dfbdc24195aad6c31e9714737210beeae (diff)
parentce438a41ffead7bb003a92d2beead81d6cf63c14 (diff)
downloadjack1-bd6a7118483fe92aa25589edda6f22a2e783b442.tar.gz
Merge pull request #42 from joshdekock/osx-audiounits-update
Update OS X CoreAudio AudioUnits API usage.
-rw-r--r--config/os/macosx/pThreadUtilities.h8
-rw-r--r--drivers/coreaudio/coreaudio_driver.c20
-rw-r--r--drivers/coreaudio/coreaudio_driver.h3
3 files changed, 28 insertions, 3 deletions
diff --git a/config/os/macosx/pThreadUtilities.h b/config/os/macosx/pThreadUtilities.h
index a8ed705..20cfe8a 100644
--- a/config/os/macosx/pThreadUtilities.h
+++ b/config/os/macosx/pThreadUtilities.h
@@ -66,7 +66,6 @@
#define __PTHREADUTILITIES_H__
#import "pthread.h"
-#import <CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h>
#define THREAD_SET_PRIORITY 0
#define THREAD_SCHEDULED_PRIORITY 1
@@ -75,6 +74,13 @@
#include <mach/thread_policy.h>
#include <mach/thread_act.h>
#include <CoreAudio/HostTime.h>
+#import <Availability.h>
+
+#if defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+#import <MacTypes.h>
+#else
+#import <CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h>
+#endif
static inline UInt32
_getThreadPriority (pthread_t inThread, int inWhichPriority)
diff --git a/drivers/coreaudio/coreaudio_driver.c b/drivers/coreaudio/coreaudio_driver.c
index 7f16304..72d875e 100644
--- a/drivers/coreaudio/coreaudio_driver.c
+++ b/drivers/coreaudio/coreaudio_driver.c
@@ -822,12 +822,22 @@ static jack_driver_t *coreaudio_driver_new (char* name,
}
// AUHAL
+#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+ AudioComponentDescription cd = { kAudioUnitType_Output, kAudioUnitSubType_HALOutput, kAudioUnitManufacturer_Apple, 0, 0 };
+ AudioComponent HALOutput = AudioComponentFindNext (NULL, &cd);
+ err1 = AudioComponentInstanceNew (HALOutput, &driver->au_hal);
+#else
ComponentDescription cd = { kAudioUnitType_Output, kAudioUnitSubType_HALOutput, kAudioUnitManufacturer_Apple, 0, 0 };
Component HALOutput = FindNextComponent (NULL, &cd);
-
err1 = OpenAComponent (HALOutput, &driver->au_hal);
+#endif
+
if (err1 != noErr) {
+#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+ jack_error ("Error calling AudioComponentInstanceNew");
+#else
jack_error ("Error calling OpenAComponent");
+#endif
printError (err1);
goto error;
}
@@ -1001,7 +1011,11 @@ static jack_driver_t *coreaudio_driver_new (char* name,
error:
AudioUnitUninitialize (driver->au_hal);
+#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+ AudioComponentInstanceDispose (driver->au_hal);
+#else
CloseComponent (driver->au_hal);
+#endif
jack_error ("Cannot open the coreaudio driver");
free (driver);
return NULL;
@@ -1014,7 +1028,11 @@ static void coreaudio_driver_delete (coreaudio_driver_t * driver)
AudioDeviceRemovePropertyListener (driver->device_id, 0, true, kAudioDeviceProcessorOverload, notification);
free (driver->input_list);
AudioUnitUninitialize (driver->au_hal);
+#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+ AudioComponentInstanceDispose (driver->au_hal);
+#else
CloseComponent (driver->au_hal);
+#endif
free (driver);
}
diff --git a/drivers/coreaudio/coreaudio_driver.h b/drivers/coreaudio/coreaudio_driver.h
index 211549e..d42598e 100644
--- a/drivers/coreaudio/coreaudio_driver.h
+++ b/drivers/coreaudio/coreaudio_driver.h
@@ -29,9 +29,10 @@
#define __jack_coreaudio_driver_h__
#include <CoreAudio/CoreAudio.h>
+#if !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
#include <AudioToolbox/AudioConverter.h>
+#endif
#include <AudioUnit/AudioUnit.h>
-
#include <jack/jack.h>
#include <jack/types.h>