From 2ff228ab35011ab210b3a5b6052ed3f7026de166 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Wed, 27 Sep 2023 05:33:56 +0200 Subject: piano roll refactor --- source/saw/main.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'source') 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); -- cgit v1.2.3