From 837b515860c95bf3e18c837cfaeaf1005d520d31 Mon Sep 17 00:00:00 2001 From: Tim Stirrat Date: Wed, 25 Sep 2024 18:02:49 +1000 Subject: [PATCH] swap order of operation, retrigger before vol --- Source/synth/wav.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Source/synth/wav.c b/Source/synth/wav.c index 39f4430..abf8d07 100644 --- a/Source/synth/wav.c +++ b/Source/synth/wav.c @@ -147,6 +147,11 @@ void playNoteWav(void) { // Note on noteStatus[WAV].note = noteIndex; + rAUD3HIGH = AUDHIGH_RESTART; // retrigger + + rAUD3LOW = wavCurrentFreq; + rAUD3HIGH = wavCurrentFreq >> 8U; + // channel volume louder = smaller value: const uint8_t noteVelocity = valueByte & AUD3LEVEL_MASK; if (noteVelocity == 0x60) { @@ -156,12 +161,6 @@ void playNoteWav(void) { } else { rAUD3LEVEL = AUD3LEVEL_25; } - - // rAUD3HIGH = 0x00; // was in ASM, probably not needed? - - rAUD3LOW = wavCurrentFreq; - rAUD3HIGH = wavCurrentFreq >> 8U; - // Reset various counters and flags vibratoPosition[WAV] = 0; wavStepCounter = 0;