summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMarcelo Fernandez <marcelofg55@gmail.com>2017-07-19 11:05:51 -0300
committerMarcelo Fernandez <marcelofg55@gmail.com>2017-07-19 11:05:51 -0300
commitbbc207675f22343e7f9c2e8ccd7329e68a43fd85 (patch)
treec905eefba9d841dd0fca7554d4827ce0bc62bd9e /platform
parent45b498c4e056e313e06b169d64f991b32db30423 (diff)
Fix for possible crash in OS X audio init.
Diffstat (limited to 'platform')
-rw-r--r--platform/osx/audio_driver_osx.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/platform/osx/audio_driver_osx.cpp b/platform/osx/audio_driver_osx.cpp
index a4233b5264..dabc7989c0 100644
--- a/platform/osx/audio_driver_osx.cpp
+++ b/platform/osx/audio_driver_osx.cpp
@@ -60,13 +60,14 @@ Error AudioDriverOSX::initDevice() {
zeromem(&desc, sizeof(desc));
desc.componentType = kAudioUnitType_Output;
- desc.componentSubType = 0; /* !!! FIXME: ? */
- comp = AudioComponentFindNext(NULL, &desc);
+ desc.componentSubType = kAudioUnitSubType_HALOutput;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
+ comp = AudioComponentFindNext(NULL, &desc);
+ ERR_FAIL_COND_V(comp == NULL, FAILED);
+
result = AudioComponentInstanceNew(comp, &audio_unit);
ERR_FAIL_COND_V(result != noErr, FAILED);
- ERR_FAIL_COND_V(comp == NULL, FAILED);
result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_StreamFormat, scope, bus, &strdesc, sizeof(strdesc));
ERR_FAIL_COND_V(result != noErr, FAILED);