Skip to content

Commit

Permalink
Merge pull request #26 from stevehjohn/centre
Browse files Browse the repository at this point in the history
Centred
  • Loading branch information
stevehjohn authored Jul 15, 2024
2 parents 453f856 + ca9c70e commit 7218c8a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Zen.Desktop.Host/Features/WaveVisualiser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,22 @@ private void CentreChannel(float[] buffer)
maxPos = i;
}
}

var min = float.MaxValue;

var minPos = int.MinValue;

for (var i = maxPos; i < BufferSize; i++)
{
if (buffer[i] < min)
{
min = buffer[i];

var startPos = BufferSize / 2 + maxPos;
minPos = i;
}
}

var startPos = BufferSize / 2 + maxPos - (maxPos - minPos) / 2;

for (var i = 0; i < BufferSize; i++)
{
Expand Down

0 comments on commit 7218c8a

Please sign in to comment.