Skip to content

Commit

Permalink
swap order of operation, retrigger before vol
Browse files Browse the repository at this point in the history
  • Loading branch information
tstirrat committed Sep 25, 2024
1 parent b810419 commit 837b515
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Source/synth/wav.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down

0 comments on commit 837b515

Please sign in to comment.