Skip to content

Commit

Permalink
Merge pull request #97 from xzoth/master
Browse files Browse the repository at this point in the history
Fixed LineSpectrum Bar calculate issue
  • Loading branch information
filoe committed May 27, 2016
2 parents 2ab1cfd + 2c7af91 commit 1eb7d2f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Samples/WinformsVisualization/Visualization/LineSpectrum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private void CreateSpectrumLineInternal(Graphics graphics, Pen pen, float[] fftB
{
SpectrumPointData p = spectrumPoints[i];
int barIndex = p.SpectrumPointIndex;
double xCoord = (_barWidth * barIndex) + (BarSpacing * barIndex) + 1 + _barWidth / 2;
double xCoord = BarSpacing * (barIndex + 1) + (_barWidth * barIndex) + _barWidth / 2;

var p1 = new PointF((float) xCoord, height);
var p2 = new PointF((float) xCoord, height - (float) p.Value - 1);
Expand All @@ -128,7 +128,7 @@ private void CreateSpectrumLineInternal(Graphics graphics, Pen pen, float[] fftB

protected override void UpdateFrequencyMapping()
{
_barWidth = Math.Max(((_currentSize.Width - (BarSpacing * (BarCount - 1))) / BarCount), 0.00001);
_barWidth = Math.Max(((_currentSize.Width - (BarSpacing * (BarCount + 1))) / BarCount), 0.00001);
base.UpdateFrequencyMapping();
}

Expand Down

0 comments on commit 1eb7d2f

Please sign in to comment.