From df8f2c10d236e111ab36ae13f7dde95dae440bd2 Mon Sep 17 00:00:00 2001 From: Florian Kuepper Date: Fri, 27 Jul 2012 14:14:47 +0200 Subject: [PATCH] Added equalizers to ScreenNames to show mic-input. Should be useful with more than 2 mics... --- Output/Themes/Ambient/Screens/ScreenNames.xml | 166 +++++++++++++++++- .../Changelog/Changelog_ScreenNames.txt | 5 + Vocaluxe/Menu/CEqualizer.cs | 68 +++---- Vocaluxe/Screens/CScreenNames.cs | 27 ++- 4 files changed, 218 insertions(+), 48 deletions(-) diff --git a/Output/Themes/Ambient/Screens/ScreenNames.xml b/Output/Themes/Ambient/Screens/ScreenNames.xml index c1ac532c..6c387b93 100644 --- a/Output/Themes/Ambient/Screens/ScreenNames.xml +++ b/Output/Themes/Ambient/Screens/ScreenNames.xml @@ -1,7 +1,7 @@  - 2 + 3 Video @@ -738,5 +738,167 @@ + + + Invisible + + 21 + 152 + -4,00 + 108 + 60 + + 8 + + 2,00 + + + + + Player1Dim2 + + + Player1Dim + + TR_CONFIG_OFF + + + + + + + Invisible + + 21 + 307 + -4,00 + 108 + 60 + + 8 + + 2,00 + + + + + Player2Dim2 + + + Player2Dim + + TR_CONFIG_OFF + + + + + + + Invisible + + 21 + 467 + -4,00 + 108 + 60 + + 8 + + 2,00 + + + + + Player3Dim2 + + + Player3Dim + + TR_CONFIG_OFF + + + + + + + Invisible + + 1213 + 152 + -4,00 + 108 + 60 + + 8 + + 2,00 + + + + + Player4Dim2 + + + Player4Dim + + TR_CONFIG_OFF + + + + + + + Invisible + + 1213 + 307 + -4,00 + 108 + 60 + + 8 + + 2,00 + + + + + Player5Dim2 + + + Player5Dim + + TR_CONFIG_OFF + + + + + + + Invisible + + 1213 + 467 + -4,00 + 108 + 60 + + 8 + + 2,00 + + + + + Player6Dim2 + + + Player6Dim + + TR_CONFIG_OFF + + + + - \ No newline at end of file + diff --git a/Output/Themes/Changelog/Changelog_ScreenNames.txt b/Output/Themes/Changelog/Changelog_ScreenNames.txt index 47d04016..60cea8b5 100644 --- a/Output/Themes/Changelog/Changelog_ScreenNames.txt +++ b/Output/Themes/Changelog/Changelog_ScreenNames.txt @@ -1,5 +1,10 @@ SceenNames +++++++++++ +Version 3: + + (One Equalizer for each player): Equalizer shows input from assigned mic for this player. + ++++++++++ Version 2: diff --git a/Vocaluxe/Menu/CEqualizer.cs b/Vocaluxe/Menu/CEqualizer.cs index a33641b4..2f82759c 100644 --- a/Vocaluxe/Menu/CEqualizer.cs +++ b/Vocaluxe/Menu/CEqualizer.cs @@ -127,6 +127,10 @@ namespace Vocaluxe.Menu { _Theme.Name = ElementName; _Bars = new float[_Theme.NumBars]; + for (int i = 0; i < _Bars.Length; i++) + { + _Bars[i] = 0f; + } LoadTextures(); } return _ThemeLoaded; @@ -170,18 +174,18 @@ namespace Vocaluxe.Menu writer.WriteElementString("B", Color.B.ToString("#0.00")); writer.WriteElementString("A", Color.A.ToString("#0.00")); } - writer.WriteComment(": Equalizer color from ColorScheme (high priority)"); - writer.WriteComment("or , , , (lower priority)"); + writer.WriteComment(": Equalizer color for maximal volume from ColorScheme (high priority)"); + writer.WriteComment("or , , , (lower priority)"); if (_Theme.ColorName != String.Empty) { - writer.WriteElementString("Color", _Theme.ColorName); + writer.WriteElementString("MaxColor", _Theme.ColorName); } else { - writer.WriteElementString("R", Color.R.ToString("#0.00")); - writer.WriteElementString("G", Color.G.ToString("#0.00")); - writer.WriteElementString("B", Color.B.ToString("#0.00")); - writer.WriteElementString("A", Color.A.ToString("#0.00")); + writer.WriteElementString("MaxR", Color.R.ToString("#0.00")); + writer.WriteElementString("MaxG", Color.G.ToString("#0.00")); + writer.WriteElementString("MaxB", Color.B.ToString("#0.00")); + writer.WriteElementString("MaxA", Color.A.ToString("#0.00")); } writer.WriteComment(" If exists:"); @@ -207,11 +211,10 @@ namespace Vocaluxe.Menu return; for (int i = 0; i < _Bars.Length; i++) { - if (weights.Length > i){ - _Bars[i] = weights[i]; + _Bars[i] = 1f - weights[i]; if (_Theme.DrawNegative == EOffOn.TR_CONFIG_OFF && weights[i] < 0) - _Bars[i] = 0f; + _Bars[i] = (1f + weights[i]); } else _Bars[i] = 0f; @@ -234,7 +237,7 @@ namespace Vocaluxe.Menu if (_Bars == null) return; - float dx = Rect.W / _Bars.Length + Space; + float dx = (Rect.W ) / _Bars.Length; int max = _Bars.Length - 1; float maxB = _Bars[max]; for (int i = 0; i < _Bars.Length - 1; i++) @@ -246,40 +249,19 @@ namespace Vocaluxe.Menu } } - switch (_Theme.Style){ - case EEqualizerStyle.Collums: - for (int i = 0; i < _Bars.Length; i++) - { - SRectF bar = new SRectF(Rect.X + dx * i, Rect.Y + Rect.H - _Bars[i] * Rect.H, dx - Space, _Bars[i] * Rect.H, Rect.Z); - SColorF color = Color; - if (i == max) - { - color = MaxColor; - } + for (int i = 0; i < _Bars.Length; i++) + { + SRectF bar = new SRectF(Rect.X + dx * i, Rect.Y + Rect.H - _Bars[i] * Rect.H, dx - Space, _Bars[i] * Rect.H, Rect.Z); + SColorF color = Color; + if (i == max) + { + color = MaxColor; + } - CDraw.DrawColor(color, bar); + CDraw.DrawColor(color, bar); - if (Reflection) - CDraw.DrawColorReflection(color, bar, ReflectionSpace, ReflectionHeight); - } - break; - - case EEqualizerStyle.Bars: - for (int i = 0; i < _Bars.Length; i++) - { - SRectF bar = new SRectF(Rect.X + dx * i, Rect.Y + Rect.H - _Bars[i] * Rect.H, dx - Space, _Bars[i] * Rect.H, Rect.Z); - SColorF color = Color; - if (i == max) - { - color = MaxColor; - } - - CDraw.DrawColor(color, bar); - - if (Reflection) - CDraw.DrawColorReflection(color, bar, ReflectionSpace, ReflectionHeight); - } - break; + if (Reflection) + CDraw.DrawColorReflection(color, bar, ReflectionSpace, ReflectionHeight); } } diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index 10258aca..9c8962e4 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -12,7 +12,7 @@ namespace Vocaluxe.Screens class CScreenNames : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! - const int ScreenVersion = 2; + const int ScreenVersion = 3; private CStatic chooseAvatarStatic; private int OldMouseX; @@ -29,6 +29,7 @@ namespace Vocaluxe.Screens private readonly string[] StaticPlayer = new string[] { "StaticPlayer1", "StaticPlayer2", "StaticPlayer3", "StaticPlayer4", "StaticPlayer5", "StaticPlayer6" }; private readonly string[] StaticPlayerAvatar = new string[] { "StaticPlayerAvatar1", "StaticPlayerAvatar2", "StaticPlayerAvatar3", "StaticPlayerAvatar4", "StaticPlayerAvatar5", "StaticPlayerAvatar6" }; private readonly string[] TextPlayer = new string[] { "TextPlayer1", "TextPlayer2", "TextPlayer3", "TextPlayer4", "TextPlayer5", "TextPlayer6" }; + private readonly string[] EqualizerPlayer = new string[] { "EqualizerPlayer1", "EqualizerPlayer2", "EqualizerPlayer3", "EqualizerPlayer4", "EqualizerPlayer5", "EqualizerPlayer6" }; private STexture[] OriginalPlayerAvatarTextures = new STexture[CSettings.MaxNumPlayer]; private bool selectingMouseActive = false; @@ -84,6 +85,10 @@ namespace Vocaluxe.Screens texts.Add(NameSelection); _ThemeNameSelections = texts.ToArray(); + texts.Clear(); + texts.AddRange(EqualizerPlayer); + _ThemeEqualizers = texts.ToArray(); + chooseAvatarStatic = new CStatic(); chooseAvatarStatic.Visible = false; } @@ -503,13 +508,18 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { - + for (int i = 1; i <= CGame.NumPlayer; i++) + { + CSound.AnalyzeBuffer((i-1)); + Equalizers[htEqualizer("EqualizerPlayer" + i)].Update(CSound.ToneWeigth((i-1))); + } return true; } public override void OnShow() { base.OnShow(); + CSound.RecordStart(); NameSelections[htNameSelections(NameSelection)].Init(); @@ -531,6 +541,12 @@ namespace Vocaluxe.Screens SetInteractionToButton(Buttons[htButtons(ButtonStart)]); } + public override void OnClose() + { + base.OnClose(); + CSound.RecordStop(); + } + public override bool Draw() { base.Draw(); @@ -539,7 +555,10 @@ namespace Vocaluxe.Screens { chooseAvatarStatic.Draw(); } - + for (int i = 1; i <= CGame.NumPlayer; i++) + { + Equalizers[htEqualizer("EqualizerPlayer" + i)].Draw(); + } return true; } @@ -591,12 +610,14 @@ namespace Vocaluxe.Screens { Texts[htTexts("TextPlayer" + i)].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + i.ToString(); } + Equalizers[htEqualizer("EqualizerPlayer" + i)].Visible = true; } else { Statics[htStatics("StaticPlayer" + i)].Visible = false; Statics[htStatics("StaticPlayerAvatar" + i)].Visible = false; Texts[htTexts("TextPlayer" + i)].Visible = false; + Equalizers[htEqualizer("EqualizerPlayer" + i)].Visible = false; } } CConfig.SaveConfig();