From 5990b3b2e64da36323ebaa79c4cbf110c48c7a7c Mon Sep 17 00:00:00 2001 From: William McPherson Date: Wed, 5 Feb 2020 02:39:51 +1100 Subject: Piano: Add sustain --- Applications/Piano/AudioEngine.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Applications/Piano/AudioEngine.h') diff --git a/Applications/Piano/AudioEngine.h b/Applications/Piano/AudioEngine.h index 4f5bdc1585..33ef6af27a 100644 --- a/Applications/Piano/AudioEngine.h +++ b/Applications/Piano/AudioEngine.h @@ -44,6 +44,7 @@ public: int octave_base() const { return (m_octave - octave_min) * 12; } int wave() const { return m_wave; } int decay() const { return m_decay; } + int sustain() const { return m_sustain; } int delay() const { return m_delay; } int time() const { return m_time; } int tick() const { return m_tick; } @@ -55,6 +56,7 @@ public: void set_wave(int wave); void set_wave(Direction); void set_decay(int decay); + void set_sustain(int sustain); void set_delay(int delay); private: @@ -64,6 +66,8 @@ private: double triangle(size_t note); double noise() const; + void set_sustain_impl(int sustain); + FixedArray m_front_buffer { sample_count }; FixedArray m_back_buffer { sample_count }; FixedArray* m_front_buffer_ptr { &m_front_buffer }; @@ -79,6 +83,8 @@ private: int m_wave { first_wave }; int m_decay; double m_decay_step; + int m_sustain; + double m_sustain_level; int m_delay { 0 }; int m_time { 0 }; -- cgit v1.2.3