From ec7b98f07984f492e4a3c567bad4d05ff02499ca Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 13 Jul 2019 20:54:16 +0200 Subject: [PATCH] Piano: Take down the baseline "volume" from 3000 to 1800. I have no idea what a good value for this would be. This seems to do better when playing many notes at once. --- Applications/Piano/PianoWidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Applications/Piano/PianoWidget.cpp b/Applications/Piano/PianoWidget.cpp index 7b8084a2db..de3b394ef7 100644 --- a/Applications/Piano/PianoWidget.cpp +++ b/Applications/Piano/PianoWidget.cpp @@ -58,17 +58,17 @@ void PianoWidget::fill_audio_buffer(uint8_t* stream, int len) auto* sst = (Sample*)stream; for (int i = 0; i < m_sample_count; ++i) { - static const double VOLUME = 3000; + static const double volume = 1800; for (size_t n = 0; n < (sizeof(m_note_on) / sizeof(bool)); ++n) { if (!m_note_on[n]) continue; double val = 0; if (m_wave_type == WaveType::Sine) - val = ((VOLUME * m_power[n]) * w_sine(n)); + val = ((volume * m_power[n]) * w_sine(n)); else if (m_wave_type == WaveType::Saw) - val = ((VOLUME * m_power[n]) * w_saw(n)); + val = ((volume * m_power[n]) * w_saw(n)); else if (m_wave_type == WaveType::Square) - val = ((VOLUME * m_power[n]) * w_square(n)); + val = ((volume * m_power[n]) * w_square(n)); if (sst[i].left == 0) sst[i].left = val; else