From 19f95f6f9779a053a055eb0f0386232888a46057 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sat, 10 Mar 2018 03:09:21 -0500 Subject: [PATCH] Add MIDI-TRIG panel, add sysex, time, and sense flags to MidiInput --- include/midi.hpp | 4 + res/Core/MIDITriggerToCVInterface.svg | 391 ++++++++++++++++++++++++++ src/Core/MIDIToCVInterface.cpp | 3 + src/Core/MIDITriggerToCVInterface.cpp | 2 +- src/midi.cpp | 1 + 5 files changed, 400 insertions(+), 1 deletion(-) create mode 100644 res/Core/MIDITriggerToCVInterface.svg diff --git a/include/midi.hpp b/include/midi.hpp index 10c36627..c5602599 100644 --- a/include/midi.hpp +++ b/include/midi.hpp @@ -61,6 +61,10 @@ struct MidiIO { struct MidiInput : MidiIO { RtMidiIn *rtMidiIn = NULL; + /** These flags must be set before the driver and device is set */ + bool enableSysEx = false; + bool enableTime = false; + bool enableSense = false; MidiInput(); void setDriver(int driver) override; virtual void onMessage(const MidiMessage &message) {} diff --git a/res/Core/MIDITriggerToCVInterface.svg b/res/Core/MIDITriggerToCVInterface.svg new file mode 100644 index 00000000..ec8d6f46 --- /dev/null +++ b/res/Core/MIDITriggerToCVInterface.svg @@ -0,0 +1,391 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Core/MIDIToCVInterface.cpp b/src/Core/MIDIToCVInterface.cpp index ec83ba79..8ac7447d 100644 --- a/src/Core/MIDIToCVInterface.cpp +++ b/src/Core/MIDIToCVInterface.cpp @@ -51,6 +51,7 @@ struct MIDIToCVInterface : Module { bool gate; MIDIToCVInterface() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) { + midiInput.enableTime = true; onReset(); } @@ -115,6 +116,8 @@ struct MIDIToCVInterface : Module { } void processMessage(MidiMessage msg) { + debug("MIDI: %01x %01x %02x %02x", msg.status(), msg.channel(), msg.data1, msg.data2); + switch (msg.status()) { // note off case 0x8: { diff --git a/src/Core/MIDITriggerToCVInterface.cpp b/src/Core/MIDITriggerToCVInterface.cpp index 54eef226..b2a37b91 100644 --- a/src/Core/MIDITriggerToCVInterface.cpp +++ b/src/Core/MIDITriggerToCVInterface.cpp @@ -107,7 +107,7 @@ struct MIDITriggerToCVInterface : Module { struct MIDITriggerToCVInterfaceWidget : ModuleWidget { MIDITriggerToCVInterfaceWidget(MIDITriggerToCVInterface *module) : ModuleWidget(module) { - setPanel(SVG::load(assetGlobal("res/Core/MIDICCToCVInterface.svg"))); + setPanel(SVG::load(assetGlobal("res/Core/MIDITriggerToCVInterface.svg"))); addChild(Widget::create(Vec(RACK_GRID_WIDTH, 0))); addChild(Widget::create(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); diff --git a/src/midi.cpp b/src/midi.cpp index 1f32fe51..6cb96b9f 100644 --- a/src/midi.cpp +++ b/src/midi.cpp @@ -157,6 +157,7 @@ void MidiInput::setDriver(int driver) { if (driver >= 0) { rtMidiIn = new RtMidiIn((RtMidi::Api) driver); rtMidiIn->setCallback(midiInputCallback, this); + rtMidiIn->ignoreTypes(enableSysEx, enableTime, enableSense); rtMidi = rtMidiIn; this->driver = rtMidiIn->getCurrentApi(); }