Fix equalizers showing inverted values
This commit is contained in:
1 parent
3dba30d58e
commit
50494d902b
3 files changed
+38
-26
No files matched your search
@@ -547,7 +547,7 @@ namespace Vocaluxe.Screens
|
|||||||
for (int i = 1; i <= CGame.NumPlayer; i++)
|
for (int i = 1; i <= CGame.NumPlayer; i++)
|
||||||
{
|
{
|
||||||
CRecord.AnalyzeBuffer(i - 1);
|
CRecord.AnalyzeBuffer(i - 1);
|
||||||
_Equalizers["EqualizerPlayer" + i].Update(CRecord.ToneWeigth(i - 1));
|
_Equalizers["EqualizerPlayer" + i].Update(CRecord.ToneWeigth(i - 1), CRecord.GetMaxVolume(i - 1));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -223,25 +223,29 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
if (_CheckMicConfig())
|
if (_CheckMicConfig())
|
||||||
{
|
{
|
||||||
_ChannelEnergy[0] = 0f;
|
int player = _SelectSlides[_SelectSlideRecordChannel1].Selection - 1;
|
||||||
int player = _SelectSlides[_SelectSlideRecordChannel1].Selection;
|
if (player >= 0)
|
||||||
if (player > 0)
|
|
||||||
{
|
{
|
||||||
_ChannelEnergy[0] = CRecord.GetMaxVolume(player - 1);
|
_ChannelEnergy[0] = CRecord.GetMaxVolume(player);
|
||||||
_Equalizers[_EqualizerChannel1].Update(CRecord.ToneWeigth(player - 1));
|
_Equalizers[_EqualizerChannel1].Update(CRecord.ToneWeigth(player), CRecord.GetMaxVolume(player));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
_ChannelEnergy[0] = 0f;
|
||||||
_Equalizers[_EqualizerChannel1].Reset();
|
_Equalizers[_EqualizerChannel1].Reset();
|
||||||
|
}
|
||||||
|
|
||||||
_ChannelEnergy[1] = 0f;
|
player = _SelectSlides[_SelectSlideRecordChannel2].Selection - 1;
|
||||||
player = _SelectSlides[_SelectSlideRecordChannel2].Selection;
|
if (player >= 0)
|
||||||
if (player > 0)
|
|
||||||
{
|
{
|
||||||
_ChannelEnergy[1] = CRecord.GetMaxVolume(player - 1);
|
_ChannelEnergy[1] = CRecord.GetMaxVolume(player - 1);
|
||||||
_Equalizers[_EqualizerChannel2].Update(CRecord.ToneWeigth(player - 1));
|
_Equalizers[_EqualizerChannel2].Update(CRecord.ToneWeigth(player), CRecord.GetMaxVolume(player));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
_ChannelEnergy[1] = 0f;
|
||||||
_Equalizers[_EqualizerChannel2].Reset();
|
_Equalizers[_EqualizerChannel2].Reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace VocaluxeLib.Menu
|
|||||||
{
|
{
|
||||||
enum EEqualizerStyle
|
enum EEqualizerStyle
|
||||||
{
|
{
|
||||||
Collums
|
Columns
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SThemeEqualizer
|
struct SThemeEqualizer
|
||||||
@@ -64,6 +64,8 @@ namespace VocaluxeLib.Menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
private float[] _Bars;
|
private float[] _Bars;
|
||||||
|
private int _MaxBar;
|
||||||
|
private float _MaxVolume;
|
||||||
|
|
||||||
public CEqualizer(int partyModeID)
|
public CEqualizer(int partyModeID)
|
||||||
{
|
{
|
||||||
@@ -211,17 +213,31 @@ namespace VocaluxeLib.Menu
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(float[] weights)
|
public void Update(float[] weights, float volume)
|
||||||
{
|
{
|
||||||
if (weights == null || weights.Length == 0 || _Bars == null)
|
if (weights == null || weights.Length == 0 || _Bars == null)
|
||||||
return;
|
return;
|
||||||
|
if (volume < 0.001)
|
||||||
|
return;
|
||||||
|
if (volume > _MaxVolume)
|
||||||
|
_MaxVolume = volume;
|
||||||
|
_MaxBar = 0;
|
||||||
|
float maxVal = -99f;
|
||||||
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] = 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] = 1f + weights[i];
|
_Bars[i] = 0f;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_Bars[i] = weights[i] * volume / _MaxVolume;
|
||||||
|
if (_Bars[i] > maxVal)
|
||||||
|
{
|
||||||
|
maxVal = _Bars[i];
|
||||||
|
_MaxBar = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_Bars[i] = 0f;
|
_Bars[i] = 0f;
|
||||||
@@ -235,30 +251,22 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
for (int i = 0; i < _Bars.Length; i++)
|
for (int i = 0; i < _Bars.Length; i++)
|
||||||
_Bars[i] = 0f;
|
_Bars[i] = 0f;
|
||||||
|
_MaxBar = 0;
|
||||||
|
_MaxVolume = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw()
|
public void Draw()
|
||||||
{
|
{
|
||||||
if (_Bars == null || _Theme.Style != EEqualizerStyle.Collums)
|
if (_Bars == null || _Theme.Style != EEqualizerStyle.Columns)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float dx = Rect.W / _Bars.Length;
|
float dx = Rect.W / _Bars.Length;
|
||||||
int max = _Bars.Length - 1;
|
|
||||||
float maxB = _Bars[max];
|
|
||||||
for (int i = 0; i < _Bars.Length - 1; i++)
|
|
||||||
{
|
|
||||||
if (_Bars[i] > maxB)
|
|
||||||
{
|
|
||||||
maxB = _Bars[i];
|
|
||||||
max = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < _Bars.Length; i++)
|
for (int i = 0; i < _Bars.Length; i++)
|
||||||
{
|
{
|
||||||
var bar = new SRectF(Rect.X + dx * i, Rect.Y + Rect.H - _Bars[i] * Rect.H, dx - Space, _Bars[i] * Rect.H, Rect.Z);
|
var 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;
|
SColorF color = Color;
|
||||||
if (i == max)
|
if (i == _MaxBar)
|
||||||
color = MaxColor;
|
color = MaxColor;
|
||||||
|
|
||||||
CBase.Drawing.DrawColor(color, bar);
|
CBase.Drawing.DrawColor(color, bar);
|
||||||
|
|||||||
Reference in new issue
Block a user