From c5d1c1cded10ce7d02315df6ae4e5425640350d0 Mon Sep 17 00:00:00 2001 From: Oleksiy Date: Mon, 21 Aug 2023 22:28:48 +0300 Subject: [PATCH] Pattern modulation limited to the bank --- Software/Gravity/Gravity.ino | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Software/Gravity/Gravity.ino b/Software/Gravity/Gravity.ino index f7f4727..547fb5b 100644 --- a/Software/Gravity/Gravity.ino +++ b/Software/Gravity/Gravity.ino @@ -284,14 +284,24 @@ void sendTriggers() { for (byte i = 0; i < 6; i++) { //pattern modulation - //todo: limit modulation within the current bank (a or b) int seqMod = 0; + byte seqPattern; if (channels[i].CV2Target == 3) { seqMod = map(a2Input, 0, 1023, -8, 8); } else if (channels[i].CV1Target == 3) { seqMod = map(a1Input, 0, 1023, -8, 8); } - byte seqPattern = channels[i].seqPattern + seqMod; + if (channels[i].seqPattern < 8 && channels[i].seqPattern + seqMod >= 8) { + seqPattern = 7; + } else if (channels[i].seqPattern < 8 && channels[i].seqPattern + seqMod < 0) { + seqPattern = 0; + } else if (channels[i].seqPattern >= 8 && channels[i].seqPattern + seqMod < 8) { + seqPattern = 8; + } else if (channels[i].seqPattern >= 8 && channels[i].seqPattern + seqMod >= 16) { + seqPattern = 15; + } else { + seqPattern = channels[i].seqPattern + seqMod; + } if (seqPattern == 0) { currentSeq = seqA1;