@@ -42,7 +42,7 @@ struct MidiIO { | |||||
/** Cached */ | /** Cached */ | ||||
std::string deviceName; | std::string deviceName; | ||||
virtual ~MidiIO(); | |||||
virtual ~MidiIO() {} | |||||
std::vector<int> getDrivers(); | std::vector<int> getDrivers(); | ||||
std::string getDriverName(int driver); | std::string getDriverName(int driver); | ||||
virtual void setDriver(int driver) {} | virtual void setDriver(int driver) {} | ||||
@@ -61,11 +61,8 @@ struct MidiIO { | |||||
struct MidiInput : MidiIO { | struct MidiInput : MidiIO { | ||||
RtMidiIn *rtMidiIn = NULL; | 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(); | MidiInput(); | ||||
~MidiInput(); | |||||
void setDriver(int driver) override; | void setDriver(int driver) override; | ||||
virtual void onMessage(const MidiMessage &message) {} | virtual void onMessage(const MidiMessage &message) {} | ||||
}; | }; | ||||
@@ -83,6 +80,7 @@ struct MidiInputQueue : MidiInput { | |||||
struct MidiOutput : MidiIO { | struct MidiOutput : MidiIO { | ||||
RtMidiOut *rtMidiOut = NULL; | RtMidiOut *rtMidiOut = NULL; | ||||
MidiOutput(); | MidiOutput(); | ||||
~MidiOutput(); | |||||
void setDriver(int driver) override; | void setDriver(int driver) override; | ||||
}; | }; | ||||
@@ -56,7 +56,6 @@ struct MIDIToCVInterface : Module { | |||||
bool gate; | bool gate; | ||||
MIDIToCVInterface() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) { | MIDIToCVInterface() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) { | ||||
midiInput.enableTime = true; | |||||
onReset(); | onReset(); | ||||
} | } | ||||
@@ -12,10 +12,6 @@ namespace rack { | |||||
// MidiIO | // MidiIO | ||||
//////////////////// | //////////////////// | ||||
MidiIO::~MidiIO() { | |||||
setDriver(-1); | |||||
} | |||||
std::vector<int> MidiIO::getDrivers() { | std::vector<int> MidiIO::getDrivers() { | ||||
std::vector<RtMidi::Api> rtApis; | std::vector<RtMidi::Api> rtApis; | ||||
RtMidi::getCompiledApi(rtApis); | RtMidi::getCompiledApi(rtApis); | ||||
@@ -149,6 +145,10 @@ MidiInput::MidiInput() { | |||||
setDriver(RtMidi::UNSPECIFIED); | setDriver(RtMidi::UNSPECIFIED); | ||||
} | } | ||||
MidiInput::~MidiInput() { | |||||
setDriver(-1); | |||||
} | |||||
void MidiInput::setDriver(int driver) { | void MidiInput::setDriver(int driver) { | ||||
setDevice(-1); | setDevice(-1); | ||||
if (rtMidiIn) { | if (rtMidiIn) { | ||||
@@ -159,7 +159,7 @@ void MidiInput::setDriver(int driver) { | |||||
if (driver >= 0) { | if (driver >= 0) { | ||||
rtMidiIn = new RtMidiIn((RtMidi::Api) driver); | rtMidiIn = new RtMidiIn((RtMidi::Api) driver); | ||||
rtMidiIn->setCallback(midiInputCallback, this); | rtMidiIn->setCallback(midiInputCallback, this); | ||||
rtMidiIn->ignoreTypes(!enableSysEx, !enableTime, !enableSense); | |||||
rtMidiIn->ignoreTypes(false, false, false); | |||||
rtMidi = rtMidiIn; | rtMidi = rtMidiIn; | ||||
this->driver = rtMidiIn->getCurrentApi(); | this->driver = rtMidiIn->getCurrentApi(); | ||||
} | } | ||||
@@ -189,6 +189,10 @@ MidiOutput::MidiOutput() { | |||||
setDriver(RtMidi::UNSPECIFIED); | setDriver(RtMidi::UNSPECIFIED); | ||||
} | } | ||||
MidiOutput::~MidiOutput() { | |||||
setDriver(-1); | |||||
} | |||||
void MidiOutput::setDriver(int driver) { | void MidiOutput::setDriver(int driver) { | ||||
setDevice(-1); | setDevice(-1); | ||||
if (rtMidiOut) { | if (rtMidiOut) { | ||||