Skip to content

Commit 49dbced

Browse files
committed
Note latch drop aftertouch
1 parent 429aa98 commit 49dbced

1 file changed

Lines changed: 1 addition & 28 deletions

File tree

Applications/Note/NoteLatch.cpp

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void NoteLatch::Tick(deque<MidiPacket>& input, deque<MidiPacket>& output) {
2424
if (packet.status == NoteOn || packet.status == NoteOff) {
2525
toggleMode ? ProcessNoteMessageToggleMode(packet, output) : ProcessNoteMessage(packet, output);
2626
} else if (packet.status == AfterTouch) {
27-
toggleMode ? ProcessAfterTouchToggleMode(packet, output) : ProcessAfterTouch(packet, output);
27+
// Drop aftertouch packet
2828
}
2929
else
3030
{
@@ -89,23 +89,6 @@ void NoteLatch::ProcessNoteMessage(const MidiPacket& packet, deque<MidiPacket>&
8989
}
9090
}
9191

92-
void NoteLatch::ProcessAfterTouch(const MidiPacket& packet, deque<MidiPacket>& output) {
93-
uint8_t note = packet.Note();
94-
95-
// Check if this aftertouch is from the first still holding note
96-
if (!stillHoldingNotes.empty() && stillHoldingNotes[0] == note) {
97-
// Mirror this aftertouch to all latched notes
98-
for (uint8_t latchedNote : latchedNotes) {
99-
MidiPacket mirroredAfterTouch = MidiPacket::AfterTouch(
100-
packet.Channel(), // Use same channel as input
101-
latchedNote,
102-
packet.data[2] // pressure value
103-
);
104-
output.push_back(mirroredAfterTouch);
105-
}
106-
}
107-
}
108-
10992
void NoteLatch::ProcessNoteMessageToggleMode(const MidiPacket& packet, deque<MidiPacket>& output) {
11093
uint8_t note = packet.Note();
11194

@@ -129,16 +112,6 @@ void NoteLatch::ProcessNoteMessageToggleMode(const MidiPacket& packet, deque<Mid
129112
}
130113
}
131114

132-
void NoteLatch::ProcessAfterTouchToggleMode(const MidiPacket& packet, deque<MidiPacket>& output) {
133-
uint8_t note = packet.Note();
134-
135-
// Only pass through aftertouch if note is in latched list
136-
auto latchedIt = std::find(latchedNotes.begin(), latchedNotes.end(), note);
137-
if (latchedIt != latchedNotes.end()) {
138-
output.push_back(packet);
139-
}
140-
}
141-
142115
void NoteLatch::ReleaseAllLatchedNotes(deque<MidiPacket>& output) {
143116
// Send note off for all latched notes
144117
for (uint8_t note : latchedNotes) {

0 commit comments

Comments
 (0)