Skip audio change if same audio device

Only perform an audio device change if the
audio device is a different one.
This commit is contained in:
Terry MacDonald 2020-12-07 21:11:51 +13:00
parent a7aa06f3e0
commit 41fc905e8c

View File

@ -447,8 +447,12 @@ namespace DisplayMagician
}
// record the old audio device
bool needToChangeAudio = false;
CoreAudioDevice rollbackAudioDevice = _audioController.DefaultPlaybackDevice;
double rollbackAudioVolume = _audioController.DefaultPlaybackDevice.Volume;
if (!rollbackAudioDevice.FullName.Equals(shortcutToUse.AudioDevice))
needToChangeAudio = true;
// Change Audio Device (if one specified)
if (shortcutToUse.ChangeAudioDevice)
@ -835,7 +839,7 @@ namespace DisplayMagician
}
// Change Audio Device back (if one specified)
if (shortcutToUse.ChangeAudioDevice)
if (needToChangeAudio)
{
// use the Audio Device
rollbackAudioDevice.SetAsDefault();