From 97450e451fe535bccec1651b9960dd0f446736f3 Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Wed, 6 Jun 2018 17:10:58 +0200 Subject: fixed some async stuff --- DiscoBot/Audio/Voice.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'DiscoBot/Audio/Voice.cs') diff --git a/DiscoBot/Audio/Voice.cs b/DiscoBot/Audio/Voice.cs index 84a221c..2c8f75e 100644 --- a/DiscoBot/Audio/Voice.cs +++ b/DiscoBot/Audio/Voice.cs @@ -18,7 +18,7 @@ { public static IAudioClient Client { get; set; } - public static void SendAsync(string path, int volume = 256) + public static void Send(string path, int volume = 256) { if (Client == null) { @@ -26,7 +26,7 @@ } // Create FFmpeg using the previous example - var ffmpeg = CreateStream(path, volume); + var ffmpeg = CreateStream(path, volume); var output = ffmpeg.StandardOutput.BaseStream; var barInvoker = new BackgroundWorker(); barInvoker.DoWork += delegate @@ -36,7 +36,7 @@ discord.FlushAsync(); }; - + barInvoker.RunWorkerAsync(); } @@ -66,10 +66,9 @@ if (Client != null) { - var wait = SoundEffects.Play(Sound.Nooo); + SoundEffects.Play(Sound.Nooo); await Client.StopAsync(); Client = null; - wait.Wait(); } } @@ -103,7 +102,7 @@ if (sc.Compare(path, tSound.ToString()) > SpellCorrect.ErrorThreshold) { - await Task.Run(() => Voice.SendAsync(path)); + await Task.Run(() => Voice.Send(path)); } await Task.Run(() => SoundEffects.Play(tSound)); -- cgit v1.2.3-70-g09d2