Initialize the new audio unit before disposing the old one
This commit is contained in:
parent
1d57db6836
commit
e6c7cdc1ba
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user