diff options
Diffstat (limited to 'src/sound/cocoa_s.cpp')
-rw-r--r-- | src/sound/cocoa_s.cpp | 77 |
1 files changed, 19 insertions, 58 deletions
diff --git a/src/sound/cocoa_s.cpp b/src/sound/cocoa_s.cpp index 10fae12a6..cb1bc59e8 100644 --- a/src/sound/cocoa_s.cpp +++ b/src/sound/cocoa_s.cpp @@ -68,49 +68,22 @@ const char *SoundDriver_Cocoa::Start(const char * const *parm) MxInitialize((uint)requestedDesc.mSampleRate); -#if defined(__AUDIOCOMPONENT_H__) || defined(HAVE_OSX_107_SDK) - if (MacOSVersionIsAtLeast(10, 6, 0)) { - /* Locate the default output audio unit */ - AudioComponentDescription desc; - desc.componentType = kAudioUnitType_Output; - desc.componentSubType = kAudioUnitSubType_HALOutput; - desc.componentManufacturer = kAudioUnitManufacturer_Apple; - desc.componentFlags = 0; - desc.componentFlagsMask = 0; - - AudioComponent comp = AudioComponentFindNext (nullptr, &desc); - if (comp == nullptr) { - return "cocoa_s: Failed to start CoreAudio: AudioComponentFindNext returned nullptr"; - } - - /* Open & initialize the default output audio unit */ - if (AudioComponentInstanceNew(comp, &_outputAudioUnit) != noErr) { - return "cocoa_s: Failed to start CoreAudio: AudioComponentInstanceNew"; - } - } else -#endif - { -#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6) - /* Locate the default output audio unit */ - ComponentDescription desc; - desc.componentType = kAudioUnitType_Output; - desc.componentSubType = kAudioUnitSubType_HALOutput; - desc.componentManufacturer = kAudioUnitManufacturer_Apple; - desc.componentFlags = 0; - desc.componentFlagsMask = 0; - - Component comp = FindNextComponent (nullptr, &desc); - if (comp == nullptr) { - return "cocoa_s: Failed to start CoreAudio: FindNextComponent returned nullptr"; - } - - /* Open & initialize the default output audio unit */ - if (OpenAComponent(comp, &_outputAudioUnit) != noErr) { - return "cocoa_s: Failed to start CoreAudio: OpenAComponent"; - } -#else - return "cocoa_s: Not supported on this OS X version"; -#endif + /* Locate the default output audio unit */ + AudioComponentDescription desc; + desc.componentType = kAudioUnitType_Output; + desc.componentSubType = kAudioUnitSubType_HALOutput; + desc.componentManufacturer = kAudioUnitManufacturer_Apple; + desc.componentFlags = 0; + desc.componentFlagsMask = 0; + + AudioComponent comp = AudioComponentFindNext (nullptr, &desc); + if (comp == nullptr) { + return "cocoa_s: Failed to start CoreAudio: AudioComponentFindNext returned nullptr"; + } + + /* Open & initialize the default output audio unit */ + if (AudioComponentInstanceNew(comp, &_outputAudioUnit) != noErr) { + return "cocoa_s: Failed to start CoreAudio: AudioComponentInstanceNew"; } if (AudioUnitInitialize(_outputAudioUnit) != noErr) { @@ -157,21 +130,9 @@ void SoundDriver_Cocoa::Stop() return; } -#if defined(__AUDIOCOMPONENT_H__) || defined(HAVE_OSX_107_SDK) - if (MacOSVersionIsAtLeast(10, 6, 0)) { - if (AudioComponentInstanceDispose(_outputAudioUnit) != noErr) { - DEBUG(driver, 0, "cocoa_s: Core_CloseAudio: AudioComponentInstanceDispose failed"); - return; - } - } else -#endif - { -#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6) - if (CloseComponent(_outputAudioUnit) != noErr) { - DEBUG(driver, 0, "cocoa_s: Core_CloseAudio: CloseComponent failed"); - return; - } -#endif + if (AudioComponentInstanceDispose(_outputAudioUnit) != noErr) { + DEBUG(driver, 0, "cocoa_s: Core_CloseAudio: AudioComponentInstanceDispose failed"); + return; } } |