From 44c81ee9db453c824ed98f697bd67d661b4ee636 Mon Sep 17 00:00:00 2001 From: William McPherson Date: Wed, 5 Feb 2020 01:18:25 +1100 Subject: [PATCH] Piano: Remove phony multiple same note playback I say "phony" because it's not actually playing the same frequency twice, it's just playing the same frequency at a higher volume. We can properly implement this later but at the moment it'll get in the way of our ADSR implementation. --- Applications/Piano/AudioEngine.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Applications/Piano/AudioEngine.cpp b/Applications/Piano/AudioEngine.cpp index e32028d8ac..15fe0ac609 100644 --- a/Applications/Piano/AudioEngine.cpp +++ b/Applications/Piano/AudioEngine.cpp @@ -153,13 +153,12 @@ void AudioEngine::set_note(int note, Switch switch_note) if (switch_note == On) { if (m_note_on[note] == 0) { m_pos[note] = 0; - m_power[note] = 0; + m_power[note] = 1; } - ++m_power[note]; ++m_note_on[note]; } else { if (m_note_on[note] >= 1) { - if (--m_power[note] < 0) + if (m_note_on[note] == 1) m_power[note] = 0; --m_note_on[note]; }