summaryrefslogtreecommitdiff
path: root/Applications/Piano/AudioEngine.h
diff options
context:
space:
mode:
authorWilliam McPherson <willmcpherson2@gmail.com>2020-02-05 02:39:51 +1100
committerAndreas Kling <kling@serenityos.org>2020-02-05 17:52:10 +0100
commit5990b3b2e64da36323ebaa79c4cbf110c48c7a7c (patch)
treedbbfcb8fbcc4171ddd8cbd02fbb5d608db098221 /Applications/Piano/AudioEngine.h
parent421a34057296fd268a58c9733dca91c96d39219a (diff)
downloadserenity-5990b3b2e64da36323ebaa79c4cbf110c48c7a7c.zip
Piano: Add sustain
Diffstat (limited to 'Applications/Piano/AudioEngine.h')
-rw-r--r--Applications/Piano/AudioEngine.h6
1 files changed, 6 insertions, 0 deletions
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<Sample> m_front_buffer { sample_count };
FixedArray<Sample> m_back_buffer { sample_count };
FixedArray<Sample>* 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 };