aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/coreaudio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alc/backends/coreaudio.cpp')
-rw-r--r--alc/backends/coreaudio.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/alc/backends/coreaudio.cpp b/alc/backends/coreaudio.cpp
index 977bdc78..43c78063 100644
--- a/alc/backends/coreaudio.cpp
+++ b/alc/backends/coreaudio.cpp
@@ -123,6 +123,12 @@ void CoreAudioPlayback::open(const char *name)
if(err != noErr)
throw al::backend_exception{al::backend_error::NoDevice,
"Could not create component instance: %u", err};
+
+ err = AudioUnitInitialize(audioUnit);
+ if(err != noErr)
+ throw al::backend_exception{al::backend_error::DeviceError,
+ "Could not initialize audio unit: %u", err};
+
/* WARNING: I don't know if "valid" audio unit values are guaranteed to be
* non-0. If not, this logic is broken.
*/
@@ -133,12 +139,6 @@ void CoreAudioPlayback::open(const char *name)
}
mAudioUnit = audioUnit;
- /* init and start the default audio unit... */
- err = AudioUnitInitialize(mAudioUnit);
- if(err != noErr)
- throw al::backend_exception{al::backend_error::DeviceError,
- "Could not initialize audio unit: %u", err};
-
mDevice->DeviceName = name;
}