diff --git a/NadekoBot/Classes/Music/MusicControls.cs b/NadekoBot/Classes/Music/MusicControls.cs index f6a48136..db28a2bf 100644 --- a/NadekoBot/Classes/Music/MusicControls.cs +++ b/NadekoBot/Classes/Music/MusicControls.cs @@ -26,16 +26,13 @@ namespace NadekoBot.Classes.Music { public MusicControls() { Task.Run(async () => { while (!Stopped) { - lock (_voiceLock) { - if (CurrentSong == null) { - if (SongQueue.Count > 0) - LoadNextSong().Wait(); - - } else if (CurrentSong.State == StreamState.Completed || NextSong) { - NextSong = false; - LoadNextSong().Wait(); - } + if (CurrentSong == null) { + if (SongQueue.Count > 0) + await LoadNextSong(); + } else if (CurrentSong.State == StreamState.Completed || NextSong) { + NextSong = false; + await LoadNextSong(); } await Task.Delay(1000); } @@ -71,18 +68,16 @@ namespace NadekoBot.Classes.Music { } internal void Stop() { - lock (_voiceLock) { - Stopped = true; - foreach (var kvp in SongQueue) { - if (kvp != null) - kvp.Stop(); - } - SongQueue.Clear(); - CurrentSong?.Stop(); - CurrentSong = null; - VoiceClient?.Disconnect(); - VoiceClient = null; + Stopped = true; + foreach (var kvp in SongQueue) { + if (kvp != null) + kvp.Stop(); } + SongQueue.Clear(); + CurrentSong?.Stop(); + CurrentSong = null; + VoiceClient?.Disconnect(); + VoiceClient = null; } internal bool TogglePause() => IsPaused = !IsPaused;