| 295 | } |
| 296 | |
| 297 | midi::InputDevice* subscribeInput(int deviceId, midi::Input* input) override { |
| 298 | if (!(0 <= deviceId && deviceId < (int) rtMidiIn->getPortCount())) |
| 299 | return NULL; |
| 300 | RtMidiInputDevice* device = get(inputDevices, deviceId, NULL); |
| 301 | if (!device) { |
| 302 | try { |
| 303 | inputDevices[deviceId] = device = new RtMidiInputDevice(driverId, deviceId); |
| 304 | } |
| 305 | catch (RtMidiError& e) { |
| 306 | throw Exception("Failed to create RtMidi input device: %s", e.what()); |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | device->subscribe(input); |
| 311 | return device; |
| 312 | } |
| 313 | |
| 314 | void unsubscribeInput(int deviceId, midi::Input* input) override { |
| 315 | auto it = inputDevices.find(deviceId); |