| 124 | } |
| 125 | |
| 126 | bool SystemMidiDevice::selectOutput(s32 index) |
| 127 | { |
| 128 | if (index < 0 || index >= (s32)getOutputCount()) |
| 129 | { |
| 130 | index = 0; // "disabled" device |
| 131 | } |
| 132 | if (index != m_outputId && m_midiout) |
| 133 | { |
| 134 | noteAllOff(); |
| 135 | if (m_outputId > 0) |
| 136 | m_midiout->closePort(); |
| 137 | if (index > 0) // real Device |
| 138 | { |
| 139 | m_midiout->openPort(index - 1); |
| 140 | for (s32 i = 0; i < MIDI_CHANNEL_COUNT; i++) |
| 141 | { |
| 142 | u8 msg[2] = { u8(MID_PROGRAM_CHANGE | i), 0 }; |
| 143 | message(msg, 2); |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | m_outputId = index; |
| 148 | return true; |
| 149 | } |
| 150 | |
| 151 | s32 SystemMidiDevice::getActiveOutput(void) |
| 152 | { |
no test coverage detected