summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-09-25 23:37:48 +0200
committerMitya Selivanov <automainint@guattari.tech>2023-09-25 23:37:48 +0200
commitbaf492d2a83533114275b1f8f3576c94bb3e5bc0 (patch)
tree3cb3c65e9854022d1d497f45b3cb083957afcee0
parent234110ad800da983608cad7eaa79d54e9416503c (diff)
downloadsaw-baf492d2a83533114275b1f8f3576c94bb3e5bc0.zip
pianoroll update
-rw-r--r--source/saw/main.c9
1 files 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];