Skip to content

Commit

Permalink
Added MIDI note preview of custom guitar tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
gbevin committed Jul 15, 2018
1 parent afd1848 commit da8e953
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 3 additions & 1 deletion linnstrument-firmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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 *************************/

Expand Down
18 changes: 18 additions & 0 deletions ls_settings.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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() {
Expand Down

0 comments on commit da8e953

Please sign in to comment.