diff options
author | TrueDoctor <d-kobert@web.de> | 2018-06-15 10:07:53 +0200 |
---|---|---|
committer | TrueDoctor <d-kobert@web.de> | 2018-06-15 10:07:53 +0200 |
commit | 2bfbc16288454790f4c4cfa8ecace3518ee30059 (patch) | |
tree | a9ee7d86ee5f53c352e25092b08245e8d25fb042 /DiscoBot | |
parent | 585f6f3bc93e47c6943b4e523b50f2a930314514 (diff) |
did Sound stuff
Diffstat (limited to 'DiscoBot')
-rw-r--r-- | DiscoBot/Audio/Sound.cs | 9 | ||||
-rw-r--r-- | DiscoBot/Audio/Soundeffects.cs | 14 | ||||
-rw-r--r-- | DiscoBot/Audio/Voice.cs | 10 |
3 files changed, 21 insertions, 12 deletions
diff --git a/DiscoBot/Audio/Sound.cs b/DiscoBot/Audio/Sound.cs index 174c076..a9a2768 100644 --- a/DiscoBot/Audio/Sound.cs +++ b/DiscoBot/Audio/Sound.cs @@ -8,14 +8,17 @@ namespace DiscoBot.Audio { public class Sound { - public Sound(string name, string url) + public Sound(string name, string url, int volume) { - Name = name; - Url = url; + this.Name = name; + this.Url = url; + this.Volume = volume; } public string Name { get; } public string Url { get; } + + public int Volume { get; } } } diff --git a/DiscoBot/Audio/Soundeffects.cs b/DiscoBot/Audio/Soundeffects.cs index 317d0ff..d3e7cbb 100644 --- a/DiscoBot/Audio/Soundeffects.cs +++ b/DiscoBot/Audio/Soundeffects.cs @@ -1,9 +1,12 @@ namespace DiscoBot.Audio { using System; + using System.Linq; using System.Threading.Tasks; + using DiscoBot.Auxiliary; using DiscoBot.Commands; + using DiscoBot.DSA_Game; /*public enum Sound { @@ -27,7 +30,7 @@ { string url = string.Empty; int volume = 255; - switch (s) + /*switch (s) { case "Bell": case "Ding": @@ -59,6 +62,15 @@ url = "https://www.myinstants.com/media/sounds/wrong-answer-sound-effect.mp3"; volume = 50; break; + }*/ + + var tSound = Dsa.Properties.Sounds.OrderBy(x => SpellCorrect.CompareEasy(s, x.Name)).First(); + + url = s; + + if (SpellCorrect.CompareEasy(s, tSound.Name) > SpellCorrect.ErrorThreshold) + { + url = tSound.Url; } volume = (int)(volume * (Volume / 100.0)); diff --git a/DiscoBot/Audio/Voice.cs b/DiscoBot/Audio/Voice.cs index 5417560..daebed7 100644 --- a/DiscoBot/Audio/Voice.cs +++ b/DiscoBot/Audio/Voice.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using DiscoBot.Auxiliary; + using DiscoBot.DSA_Game; using Discord; using Discord.Audio; @@ -98,14 +99,7 @@ var sc = new SpellCorrect(); - var tSound = soundList.OrderBy(x => sc.Compare(path, x.ToString())).First(); - - if (sc.Compare(path, tSound.ToString()) > SpellCorrect.ErrorThreshold) - { - await Task.Run(() => Voice.Send(path)); - } - - await Task.Run(() => SoundEffects.Play(path)); + } private static Process CreateStream(string path, int vol = 256) |