From baf492d2a83533114275b1f8f3576c94bb3e5bc0 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Mon, 25 Sep 2023 23:37:48 +0200 Subject: pianoroll update --- source/saw/main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/saw/main.c b/source/saw/main.c index b362ed7..ff2a34c 100644 --- a/source/saw/main.c +++ b/source/saw/main.c @@ -32,7 +32,7 @@ enum { SAW_CHANNEL_COUNT = 2, SAW_SAMPLE_RATE = 44100, - VOICE_COUNT = 4, + VOICE_COUNT = 16, PIANOROLL_SIZE = 40 }; @@ -93,7 +93,7 @@ static void saw_audio(ma_device *device, void *void_out_, continue; f64 period = M_PI * 2.; - f64 frequency = pow(2., 6.5 + saw_voice_pitch[n] / 12.); + f64 frequency = pow(2., 7 + saw_voice_pitch[n] / 12.); for (i64 i = 0; i < frame_count; i++) { f64 t = (f64) saw_voice_time[n] / (f64) SAW_SAMPLE_RATE; @@ -117,6 +117,8 @@ static void saw_audio(ma_device *device, void *void_out_, #endif static void saw_init(void) { + sapp_set_window_title("saw"); + #ifdef SOKOL_GLCORE33 saw_nvg = nvgCreateGL3(NVG_ANTIALIAS | NVG_STENCIL_STROKES); #else @@ -188,7 +190,8 @@ static void saw_frame(void) { if (has_cursor) { if (!saw_pianoroll_turned_off[i] && (saw_lbutton_click || - (saw_lbutton_down && saw_pianoroll_last_index != i))) { + (saw_lbutton_down && saw_pianoroll_last_index != i)) && + !saw_voice_on[VOICE_COUNT - 1]) { for (i32 n = VOICE_COUNT - 1; n > 0; --n) { saw_voice_on[n] = saw_voice_on[n - 1]; saw_voice_pitch[n] = saw_voice_pitch[n - 1]; -- cgit v1.2.3