From 22ddbd9d1688aed3220122ac7a513742140ed3b6 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Mon, 15 Jan 2024 16:14:14 +0100 Subject: [WIP] Fix drawing bug on channel params --- src/assets.c | 18 ------------------ src/drawing.c | 18 ++++++++++++------ src/globals.c | 18 ++++++++++++++++++ 3 files changed, 30 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/assets.c b/src/assets.c index be4b87c..2569c9e 100644 --- a/src/assets.c +++ b/src/assets.c @@ -85,24 +85,6 @@ static const u32 note_name_sprites[] = { // Wave data. // -enum WAVES { - WAVE_SIN, - WAVE_SAW, - WAVE_SQUARE, - WAVE_MAX, -}; - -#define WAVE_SIZE 4 -#define WAVE_VARS 4 - -typedef u32 Wave[WAVE_SIZE]; -static Wave wave_active = {0}; -// static Wave wave_target = {0}; -// TODO: wave env status: OFF, ATTACK, DECAY -static int wave_env_ticks = 0; -static int wave_env_attack = 8; -static int wave_env_decay = 8; - static const Wave waves[][WAVE_VARS] = { { {0xefdebc89, 0x98cbedfe, 0x10214376, 0x67341201}, diff --git a/src/drawing.c b/src/drawing.c index f18f094..1458a3b 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -959,6 +959,12 @@ draw_parameters_wave(ChannelWaveParams *params, bool global) { if (params->wave_volume != trig_params->wave_volume) { cols[6] = COL_OFF; } + if (params->wave_attack != trig_params->wave_attack) { + cols[7] = COL_OFF; + } + if (params->wave_decay != trig_params->wave_decay) { + cols[8] = COL_OFF; + } if (params->pan != trig_params->pan) { cols[9] = COL_OFF; } @@ -1027,11 +1033,11 @@ draw_parameters_wave(ChannelWaveParams *params, bool global) { size_t x = PARAMS_START_X + PARAMS_BOX_OFFSET_X * 2 + 3; size_t y = PARAMS_START_Y + PARAMS_BOX_OFFSET_Y + 5; if (params->wave_attack == 0) { - txt_drawf("OFF", x + 3, y, cols[6]); + txt_drawf("OFF", x + 3, y, cols[7]); } else if (params->wave_attack < 10) { - txt_drawf("%d", x + 8, y, cols[6], params->wave_attack); + txt_drawf("%d", x + 8, y, cols[7], params->wave_attack); } else { - txt_drawf("%d", x + 6, y, cols[6], params->wave_attack); + txt_drawf("%d", x + 6, y, cols[7], params->wave_attack); } } @@ -1040,11 +1046,11 @@ draw_parameters_wave(ChannelWaveParams *params, bool global) { size_t x = PARAMS_START_X + PARAMS_BOX_OFFSET_X * 3 + 3; size_t y = PARAMS_START_Y + PARAMS_BOX_OFFSET_Y + 5; if (params->wave_decay == 0) { - txt_drawf("OFF", x + 3, y, cols[6]); + txt_drawf("OFF", x + 3, y, cols[8]); } else if (params->wave_decay < 10) { - txt_drawf("%d", x + 8, y, cols[6], params->wave_decay); + txt_drawf("%d", x + 8, y, cols[8], params->wave_decay); } else { - txt_drawf("%d", x + 6, y, cols[6], params->wave_decay); + txt_drawf("%d", x + 6, y, cols[8], params->wave_decay); } } diff --git a/src/globals.c b/src/globals.c index 05c964a..5063d69 100644 --- a/src/globals.c +++ b/src/globals.c @@ -1,3 +1,15 @@ +enum WAVES { + WAVE_SIN, + WAVE_SAW, + WAVE_SQUARE, + WAVE_MAX, +}; + +#define WAVE_SIZE 4 +#define WAVE_VARS 4 + +typedef u32 Wave[WAVE_SIZE]; + // // Globals. // @@ -209,3 +221,9 @@ bool redraw_scale = true; bool update_bpm = false; u8 bar_counter = 0; +static Wave wave_active = {0}; +// static Wave wave_target = {0}; +// TODO: wave env status: OFF, ATTACK, DECAY +static int wave_env_ticks = 0; +static int wave_env_attack = 8; +static int wave_env_decay = 8; -- cgit v1.2.1