Skip to content

Commit

Permalink
Version
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve John committed Jul 15, 2024
1 parent b905d4c commit 1b7e92a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
33 changes: 32 additions & 1 deletion src/Zen.Desktop.Host/Features/WaveVisualiser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,14 @@ private void RenderChannel(int channel)

var axis = channel == 3 ? height * width * channel + height * width / 2 : height * width * (channel + 1) - width;

CentreChannel(_buffers[channel]);
if (channel == 3)
{
CentreBeeper(_buffers[channel]);
}
else
{
CentreChannel(_buffers[channel]);
}

var lastOffset = 0;

Expand Down Expand Up @@ -171,4 +178,28 @@ private void CentreChannel(float[] buffer)
_centreBuffer[i] = buffer[(startPos + i) % BufferSize];
}
}

private void CentreBeeper(float[] buffer)
{
var max = float.MinValue;

var maxPos = int.MinValue;

for (var i = 0; i < BufferSize; i++)
{
if (buffer[i] > max)
{
max = buffer[i];

maxPos = i;
}
}

var startPos = BufferSize / 2 + maxPos;

for (var i = 0; i < BufferSize; i++)
{
_centreBuffer[i] = buffer[(startPos + i) % BufferSize];
}
}
}
2 changes: 1 addition & 1 deletion src/Zen.Z80/Zen.Z80.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Description>A dotnet Z80 emulator implementation.</Description>
<Copyright>MIT</Copyright>
<RepositoryUrl>https://github.com/stevehjohn/Zen</RepositoryUrl>
<Version>1.0.10</Version>
<Version>1.0.11</Version>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 1b7e92a

Please sign in to comment.