summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrueDoctor <d-kobert@web.de>2018-06-15 10:07:53 +0200
committerTrueDoctor <d-kobert@web.de>2018-06-15 10:07:53 +0200
commit2bfbc16288454790f4c4cfa8ecace3518ee30059 (patch)
treea9ee7d86ee5f53c352e25092b08245e8d25fb042
parent585f6f3bc93e47c6943b4e523b50f2a930314514 (diff)
did Sound stuff
-rw-r--r--DiscoBot/Audio/Sound.cs9
-rw-r--r--DiscoBot/Audio/Soundeffects.cs14
-rw-r--r--DiscoBot/Audio/Voice.cs10
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)