Core Audio output: Properly apply or remove default device change listener when switching preferences between the 'System Default Device' setting and manually setting the device to the current default
parent
8435416cd7
commit
8e895c88c0
|
@ -127,9 +127,6 @@ default_device_changed(AudioObjectID inObjectID, UInt32 inNumberAddresses, const
|
|||
}
|
||||
|
||||
if (audioQueue) {
|
||||
if (outputDeviceID == deviceID)
|
||||
return noErr;
|
||||
|
||||
AudioObjectPropertyAddress defaultDeviceAddress = theAddress;
|
||||
|
||||
if (listenerapplied && !defaultDevice) {
|
||||
|
@ -137,6 +134,7 @@ default_device_changed(AudioObjectID inObjectID, UInt32 inNumberAddresses, const
|
|||
listenerapplied = NO;
|
||||
}
|
||||
|
||||
if (outputDeviceID != deviceID) {
|
||||
printf("DEVICE: %i\n", deviceID);
|
||||
outputDeviceID = deviceID;
|
||||
|
||||
|
@ -162,6 +160,7 @@ default_device_changed(AudioObjectID inObjectID, UInt32 inNumberAddresses, const
|
|||
CFRelease(theDeviceUID);
|
||||
if (running)
|
||||
[self start];
|
||||
}
|
||||
|
||||
if (!listenerapplied && defaultDevice) {
|
||||
AudioObjectAddPropertyListener(kAudioObjectSystemObject, &defaultDeviceAddress, default_device_changed, (__bridge void * _Nullable)(self));
|
||||
|
|
Loading…
Reference in New Issue