aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2024-01-16 11:13:12 +0100
committerBad Diode <bd@badd10de.dev>2024-01-16 11:13:12 +0100
commit505b77cf2b955d01016707bd216cca1dae174c36 (patch)
tree4039583cef67b5873626823b8e3b55ed63a914d3
parent8c33aeda7cd65a5797930340c2728a9464e98b9f (diff)
downloadstepper-505b77cf2b955d01016707bd216cca1dae174c36.tar.gz
stepper-505b77cf2b955d01016707bd216cca1dae174c36.zip
Add Attack/Decay envelope to CH3
-rw-r--r--Makefile2
-rw-r--r--src/drawing.c12
-rw-r--r--src/main.c7
-rw-r--r--src/sequencer.c14
4 files changed, 30 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index d7c0b05..816b819 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ INC_FLAGS := $(addprefix -I,$(INC_DIRS))
27INC_FLAGS += -I$(LIBGBA_SRC) 27INC_FLAGS += -I$(LIBGBA_SRC)
28 28
29# Output library names and executables. 29# Output library names and executables.
30TARGET := STEPPER-v1.8-dev-16 30TARGET := STEPPER-v1.8-dev-18
31ELF := $(BUILD_DIR)/$(TARGET).elf 31ELF := $(BUILD_DIR)/$(TARGET).elf
32BIN := $(BUILD_DIR)/$(TARGET).gba 32BIN := $(BUILD_DIR)/$(TARGET).gba
33 33
diff --git a/src/drawing.c b/src/drawing.c
index 1458a3b..a485ec4 100644
--- a/src/drawing.c
+++ b/src/drawing.c
@@ -1030,6 +1030,9 @@ draw_parameters_wave(ChannelWaveParams *params, bool global) {
1030 1030
1031 // Attack. 1031 // Attack.
1032 { 1032 {
1033 if (params->wave_mode == 2) {
1034 cols[7] = COL_OFF;
1035 }
1033 size_t x = PARAMS_START_X + PARAMS_BOX_OFFSET_X * 2 + 3; 1036 size_t x = PARAMS_START_X + PARAMS_BOX_OFFSET_X * 2 + 3;
1034 size_t y = PARAMS_START_Y + PARAMS_BOX_OFFSET_Y + 5; 1037 size_t y = PARAMS_START_Y + PARAMS_BOX_OFFSET_Y + 5;
1035 if (params->wave_attack == 0) { 1038 if (params->wave_attack == 0) {
@@ -1043,6 +1046,9 @@ draw_parameters_wave(ChannelWaveParams *params, bool global) {
1043 1046
1044 // Decay. 1047 // Decay.
1045 { 1048 {
1049 if (params->wave_mode == 2) {
1050 cols[8] = COL_OFF;
1051 }
1046 size_t x = PARAMS_START_X + PARAMS_BOX_OFFSET_X * 3 + 3; 1052 size_t x = PARAMS_START_X + PARAMS_BOX_OFFSET_X * 3 + 3;
1047 size_t y = PARAMS_START_Y + PARAMS_BOX_OFFSET_Y + 5; 1053 size_t y = PARAMS_START_Y + PARAMS_BOX_OFFSET_Y + 5;
1048 if (params->wave_decay == 0) { 1054 if (params->wave_decay == 0) {
@@ -1969,6 +1975,12 @@ draw_notif_bar() {
1969 case 4: { txt_drawf_small("100", x0 + 2 + 8 * 4, y0 + 1, color); txt_drawc_small('%', x0 + 2 + 11 * 4, y0 + 1, color); } break; 1975 case 4: { txt_drawf_small("100", x0 + 2 + 8 * 4, y0 + 1, color); txt_drawc_small('%', x0 + 2 + 11 * 4, y0 + 1, color); } break;
1970 } 1976 }
1971 } break; 1977 } break;
1978 case 7: {
1979 txt_drawf_small("ATTACK: %d", x0 + 2, y0 + 1, color, params->wave_attack);
1980 } break;
1981 case 8: {
1982 txt_drawf_small("DECAY: %d", x0 + 2, y0 + 1, color, params->wave_decay);
1983 } break;
1972 case 9: { draw_notif_param_edit_pan(params->pan, x0, y0, color); } break; 1984 case 9: { draw_notif_param_edit_pan(params->pan, x0, y0, color); } break;
1973 } 1985 }
1974 return; 1986 return;
diff --git a/src/main.c b/src/main.c
index a068bc8..2731b6a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -29,15 +29,16 @@ WITH REGARD TO THIS SOFTWARE.
29// to key release to enable trigs. 29// to key release to enable trigs.
30// + Fix bug with not being able to stop the sound when synced 30// + Fix bug with not being able to stop the sound when synced
31// + Add attack and decay envelope for ch3 (synced to tempo) 31// + Add attack and decay envelope for ch3 (synced to tempo)
32// + Fix A+B on ch3
33// + Make sure Attack/Decay are grey for A+B
34// + Add help for attack/decay on ch3
32// - Fix any bugs we currently have 35// - Fix any bugs we currently have
33// - Add clipboard sharing between banks. 36// - Add clipboard sharing between banks.
34// - Make sure transposing a sequence past the keyboard limit doesn't affect 37// - Make sure transposing a sequence past the keyboard limit doesn't affect
35// the sequence and can be reversed. 38// the sequence and can be reversed.
36// - Study saving overhauls for bootleg cartridges. 39// - Study saving overhauls for bootleg cartridges.
37// - When putting a new trigger, make sure it uses the global parameters 40// - When putting a new trigger, make sure it uses the global parameters
38// - Bad performance when selecting patterns 41// - Bad performance when selecting patterns?
39// - Add help for attack/decay on ch3
40// - Fix A+B on ch3
41// 42//
42// Low priority: 43// Low priority:
43// 44//
diff --git a/src/sequencer.c b/src/sequencer.c
index 66f1d24..f8b4a58 100644
--- a/src/sequencer.c
+++ b/src/sequencer.c
@@ -250,6 +250,7 @@ play_step(void) {
250 wave_env = WAV_ENV_OFF; 250 wave_env = WAV_ENV_OFF;
251 SOUND_WAVE_MODE |= SOUND_WAVE_ENABLE; 251 SOUND_WAVE_MODE |= SOUND_WAVE_ENABLE;
252 SOUND_WAVE_FREQ = SOUND_FREQ_RESET | sound_rates[trig->note]; 252 SOUND_WAVE_FREQ = SOUND_FREQ_RESET | sound_rates[trig->note];
253 wave_env_ticks = 0;
253 } break; 254 } break;
254 } 255 }
255 wave_freq = sound_rates[trig->note]; 256 wave_freq = sound_rates[trig->note];
@@ -371,6 +372,8 @@ env_start:
371 if (wave_env_attack == 0) { 372 if (wave_env_attack == 0) {
372 memcpy32(SOUND_WAVE_RAM, wave_target, 16); 373 memcpy32(SOUND_WAVE_RAM, wave_target, 16);
373 SOUND_WAVE_MODE ^= SOUND_WAVE_BANK_SELECT(1); 374 SOUND_WAVE_MODE ^= SOUND_WAVE_BANK_SELECT(1);
375 memcpy32(SOUND_WAVE_RAM, wave_target, 16);
376 SOUND_WAVE_MODE ^= SOUND_WAVE_BANK_SELECT(1);
374 } else { 377 } else {
375 wave_env = WAV_ENV_ATTACK; 378 wave_env = WAV_ENV_ATTACK;
376 goto env_start; 379 goto env_start;
@@ -399,9 +402,9 @@ env_start:
399 if (wave_env_decay == 0) { 402 if (wave_env_decay == 0) {
400 wave_env = WAV_ENV_OFF; 403 wave_env = WAV_ENV_OFF;
401 } else { 404 } else {
402 wave_env_prog = 0;
403 wave_env = WAV_ENV_DECAY; 405 wave_env = WAV_ENV_DECAY;
404 } 406 }
407 wave_env_prog = 0;
405 } 408 }
406 for (size_t j = 0; j < 4; j++) { 409 for (size_t j = 0; j < 4; j++) {
407 u32 next = 0; 410 u32 next = 0;
@@ -451,6 +454,7 @@ env_start:
451 int power = powers[wave_env_prog]; 454 int power = powers[wave_env_prog];
452 if (++wave_env_prog >= 8) { 455 if (++wave_env_prog >= 8) {
453 wave_env = WAV_ENV_END; 456 wave_env = WAV_ENV_END;
457 wave_env_prog = 0;
454 } 458 }
455 for (size_t j = 0; j < 4; j++) { 459 for (size_t j = 0; j < 4; j++) {
456 u32 next = 0; 460 u32 next = 0;
@@ -491,12 +495,20 @@ env_start:
491 SOUND_WAVE_FREQ = SOUND_FREQ_RESET; 495 SOUND_WAVE_FREQ = SOUND_FREQ_RESET;
492 SOUND_WAVE_CTRL = SOUND_WAVE_MUTE; 496 SOUND_WAVE_CTRL = SOUND_WAVE_MUTE;
493 wave_env = WAV_ENV_END; 497 wave_env = WAV_ENV_END;
498 SOUND_WAVE_MODE = SOUND_WAVE_BANK_SELECT(0);
499 memcpy32(SOUND_WAVE_RAM, wave_zero, 16);
500 SOUND_WAVE_MODE = SOUND_WAVE_BANK_SELECT(1);
501 memcpy32(SOUND_WAVE_RAM, wave_zero, 16);
494 } 502 }
495 return; 503 return;
496 } break; 504 } break;
497 case WAV_ENV_END: { 505 case WAV_ENV_END: {
498 SOUND_WAVE_FREQ = SOUND_FREQ_RESET; 506 SOUND_WAVE_FREQ = SOUND_FREQ_RESET;
499 SOUND_WAVE_CTRL = SOUND_WAVE_MUTE; 507 SOUND_WAVE_CTRL = SOUND_WAVE_MUTE;
508 SOUND_WAVE_MODE = SOUND_WAVE_BANK_SELECT(0);
509 memcpy32(SOUND_WAVE_RAM, wave_zero, 16);
510 SOUND_WAVE_MODE = SOUND_WAVE_BANK_SELECT(1);
511 memcpy32(SOUND_WAVE_RAM, wave_zero, 16);
500 return; 512 return;
501 } break; 513 } break;
502 } 514 }