Skip to content

Commit

Permalink
Fix connection message display bug
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyschoen committed Feb 11, 2025
1 parent c758b6f commit aeed511
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Libraries/pure-data
Submodule pure-data updated 1 files
+5 −5 src/s_inter.c
13 changes: 10 additions & 3 deletions Source/Components/ConnectionMessageDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,17 @@ class ConnectionMessageDisplay final
g.drawText("0.000", textBounds.toNearestInt(), Justification::centred);
continue;
}



if(!std::isfinite(peakAmplitude) || !std::isfinite(valleyAmplitude))
{
peakAmplitude = 0;
valleyAmplitude = 1;
}

while (peakAmplitude < valleyAmplitude || approximatelyEqual(peakAmplitude, valleyAmplitude)) {
peakAmplitude += peakAmplitude * 0.001f;
valleyAmplitude -= valleyAmplitude * 0.001f;
peakAmplitude += 0.001f;
valleyAmplitude -= 0.001f;
}

// Apply FFT to get the peak frequency, we use this to decide the amount of samples we display
Expand Down

0 comments on commit aeed511

Please sign in to comment.