Skip to content

Commit

Permalink
Fixed "Missing device" error
Browse files Browse the repository at this point in the history
  • Loading branch information
ianespana committed Sep 23, 2020
1 parent 982b897 commit 1c99cd7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ShawzinBot/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,16 +349,18 @@ public void PlayPause()
{
PlayPauseIcon = "Pause";

var device = OutputDevice.GetById(0);

if (!PlayThroughSpeakers && playback.OutputDevice != null)
{
playback.OutputDevice.Dispose();
playback.OutputDevice = null;
}
else if (PlayThroughSpeakers && (playback.OutputDevice == null || playback.OutputDevice.ProductIdentifier != device.ProductIdentifier))
else if (PlayThroughSpeakers && (playback.OutputDevice == null))
{
playback.OutputDevice = device;
var list = OutputDevice.GetAll();
if (list.Count() >= 1)
{
playback.OutputDevice = list.FirstOrDefault();
}
}

ActionManager.OnSongPlay();
Expand Down

0 comments on commit 1c99cd7

Please sign in to comment.