Improve lmms::fastRand() and use it instead of std::rand() (#7741)

This commit is contained in:
Fawn
2026-01-15 17:12:04 -07:00
committed by GitHub
parent b390fa414a
commit 5e3a67c9d1
23 changed files with 433 additions and 468 deletions

View File

@@ -729,17 +729,18 @@ std::vector<std::pair<float, std::string>> SaSpectrumView::makeLogAmpTics(int lo
// Base zoom level on selected range and how close is the current height
// to the sizeHint() (denser scale for bigger window).
if ((high - low) < 20 * ((float)height() / sizeHint().height()))
const float heightScale = static_cast<float>(height()) / sizeHint().height();
if ((high - low) < 20 * heightScale)
{
increment = fastPow10f(0.3f); // 3 dB steps when really zoomed in
increment = fastPow10f(0.3); // 3 dB steps when really zoomed in
}
else if (high - low < 45 * ((float)height() / sizeHint().height()))
else if ((high - low) < 45 * heightScale)
{
increment = fastPow10f(0.6f); // 6 dB steps when sufficiently zoomed in
increment = fastPow10f(0.6); // 6 dB steps when sufficiently zoomed in
}
else
{
increment = 10; // 10 dB steps otherwise
increment = 10.0; // 10 dB steps otherwise
}
// Generate n dB increments, start checking at -90 dB. Limits are tweaked