Browse Source

MIDI and RtMidi driver fixes

tags/v0.6.1
Andrew Belt 6 years ago
parent
commit
f6ed130762
3 changed files with 10 additions and 2 deletions
  1. +1
    -0
      include/midi.hpp
  2. +8
    -2
      src/midi.cpp
  3. +1
    -0
      src/rtmidi.cpp

+ 1
- 0
include/midi.hpp View File

@@ -102,6 +102,7 @@ struct MidiIO {


struct MidiInput : MidiIO {
MidiInput();
~MidiInput();

std::vector<int> getDeviceIds() override;


+ 8
- 2
src/midi.cpp View File

@@ -118,6 +118,12 @@ void MidiIO::fromJson(json_t *rootJ) {
// MidiInput
////////////////////

MidiInput::MidiInput() {
if (driverIds.size() >= 1) {
setDriverId(driverIds[0]);
}
}

MidiInput::~MidiInput() {
setDriverId(-1);
}
@@ -138,8 +144,8 @@ std::string MidiInput::getDeviceName(int deviceId) {

void MidiInput::setDeviceId(int deviceId) {
// Destroy device
if (driver && deviceId >= 0) {
driver->unsubscribeInputDevice(deviceId, this);
if (driver && this->deviceId >= 0) {
driver->unsubscribeInputDevice(this->deviceId, this);
}
this->deviceId = -1;



+ 1
- 0
src/rtmidi.cpp View File

@@ -27,6 +27,7 @@ RtMidiInputDevice::RtMidiInputDevice(int driverId, int deviceId) {
assert(rtMidiIn);
rtMidiIn->ignoreTypes(false, false, false);
rtMidiIn->setCallback(midiInputCallback, this);
rtMidiIn->openPort(deviceId, "VCV Rack input");
}

RtMidiInputDevice::~RtMidiInputDevice() {


Loading…
Cancel
Save