Upgrade AudioUnit API usage.

weird that such a simple change doesn't seem to have any obvious
documentation on Apple's website or elsewhere...
This commit is contained in:
comex 2014-11-25 00:42:21 -05:00
parent 759ea3bce7
commit b36b55cfcb
1 changed files with 5 additions and 5 deletions

View File

@ -32,22 +32,22 @@ bool CoreAudioSound::Start()
OSStatus err; OSStatus err;
AURenderCallbackStruct callback_struct; AURenderCallbackStruct callback_struct;
AudioStreamBasicDescription format; AudioStreamBasicDescription format;
ComponentDescription desc; AudioComponentDescription desc;
Component component; AudioComponent component;
desc.componentType = kAudioUnitType_Output; desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_DefaultOutput; desc.componentSubType = kAudioUnitSubType_DefaultOutput;
desc.componentFlags = 0; desc.componentFlags = 0;
desc.componentFlagsMask = 0; desc.componentFlagsMask = 0;
desc.componentManufacturer = kAudioUnitManufacturer_Apple; desc.componentManufacturer = kAudioUnitManufacturer_Apple;
component = FindNextComponent(nullptr, &desc); component = AudioComponentFindNext(nullptr, &desc);
if (component == nullptr) if (component == nullptr)
{ {
ERROR_LOG(AUDIO, "error finding audio component"); ERROR_LOG(AUDIO, "error finding audio component");
return false; return false;
} }
err = OpenAComponent(component, &audioUnit); err = AudioComponentInstanceNew(component, &audioUnit);
if (err != noErr) if (err != noErr)
{ {
ERROR_LOG(AUDIO, "error opening audio component"); ERROR_LOG(AUDIO, "error opening audio component");
@ -131,7 +131,7 @@ void CoreAudioSound::Stop()
if (err != noErr) if (err != noErr)
ERROR_LOG(AUDIO, "error uninitializing audiounit"); ERROR_LOG(AUDIO, "error uninitializing audiounit");
err = CloseComponent(audioUnit); err = AudioComponentInstanceDispose(audioUnit);
if (err != noErr) if (err != noErr)
ERROR_LOG(AUDIO, "error closing audio component"); ERROR_LOG(AUDIO, "error closing audio component");
} }