diff options
Diffstat (limited to 'DiscoBot/Audio')
-rw-r--r-- | DiscoBot/Audio/Soundeffects.cs | 20 | ||||
-rw-r--r-- | DiscoBot/Audio/Voice.cs | 4 |
2 files changed, 15 insertions, 9 deletions
diff --git a/DiscoBot/Audio/Soundeffects.cs b/DiscoBot/Audio/Soundeffects.cs index f0d5a9f..f3a014c 100644 --- a/DiscoBot/Audio/Soundeffects.cs +++ b/DiscoBot/Audio/Soundeffects.cs @@ -24,13 +24,18 @@ public static class SoundEffects { - public static int Volume { get; set; } = 50; + public static int MaxVolume { get; set; } = 50; public static void Play(string s) { string url = string.Empty; int volume = 255; - /*switch (s) + + var tSound = DSA_Game.Save.Properties.Sounds.OrderBy(x => SpellCorrect.CompareEasy(s, x.Name)).First(); + + url = s; + + switch (s) { case "Bell": case "Ding": @@ -62,18 +67,17 @@ url = "https://www.myinstants.com/media/sounds/wrong-answer-sound-effect.mp3"; volume = 50; break; - }*/ - - var tSound = DSA_Game.Save.Properties.Sounds.OrderBy(x => SpellCorrect.CompareEasy(s, x.Name)).First(); + } - url = s; + - if (SpellCorrect.CompareEasy(s, tSound.Name) > SpellCorrect.ErrorThreshold) + if (SpellCorrect.CompareEasy(s, tSound.Name) < SpellCorrect.ErrorThreshold) { url = tSound.Url; + volume = tSound.Volume; } - volume = (int)(volume * (Volume / 100.0)); + volume = (int)(volume * (MaxVolume / 100.0)); if (url != string.Empty) diff --git a/DiscoBot/Audio/Voice.cs b/DiscoBot/Audio/Voice.cs index 24512d2..379f65b 100644 --- a/DiscoBot/Audio/Voice.cs +++ b/DiscoBot/Audio/Voice.cs @@ -78,7 +78,7 @@ { if (volume <= 100 && volume >= 0) { - SoundEffects.Volume = volume; + SoundEffects.MaxVolume = volume; } } @@ -90,6 +90,8 @@ await this.Context.Channel.SendMessageAsync("Erst Joinen!"); } + SoundEffects.Play(path); + var sounds = Enum.GetValues(typeof(Sound)); var soundList = new List<Sound>(); foreach (var sound in sounds) |