]> git.sesse.net Git - nageru/blobdiff - shared/midi_device.cpp
Support pitch bend as a virtual MIDI controller.
[nageru] / shared / midi_device.cpp
index 822beaeadbd4d95b3a03fe294c3da069603953e5..ac0fea271d12d8837d3f53a3fe67d3eed22819c2 100644 (file)
@@ -160,6 +160,11 @@ void MIDIDevice::handle_event(snd_seq_t *seq, snd_seq_event_t *event)
                receiver->controller_received(event->data.control.param, event->data.control.value);
                break;
        }
+       case SND_SEQ_EVENT_PITCHBEND: {
+               // Note, -8192 to 8191 instead of 0 to 127.
+               receiver->controller_received(MIDIReceiver::PITCH_BEND_CONTROLLER, event->data.control.value);
+               break;
+       }
        case SND_SEQ_EVENT_NOTEON: {
                receiver->note_on_received(event->data.note.note);
                break;
@@ -245,7 +250,7 @@ void MIDIDevice::update_lights_lock_held(const set<unsigned> &active_lights)
        }
 
        unsigned num_events = 0;
-       for (unsigned note_num = 1; note_num <= 127; ++note_num) {
+       for (unsigned note_num = 1; note_num <= 127; ++note_num) {  // Note: Pitch bend is ignored.
                bool active = active_lights.count(note_num);
                if (current_light_status.count(note_num) &&
                    current_light_status[note_num] == active) {