mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 01:37:39 +03:00
Piano: Decrease sample headroom
Multiplying all samples by 0.1 was kind of silly. This also requires adjusting the wave visualizer so that the waves still fit.
This commit is contained in:
parent
d2510d0caa
commit
1088c2c716
Notes:
sideshowbarker
2024-07-17 17:25:24 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/1088c2c716 Pull-request: https://github.com/SerenityOS/serenity/pull/12857 Reviewed-by: https://github.com/linusg
@ -31,7 +31,7 @@ constexpr int buffer_size = sample_count * sizeof(Sample);
|
||||
constexpr double sample_rate = 44100;
|
||||
|
||||
// Headroom for the synth
|
||||
constexpr double volume_factor = 0.1;
|
||||
constexpr double volume_factor = 0.8;
|
||||
|
||||
enum Switch {
|
||||
Off,
|
||||
|
@ -18,10 +18,10 @@ WaveWidget::WaveWidget(TrackManager& track_manager)
|
||||
|
||||
int WaveWidget::sample_to_y(int sample) const
|
||||
{
|
||||
constexpr int nice_scale_factor = 4;
|
||||
sample *= nice_scale_factor;
|
||||
// Sample scaling that looks good, experimentally determined.
|
||||
constexpr double nice_scale_factor = 1.0;
|
||||
constexpr double sample_max = NumericLimits<i16>::max();
|
||||
double percentage = sample / sample_max;
|
||||
double percentage = sample / sample_max * nice_scale_factor;
|
||||
double portion_of_half_height = percentage * ((frame_inner_rect().height() - 1) / 2.0);
|
||||
double y = (frame_inner_rect().height() / 2.0) + portion_of_half_height;
|
||||
return y;
|
||||
|
Loading…
Reference in New Issue
Block a user