Core Audio output: Add a quick safety fix

Add a safety fix for pausing and shutting down, so that we don't call
into AUAudioUnit's stopHardware function unless the stream has already
been started by the output.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
CQTexperiment
Christopher Snowhill 2022-01-26 15:42:28 -08:00
parent ee7b7dad5f
commit bbce6880d7
1 changed files with 5 additions and 2 deletions

View File

@ -755,7 +755,8 @@ default_device_changed(AudioObjectID inObjectID, UInt32 inNumberAddresses, const
listenerapplied = NO;
}
if (_au) {
[_au stopHardware];
if (started)
[_au stopHardware];
_au = nil;
}
if (running)
@ -791,7 +792,8 @@ default_device_changed(AudioObjectID inObjectID, UInt32 inNumberAddresses, const
- (void)pause
{
paused = YES;
[_au stopHardware];
if (started)
[_au stopHardware];
}
- (void)resume
@ -799,6 +801,7 @@ default_device_changed(AudioObjectID inObjectID, UInt32 inNumberAddresses, const
NSError *err;
[_au startHardwareAndReturnError:&err];
paused = NO;
started = YES;
}
- (void)sustainHDCD