Skip to content

Commit

Permalink
fix sending control messages after pitch shifting
Browse files Browse the repository at this point in the history
  • Loading branch information
Heel committed Oct 5, 2023
1 parent 15496c3 commit ab006bb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion keyboardmania-midi-bridge/keyboardmania-midi-bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,11 @@ int main_loop(bool verbose)

for (auto& mapping : NOTE_MAPPINGS) {
uint32_t mask = mapping.first;
uint8_t midiNote = mapping.second + pitch_shift * 12;
uint8_t midiNote = mapping.second;
uint8_t msg_type = mapping.second < 5 ? 0xB0 : 0x90; // send control messages for buttons, notes for keys
if (msg_type == 0x90) {
midiNote += pitch_shift.load() * 12;
}
// Note-on event
if ((state & mask) && !(prevState & mask)) {
std::vector<uint8_t> message = { msg_type, midiNote, 64 }; // channel 1, note-on with velocity 64
Expand Down

0 comments on commit ab006bb

Please sign in to comment.