Skip to content

Commit 5cabf1b

Browse files
committed
better calculation of smoothing, this fixes #351
1 parent 1b055fa commit 5cabf1b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cava.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -646,12 +646,15 @@ as of 0.4.0 all options are specified in config file, see in '/home/username/.co
646646
remainder = 0;
647647

648648
// process [smoothing]: calculate gravity
649-
float g = p.gravity * ((float)height / 2160) * pow((60 / (float)p.framerate), 2.5);
649+
float g = p.gravity * log10((float)height) * 0.05 * pow((60 / (float)p.framerate), 2.5);
650+
651+
if (output_mode == OUTPUT_SDL) {
652+
g *= 1.5; // we can assume sdl to have higher resolution so a bit more g is
653+
// nescescary.
654+
}
650655

651656
// calculate integral value, must be reduced with height
652657
double integral = p.integral;
653-
if (height > 320)
654-
integral = p.integral * 1 / sqrt((log10((float)height / 10)));
655658

656659
#ifndef NDEBUG
657660
debug("height: %d width: %d bars:%d bar width: %d remainder: %d\n", height, width,

0 commit comments

Comments
 (0)