From 9ce26424a9c4b9ae8e9d59067a125634ab1714eb Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Sat, 23 Dec 2023 14:32:05 +1100 Subject: [PATCH] Lord help me I am passing variables by reference --- Xmas/Xmas.ino | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Xmas/Xmas.ino b/Xmas/Xmas.ino index 0dcbba4..52a0bd8 100644 --- a/Xmas/Xmas.ino +++ b/Xmas/Xmas.ino @@ -72,13 +72,12 @@ void setup(void) { void loop() { long now = millis(); runSequencer(seq1, now); - Serial.println(seq1.noteOn); } -void runSequencer(sequencer seq, long now) { +void runSequencer(sequencer& seq, long now) { if( seq.noteOn ) { if( now - seq.last > seq.rel ) { - Serial.println("off"); + Serial.println("noteOff"); noteOff(seq); seq.last = now; seq.play = round(beat_m * seq.duration[seq.s] * (1.0 - gate)); @@ -90,9 +89,11 @@ void runSequencer(sequencer seq, long now) { } } else { if( now - seq.last > seq.play ) { + Serial.println("noteOn"); noteOn(seq, seq.melody[seq.s]); seq.last = now; seq.rel = round(beat_m * seq.duration[seq.s] * gate); + Serial.println(seq.rel); seq.noteOn = true; } }