summaryrefslogtreecommitdiff
path: root/src/sound
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2020-04-10 23:48:32 +0200
committerMichael Lutz <michi@icosahedron.de>2020-04-12 18:44:43 +0200
commitb17ea3de361a14c9adaabbd576c15cce0cfe5809 (patch)
tree32fc78b504af7f021af9959b12c082627efaba6d /src/sound
parent9dd8b3d430cc4d5f385b97e03e02fbc9865d069c (diff)
downloadopenttd-b17ea3de361a14c9adaabbd576c15cce0cfe5809.tar.xz
Remove: [OSX] Support for the pre-10.5 audio/music APIs.
Diffstat (limited to 'src/sound')
-rw-r--r--src/sound/cocoa_s.cpp77
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;
}
}