summaryrefslogtreecommitdiff
path: root/Applications/Piano/AudioEngine.h
diff options
context:
space:
mode:
authorWilliam McPherson <willmcpherson2@gmail.com>2020-02-06 19:13:25 +1100
committerAndreas Kling <kling@serenityos.org>2020-02-06 19:13:53 +0100
commit9a05bbaaced69d2c55f5aa9f0ecfa4ae21bd461a (patch)
tree30a1daaecfd8adfee19a971280d2dee01d3ad204 /Applications/Piano/AudioEngine.h
parent82d17d2c79e8a680a211fbfd370fc257b6ea494a (diff)
downloadserenity-9a05bbaaced69d2c55f5aa9f0ecfa4ae21bd461a.zip
Piano: Move piano roll internals to AudioEngine
The piano roll data definitely belongs in AudioEngine along with the note and time data. Now RollWidget only has GUI information, much like the other widgets. Note that this commit exacerbates issue #1158 which is caused by RollWidget::paint_event().
Diffstat (limited to 'Applications/Piano/AudioEngine.h')
-rw-r--r--Applications/Piano/AudioEngine.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Applications/Piano/AudioEngine.h b/Applications/Piano/AudioEngine.h
index 8e1a048234..229c365f1a 100644
--- a/Applications/Piano/AudioEngine.h
+++ b/Applications/Piano/AudioEngine.h
@@ -40,6 +40,8 @@ public:
~AudioEngine();
const FixedArray<Sample>& buffer() const { return *m_front_buffer_ptr; }
+ Switch roll_note(int y, int x) const { return m_roll_notes[y][x]; }
+ int current_column() const { return m_current_column; }
int octave() const { return m_octave; }
int octave_base() const { return (m_octave - octave_min) * 12; }
int wave() const { return m_wave; }
@@ -54,6 +56,7 @@ public:
void fill_buffer(FixedArray<Sample>& buffer);
void set_note(int note, Switch);
void set_note_current_octave(int note, Switch);
+ void set_roll_note(int y, int x, Switch);
void set_octave(Direction);
void set_wave(int wave);
void set_wave(Direction);
@@ -70,6 +73,8 @@ private:
double triangle(size_t note);
double noise() const;
+ void update_roll();
+
void set_sustain_impl(int sustain);
FixedArray<Sample> m_front_buffer { sample_count };
@@ -98,4 +103,8 @@ private:
int m_time { 0 };
int m_tick { 8 };
+
+ Switch m_roll_notes[note_count][horizontal_notes] { { Off } };
+ int m_current_column { 0 };
+ int m_previous_column { horizontal_notes - 1 };
};