aboutsummaryrefslogtreecommitdiffstats
path: root/src/globals.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2024-01-16 09:31:31 +0100
committerBad Diode <bd@badd10de.dev>2024-01-16 09:31:31 +0100
commit77374dacdee448b9dea733c0e444da07942b3238 (patch)
tree1fcb19f8e81c59a8ff5a48205b19a7eff052f0fe /src/globals.c
parent22ddbd9d1688aed3220122ac7a513742140ed3b6 (diff)
downloadstepper-77374dacdee448b9dea733c0e444da07942b3238.tar.gz
stepper-77374dacdee448b9dea733c0e444da07942b3238.zip
[WIP] Refactor ch3 envelope
Diffstat (limited to 'src/globals.c')
-rw-r--r--src/globals.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/globals.c b/src/globals.c
index 5063d69..c040585 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -1,15 +1,3 @@
1enum WAVES {
2 WAVE_SIN,
3 WAVE_SAW,
4 WAVE_SQUARE,
5 WAVE_MAX,
6};
7
8#define WAVE_SIZE 4
9#define WAVE_VARS 4
10
11typedef u32 Wave[WAVE_SIZE];
12
13// 1//
14// Globals. 2// Globals.
15// 3//
@@ -221,9 +209,30 @@ bool redraw_scale = true;
221bool update_bpm = false; 209bool update_bpm = false;
222u8 bar_counter = 0; 210u8 bar_counter = 0;
223 211
224static Wave wave_active = {0}; 212typedef enum WaveEnv {
225// static Wave wave_target = {0}; 213 WAV_ENV_START,
226// TODO: wave env status: OFF, ATTACK, DECAY 214 WAV_ENV_ATTACK,
215 WAV_ENV_DECAY,
216 WAV_ENV_END,
217 WAV_ENV_OFF,
218} WaveEnv;
219
220enum WAVES {
221 WAVE_SIN,
222 WAVE_SAW,
223 WAVE_SQUARE,
224 WAVE_MAX,
225};
226
227#define WAVE_SIZE 4
228#define WAVE_VARS 4
229
230typedef u32 Wave[WAVE_SIZE];
231
232static WaveEnv wave_env = WAV_ENV_OFF;
233static const Wave *wave_target;
234static u32 wave_freq;
227static int wave_env_ticks = 0; 235static int wave_env_ticks = 0;
228static int wave_env_attack = 8; 236static int wave_env_attack = 8;
229static int wave_env_decay = 8; 237static int wave_env_decay = 8;
238static int wave_env_prog = 0;