Browse Source

Reorder driverIds, re-enable Bridge

tags/v0.6.1
Andrew Belt 6 years ago
parent
commit
67923962e9
2 changed files with 18 additions and 8 deletions
  1. +7
    -0
      src/app/MidiWidget.cpp
  2. +11
    -8
      src/midi.cpp

+ 7
- 0
src/app/MidiWidget.cpp View File

@@ -29,6 +29,13 @@ struct MidiDriverChoice : LedDisplayChoice {
}
void step() override {
text = midiWidget->midiIO->getDriverName(midiWidget->midiIO->driverId);
if (text.empty()) {
text = "(No driver)";
color.a = 0.5f;
}
else {
color.a = 1.f;
}
}
};



+ 11
- 8
src/midi.cpp View File

@@ -8,6 +8,7 @@
namespace rack {


static std::vector<int> driverIds;
static std::map<int, MidiDriver*> drivers;


@@ -47,10 +48,6 @@ MidiIO::~MidiIO() {
}

std::vector<int> MidiIO::getDriverIds() {
std::vector<int> driverIds;
for (auto pair : drivers) {
driverIds.push_back(pair.first);
}
return driverIds;
}

@@ -195,13 +192,19 @@ void MidiOutput::setDeviceId(int deviceId) {
// midi
////////////////////

static void midiAddDriver(int driverId, MidiDriver *driver) {
assert(driver);
driverIds.push_back(driverId);
drivers[driverId] = driver;
}

void midiInit() {
for (int driverId : rtmidiGetDrivers()) {
drivers[driverId] = rtmidiCreateDriver(driverId);
midiAddDriver(driverId, rtmidiCreateDriver(driverId));
}
// drivers[BRIDGE_DRIVER] = bridgeCreateDriver();
drivers[GAMEPAD_DRIVER] = gamepadGetDriver();
drivers[KEYBOARD_DRIVER] = keyboardGetDriver();
midiAddDriver(BRIDGE_DRIVER, bridgeGetMidiDriver());
midiAddDriver(KEYBOARD_DRIVER, keyboardGetDriver());
midiAddDriver(GAMEPAD_DRIVER, gamepadGetDriver());
}




Loading…
Cancel
Save