| 441 | } |
| 442 | |
| 443 | void Output::sendMessage(const Message& message) { |
| 444 | if (!outputDevice) |
| 445 | return; |
| 446 | |
| 447 | // Set channel if message is not a system MIDI message |
| 448 | Message msg = message; |
| 449 | if (msg.getStatus() != 0xf && channel >= 0) { |
| 450 | msg.setChannel(channel); |
| 451 | } |
| 452 | // DEBUG("sendMessage %02x %02x %02x", msg.cmd, msg.data1, msg.data2); |
| 453 | try { |
| 454 | outputDevice->sendMessage(msg); |
| 455 | } |
| 456 | catch (Exception& e) { |
| 457 | // Don't log error because it could flood the log. |
| 458 | // WARN("MIDI port could not be sent MIDI message: %s", e.what()); |
| 459 | // TODO Perhaps `setDevice(-1)` if sending message fails? |
| 460 | } |
| 461 | } |
| 462 | |
| 463 | |
| 464 | //////////////////// |
nothing calls this directly
no test coverage detected