summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-09-27 05:33:56 +0200
committerMitya Selivanov <automainint@guattari.tech>2023-09-27 05:33:56 +0200
commit2ff228ab35011ab210b3a5b6052ed3f7026de166 (patch)
tree7c878852c5207087eddcf19a3efc16d99570fbda
parent2a20d5a122f436f510c5a9f97ca0ed3333bf9e56 (diff)
downloadsaw-2ff228ab35011ab210b3a5b6052ed3f7026de166.zip
piano roll refactor
-rw-r--r--source/saw/main.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/source/saw/main.c b/source/saw/main.c
index 9945480..ffc848d 100644
--- a/source/saw/main.c
+++ b/source/saw/main.c
@@ -26,7 +26,8 @@ enum {
VOICE_COUNT = 16,
ROLL_SIZE = 40,
- SHEET_SIZE = 200
+ SHEET_SIZE = 200,
+ ROLL_COUNT = 4,
};
typedef struct {
@@ -69,14 +70,15 @@ static f64 saw_voice_duration[VOICE_COUNT] = { 0 };
static i8 saw_playback_on = 0;
static i64 saw_playback_frame = 0;
-static saw_roll_t saw_rolls[1] = { { .last_index = -1,
- .turned_off = { 0 },
- .sheet = { .rate = 6,
- .notes = { 0 } },
- .grid_input = 0,
- .grid_note = 0,
- .grid_pitch = 0,
- .grid_time = 0 } };
+static saw_roll_t saw_rolls[ROLL_COUNT] = {
+ { .last_index = -1,
+ .turned_off = { 0 },
+ .sheet = { .rate = 6, .notes = { 0 } },
+ .grid_input = 0,
+ .grid_note = 0,
+ .grid_pitch = 0,
+ .grid_time = 0 }
+};
#ifdef __GNUC__
# pragma GCC diagnostic push
@@ -454,7 +456,9 @@ static void saw_frame(void) {
nvgBeginFrame(saw_nvg, frame_width, frame_height, sapp_dpi_scale());
- saw_ui_roll(saw_rolls, 0, 0, frame_width, frame_height);
+ saw_ui_roll(saw_rolls, 0, 0, frame_width, frame_height / 2);
+ saw_ui_roll(saw_rolls + 1, frame_height / 2, 0, frame_width,
+ frame_height / 2);
nvgEndFrame(saw_nvg);