1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 08:58:11 +00:00

Piano: Add nice scale factor to WaveWidget

This commit is contained in:
William McPherson 2020-02-09 21:27:19 +11:00 committed by Andreas Kling
parent 2a66878148
commit 255edcb525

View file

@ -45,6 +45,8 @@ WaveWidget::~WaveWidget()
int WaveWidget::sample_to_y(int sample) const
{
constexpr int nice_scale_factor = 4;
sample *= nice_scale_factor;
constexpr double sample_max = std::numeric_limits<i16>::max();
double percentage = sample / sample_max;
double portion_of_half_height = percentage * ((frame_inner_rect().height() - 1) / 2.0);