mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2024-12-22 13:35:37 +00:00
Fix coreaudio module not detecting changes of the default audio device.
This commit is contained in:
parent
f904e2f149
commit
715dc6d199
|
@ -145,6 +145,12 @@ static void destroy_ca(struct SoundIoPrivate *si) {
|
|||
};
|
||||
AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &prop_address, on_devices_changed, si);
|
||||
|
||||
prop_address.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
|
||||
AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &prop_address, on_devices_changed, si);
|
||||
|
||||
prop_address.mSelector = kAudioHardwarePropertyDefaultInputDevice;
|
||||
AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &prop_address, on_devices_changed, si);
|
||||
|
||||
prop_address.mSelector = kAudioHardwarePropertyServiceRestarted;
|
||||
AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &prop_address, on_service_restarted, si);
|
||||
|
||||
|
@ -1446,6 +1452,22 @@ int soundio_coreaudio_init(struct SoundIoPrivate *si) {
|
|||
return SoundIoErrorSystemResources;
|
||||
}
|
||||
|
||||
prop_address.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
|
||||
if ((err = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &prop_address,
|
||||
on_devices_changed, si)))
|
||||
{
|
||||
destroy_ca(si);
|
||||
return SoundIoErrorSystemResources;
|
||||
}
|
||||
|
||||
prop_address.mSelector = kAudioHardwarePropertyDefaultInputDevice;
|
||||
if ((err = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &prop_address,
|
||||
on_devices_changed, si)))
|
||||
{
|
||||
destroy_ca(si);
|
||||
return SoundIoErrorSystemResources;
|
||||
}
|
||||
|
||||
prop_address.mSelector = kAudioHardwarePropertyServiceRestarted;
|
||||
if ((err = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &prop_address,
|
||||
on_service_restarted, si)))
|
||||
|
|
Loading…
Reference in a new issue