Skip to content

Commit

Permalink
Fixed an issue causing a crash on device with no available audio output
Browse files Browse the repository at this point in the history
  • Loading branch information
Valkirie committed Apr 18, 2024
1 parent 7c721b0 commit 894c9a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions HandheldCompanion/UI/UISounds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ private static async void SoundTimer_Elapsed(object? sender, ElapsedEventArgs e)
{
using (WaveOutEvent waveOut = new WaveOutEvent())
{
if (waveOut.DeviceNumber == -1)
return;

waveOut.Init(waveReader);
waveOut.Play();

Expand Down
1 change: 1 addition & 0 deletions HandheldCompanion/Views/Pages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ private void SettingsManager_SettingValueChanged(string? name, object value)
Toggle_QuicktoolsAutoHide.IsOn = Convert.ToBoolean(value);
break;
case "UISounds":
Toggle_UISounds.IsEnabled = MultimediaManager.HasVolumeSupport();
Toggle_UISounds.IsOn = Convert.ToBoolean(value);
break;
}
Expand Down

0 comments on commit 894c9a0

Please sign in to comment.