Skip to content

Commit

Permalink
#573 move normalizer inside max function
Browse files Browse the repository at this point in the history
  • Loading branch information
karlstav committed Jun 18, 2024
1 parent f04365c commit 3f6e931
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cava.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,21 +176,21 @@ float *monstercat_filter(float *bars, int number_of_bars, int waves, double mons
// process [smoothing]: monstercat-style "average"

int m_y, de;
int height_normalizer = 1;
float height_normalizer = 1.0;
if (height > 1000) {
height_normalizer = height / 1000;
height_normalizer = height / 912.76;
}
if (waves > 0) {
for (z = 0; z < number_of_bars; z++) { // waves
bars[z] = bars[z] / 1.25;
// if (bars[z] < 1) bars[z] = 1;
for (m_y = z - 1; m_y >= 0; m_y--) {
de = (z - m_y) * height_normalizer;
bars[m_y] = max(bars[z] - pow(de, 2), bars[m_y]);
de = z - m_y;
bars[m_y] = max(bars[z] - height_normalizer * pow(de, 2), bars[m_y]);
}
for (m_y = z + 1; m_y < number_of_bars; m_y++) {
de = (m_y - z) * height_normalizer;
bars[m_y] = max(bars[z] - pow(de, 2), bars[m_y]);
de = m_y - z;
bars[m_y] = max(bars[z] - height_normalizer * pow(de, 2), bars[m_y]);
}
}
} else if (monstercat > 0) {
Expand Down

0 comments on commit 3f6e931

Please sign in to comment.