Added equalizers to ScreenNames to show mic-input. Should be useful with more than 2 mics...

This commit is contained in:
Florian Kuepper committed 2012-07-27 14:14:47 +02:00
1 parent aacc842d80
commit df8f2c10d2
4 files changed
+218 -48

No files matched your search

+164 -2
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<ScreenNames> <ScreenNames>
<ScreenVersion>2</ScreenVersion> <ScreenVersion>3</ScreenVersion>
<Background1> <Background1>
<!--<Type>: Background type: None, Color, Texture, Video--> <!--<Type>: Background type: None, Color, Texture, Video-->
<Type>Video</Type> <Type>Video</Type>
@@ -738,5 +738,167 @@
</Name> </Name>
</Tiles> </Tiles>
</NameSelection> </NameSelection>
<EqualizerPlayer1>
<!--<Skin>: Texture name-->
<Skin>Invisible</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: Equalizer position, width and height-->
<X>21</X>
<Y>152</Y>
<Z>-4,00</Z>
<W>108</W>
<H>60</H>
<!--<NumBars>: Number of equalizer-elements.-->
<NumBars>8</NumBars>
<!--<Space>: Space between equalizer-elements.-->
<Space>2,00</Space>
<!--<Style>: Style of equalizer-elements-->
<Style>Collumns</Style>
<!--<Color>: Equalizer color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>Player1Dim2</Color>
<!--<MaxColor>: Equalizer color for maximal volume from ColorScheme (high priority)-->
<!--or <MaxR>, <MaxG>, <MaxB>, <MaxA> (lower priority)-->
<MaxColor>Player1Dim</MaxColor>
<!--<DrawNegative>: Draw negative values: TR_CONFIG_OFF, TR_CONFIG_ON -->
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</EqualizerPlayer1>
<EqualizerPlayer2>
<!--<Skin>: Texture name-->
<Skin>Invisible</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: Equalizer position, width and height-->
<X>21</X>
<Y>307</Y>
<Z>-4,00</Z>
<W>108</W>
<H>60</H>
<!--<NumBars>: Number of equalizer-elements.-->
<NumBars>8</NumBars>
<!--<Space>: Space between equalizer-elements.-->
<Space>2,00</Space>
<!--<Style>: Style of equalizer-elements-->
<Style>Collumns</Style>
<!--<Color>: Equalizer color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>Player2Dim2</Color>
<!--<MaxColor>: Equalizer color for maximal volume from ColorScheme (high priority)-->
<!--or <MaxR>, <MaxG>, <MaxB>, <MaxA> (lower priority)-->
<MaxColor>Player2Dim</MaxColor>
<!--<DrawNegative>: Draw negative values: TR_CONFIG_OFF, TR_CONFIG_ON -->
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</EqualizerPlayer2>
<EqualizerPlayer3>
<!--<Skin>: Texture name-->
<Skin>Invisible</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: Equalizer position, width and height-->
<X>21</X>
<Y>467</Y>
<Z>-4,00</Z>
<W>108</W>
<H>60</H>
<!--<NumBars>: Number of equalizer-elements.-->
<NumBars>8</NumBars>
<!--<Space>: Space between equalizer-elements.-->
<Space>2,00</Space>
<!--<Style>: Style of equalizer-elements-->
<Style>Collumns</Style>
<!--<Color>: Equalizer color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>Player3Dim2</Color>
<!--<MaxColor>: Equalizer color for maximal volume from ColorScheme (high priority)-->
<!--or <MaxR>, <MaxG>, <MaxB>, <MaxA> (lower priority)-->
<MaxColor>Player3Dim</MaxColor>
<!--<DrawNegative>: Draw negative values: TR_CONFIG_OFF, TR_CONFIG_ON -->
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</EqualizerPlayer3>
<EqualizerPlayer4>
<!--<Skin>: Texture name-->
<Skin>Invisible</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: Equalizer position, width and height-->
<X>1213</X>
<Y>152</Y>
<Z>-4,00</Z>
<W>108</W>
<H>60</H>
<!--<NumBars>: Number of equalizer-elements.-->
<NumBars>8</NumBars>
<!--<Space>: Space between equalizer-elements.-->
<Space>2,00</Space>
<!--<Style>: Style of equalizer-elements-->
<Style>Collumns</Style>
<!--<Color>: Equalizer color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>Player4Dim2</Color>
<!--<MaxColor>: Equalizer color for maximal volume from ColorScheme (high priority)-->
<!--or <MaxR>, <MaxG>, <MaxB>, <MaxA> (lower priority)-->
<MaxColor>Player4Dim</MaxColor>
<!--<DrawNegative>: Draw negative values: TR_CONFIG_OFF, TR_CONFIG_ON -->
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</EqualizerPlayer4>
<EqualizerPlayer5>
<!--<Skin>: Texture name-->
<Skin>Invisible</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: Equalizer position, width and height-->
<X>1213</X>
<Y>307</Y>
<Z>-4,00</Z>
<W>108</W>
<H>60</H>
<!--<NumBars>: Number of equalizer-elements.-->
<NumBars>8</NumBars>
<!--<Space>: Space between equalizer-elements.-->
<Space>2,00</Space>
<!--<Style>: Style of equalizer-elements-->
<Style>Collumns</Style>
<!--<Color>: Equalizer color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>Player5Dim2</Color>
<!--<MaxColor>: Equalizer color for maximal volume from ColorScheme (high priority)-->
<!--or <MaxR>, <MaxG>, <MaxB>, <MaxA> (lower priority)-->
<MaxColor>Player5Dim</MaxColor>
<!--<DrawNegative>: Draw negative values: TR_CONFIG_OFF, TR_CONFIG_ON -->
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</EqualizerPlayer5>
<EqualizerPlayer6>
<!--<Skin>: Texture name-->
<Skin>Invisible</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: Equalizer position, width and height-->
<X>1213</X>
<Y>467</Y>
<Z>-4,00</Z>
<W>108</W>
<H>60</H>
<!--<NumBars>: Number of equalizer-elements.-->
<NumBars>8</NumBars>
<!--<Space>: Space between equalizer-elements.-->
<Space>2,00</Space>
<!--<Style>: Style of equalizer-elements-->
<Style>Collumns</Style>
<!--<Color>: Equalizer color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>Player6Dim2</Color>
<!--<MaxColor>: Equalizer color for maximal volume from ColorScheme (high priority)-->
<!--or <MaxR>, <MaxG>, <MaxB>, <MaxA> (lower priority)-->
<MaxColor>Player6Dim</MaxColor>
<!--<DrawNegative>: Draw negative values: TR_CONFIG_OFF, TR_CONFIG_ON -->
<DrawNegative>TR_CONFIG_OFF</DrawNegative>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</EqualizerPlayer6>
</ScreenNames> </ScreenNames>
</root> </root>
@@ -1,5 +1,10 @@
SceenNames SceenNames
++++++++++
Version 3:
<EqualizerPlayer[1...6]> (One Equalizer for each player): Equalizer shows input from assigned mic for this player.
++++++++++ ++++++++++
Version 2: Version 2:
+25 -43
View File
@@ -127,6 +127,10 @@ namespace Vocaluxe.Menu
{ {
_Theme.Name = ElementName; _Theme.Name = ElementName;
_Bars = new float[_Theme.NumBars]; _Bars = new float[_Theme.NumBars];
for (int i = 0; i < _Bars.Length; i++)
{
_Bars[i] = 0f;
}
LoadTextures(); LoadTextures();
} }
return _ThemeLoaded; return _ThemeLoaded;
@@ -170,18 +174,18 @@ namespace Vocaluxe.Menu
writer.WriteElementString("B", Color.B.ToString("#0.00")); writer.WriteElementString("B", Color.B.ToString("#0.00"));
writer.WriteElementString("A", Color.A.ToString("#0.00")); writer.WriteElementString("A", Color.A.ToString("#0.00"));
} }
writer.WriteComment("<Color>: Equalizer color from ColorScheme (high priority)"); writer.WriteComment("<MaxColor>: Equalizer color for maximal volume from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)"); writer.WriteComment("or <MaxR>, <MaxG>, <MaxB>, <MaxA> (lower priority)");
if (_Theme.ColorName != String.Empty) if (_Theme.ColorName != String.Empty)
{ {
writer.WriteElementString("Color", _Theme.ColorName); writer.WriteElementString("MaxColor", _Theme.ColorName);
} }
else else
{ {
writer.WriteElementString("R", Color.R.ToString("#0.00")); writer.WriteElementString("MaxR", Color.R.ToString("#0.00"));
writer.WriteElementString("G", Color.G.ToString("#0.00")); writer.WriteElementString("MaxG", Color.G.ToString("#0.00"));
writer.WriteElementString("B", Color.B.ToString("#0.00")); writer.WriteElementString("MaxB", Color.B.ToString("#0.00"));
writer.WriteElementString("A", Color.A.ToString("#0.00")); writer.WriteElementString("MaxA", Color.A.ToString("#0.00"));
} }
writer.WriteComment("<Reflection> If exists:"); writer.WriteComment("<Reflection> If exists:");
@@ -207,11 +211,10 @@ namespace Vocaluxe.Menu
return; return;
for (int i = 0; i < _Bars.Length; i++) for (int i = 0; i < _Bars.Length; i++)
{ {
if (weights.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) if (_Theme.DrawNegative == EOffOn.TR_CONFIG_OFF && weights[i] < 0)
_Bars[i] = 0f; _Bars[i] = (1f + weights[i]);
} }
else else
_Bars[i] = 0f; _Bars[i] = 0f;
@@ -234,7 +237,7 @@ namespace Vocaluxe.Menu
if (_Bars == null) if (_Bars == null)
return; return;
float dx = Rect.W / _Bars.Length + Space; float dx = (Rect.W ) / _Bars.Length;
int max = _Bars.Length - 1; int max = _Bars.Length - 1;
float maxB = _Bars[max]; float maxB = _Bars[max];
for (int i = 0; i < _Bars.Length - 1; i++) for (int i = 0; i < _Bars.Length - 1; i++)
@@ -246,40 +249,19 @@ namespace Vocaluxe.Menu
} }
} }
switch (_Theme.Style){ for (int i = 0; i < _Bars.Length; i++)
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;
SRectF bar = new SRectF(Rect.X + dx * i, Rect.Y + Rect.H - _Bars[i] * Rect.H, dx - Space, _Bars[i] * Rect.H, Rect.Z); if (i == max)
SColorF color = Color; {
if (i == max) color = MaxColor;
{ }
color = MaxColor;
}
CDraw.DrawColor(color, bar); CDraw.DrawColor(color, bar);
if (Reflection) if (Reflection)
CDraw.DrawColorReflection(color, bar, ReflectionSpace, ReflectionHeight); 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;
} }
} }
+24 -3
View File
@@ -12,7 +12,7 @@ namespace Vocaluxe.Screens
class CScreenNames : CMenu class CScreenNames : CMenu
{ {
// Version number for theme files. Increment it, if you've changed something on the theme files! // 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 CStatic chooseAvatarStatic;
private int OldMouseX; 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[] StaticPlayer = new string[] { "StaticPlayer1", "StaticPlayer2", "StaticPlayer3", "StaticPlayer4", "StaticPlayer5", "StaticPlayer6" };
private readonly string[] StaticPlayerAvatar = new string[] { "StaticPlayerAvatar1", "StaticPlayerAvatar2", "StaticPlayerAvatar3", "StaticPlayerAvatar4", "StaticPlayerAvatar5", "StaticPlayerAvatar6" }; 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[] 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 STexture[] OriginalPlayerAvatarTextures = new STexture[CSettings.MaxNumPlayer];
private bool selectingMouseActive = false; private bool selectingMouseActive = false;
@@ -84,6 +85,10 @@ namespace Vocaluxe.Screens
texts.Add(NameSelection); texts.Add(NameSelection);
_ThemeNameSelections = texts.ToArray(); _ThemeNameSelections = texts.ToArray();
texts.Clear();
texts.AddRange(EqualizerPlayer);
_ThemeEqualizers = texts.ToArray();
chooseAvatarStatic = new CStatic(); chooseAvatarStatic = new CStatic();
chooseAvatarStatic.Visible = false; chooseAvatarStatic.Visible = false;
} }
@@ -503,13 +508,18 @@ namespace Vocaluxe.Screens
public override bool UpdateGame() 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; return true;
} }
public override void OnShow() public override void OnShow()
{ {
base.OnShow(); base.OnShow();
CSound.RecordStart();
NameSelections[htNameSelections(NameSelection)].Init(); NameSelections[htNameSelections(NameSelection)].Init();
@@ -531,6 +541,12 @@ namespace Vocaluxe.Screens
SetInteractionToButton(Buttons[htButtons(ButtonStart)]); SetInteractionToButton(Buttons[htButtons(ButtonStart)]);
} }
public override void OnClose()
{
base.OnClose();
CSound.RecordStop();
}
public override bool Draw() public override bool Draw()
{ {
base.Draw(); base.Draw();
@@ -539,7 +555,10 @@ namespace Vocaluxe.Screens
{ {
chooseAvatarStatic.Draw(); chooseAvatarStatic.Draw();
} }
for (int i = 1; i <= CGame.NumPlayer; i++)
{
Equalizers[htEqualizer("EqualizerPlayer" + i)].Draw();
}
return true; return true;
} }
@@ -591,12 +610,14 @@ namespace Vocaluxe.Screens
{ {
Texts[htTexts("TextPlayer" + i)].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + i.ToString(); Texts[htTexts("TextPlayer" + i)].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + i.ToString();
} }
Equalizers[htEqualizer("EqualizerPlayer" + i)].Visible = true;
} }
else else
{ {
Statics[htStatics("StaticPlayer" + i)].Visible = false; Statics[htStatics("StaticPlayer" + i)].Visible = false;
Statics[htStatics("StaticPlayerAvatar" + i)].Visible = false; Statics[htStatics("StaticPlayerAvatar" + i)].Visible = false;
Texts[htTexts("TextPlayer" + i)].Visible = false; Texts[htTexts("TextPlayer" + i)].Visible = false;
Equalizers[htEqualizer("EqualizerPlayer" + i)].Visible = false;
} }
} }
CConfig.SaveConfig(); CConfig.SaveConfig();