Browse Source

drivers/coreaudio: update audio components to use new API

tags/0.125.0
Josh de Kock 9 years ago
parent
commit
79478b79fa
2 changed files with 21 additions and 2 deletions
  1. +19
    -1
      drivers/coreaudio/coreaudio_driver.c
  2. +2
    -1
      drivers/coreaudio/coreaudio_driver.h

+ 19
- 1
drivers/coreaudio/coreaudio_driver.c View File

@@ -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);
}



+ 2
- 1
drivers/coreaudio/coreaudio_driver.h View File

@@ -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>



Loading…
Cancel
Save