diff options
author | TrueDoctor <d-kobert@web.de> | 2018-06-06 17:10:58 +0200 |
---|---|---|
committer | TrueDoctor <d-kobert@web.de> | 2018-06-06 17:10:58 +0200 |
commit | 97450e451fe535bccec1651b9960dd0f446736f3 (patch) | |
tree | ea7f71994687c505505c5c7070f659b9be15d529 /DiscoBot/Audio/Voice.cs | |
parent | 7f55f6f289b5ab5b7fd4ac42b472b51a9a0e679e (diff) |
fixed some async stuff
Diffstat (limited to 'DiscoBot/Audio/Voice.cs')
-rw-r--r-- | DiscoBot/Audio/Voice.cs | 11 |
1 files changed, 5 insertions, 6 deletions
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)); |