diff --git a/linnstrument-firmware.ino b/linnstrument-firmware.ino index 6d8a2df0..2c7eb966 100644 --- a/linnstrument-firmware.ino +++ b/linnstrument-firmware.ino @@ -1058,7 +1058,9 @@ unsigned short clock24PPQ = 0; // the current clock in 24PP short restrictedRow = -1; // temporarily restrict touches to a particular row -byte guitarTuningRowNum = 0; // active tow number for configuring the guitar tuning +byte guitarTuningRowNum = 0; // active row number for configuring the guitar tuning +short guitarTuningPreviewNote = -1; // active note that is previewing the guitar tuning pitch +short guitarTuningPreviewChannel = -1; // active channel that is previewing the guitar tuning pitch /************************* FUNCTION DECLARATIONS TO WORK AROUND COMPILER *************************/ diff --git a/ls_settings.ino b/ls_settings.ino index 2558769e..5b359b94 100644 --- a/ls_settings.ino +++ b/ls_settings.ino @@ -2049,6 +2049,16 @@ void handleRowOffsetRelease() { handleNumericDataReleaseCol(false); } +void ensureGuitarTuningPreviewNoteRelease() { + if (guitarTuningPreviewNote != -1 && + guitarTuningPreviewChannel != -1) { + midiSendNoteOff(Global.currentPerSplit, guitarTuningPreviewNote, guitarTuningPreviewChannel); + releaseChannel(Global.currentPerSplit, guitarTuningPreviewChannel); + guitarTuningPreviewNote = -1; + guitarTuningPreviewChannel = -1; + } +} + void handleGuitarTuningNewTouch() { if (sensorCol == 1) { guitarTuningRowNum = sensorRow; @@ -2057,10 +2067,18 @@ void handleGuitarTuningNewTouch() { else { handleNumericDataNewTouchCol(Global.guitarTuning[guitarTuningRowNum], 0, 127, true); } + + ensureGuitarTuningPreviewNoteRelease(); + guitarTuningPreviewNote = Global.guitarTuning[guitarTuningRowNum]; + guitarTuningPreviewChannel = takeChannel(Global.currentPerSplit, sensorRow); + midiSendNoteOn(Global.currentPerSplit, guitarTuningPreviewNote, 96, guitarTuningPreviewChannel); } void handleGuitarTuningRelease() { handleNumericDataReleaseCol(true); + if (cellsTouched == 0) { + ensureGuitarTuningPreviewNoteRelease(); + } } void handleMinUSBMIDIIntervalNewTouch() {