MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / selectOutput

Method selectOutput

TheForceEngine/TFE_Audio/systemMidiDevice.cpp:126–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 3

initFunction · 0.45
setDeviceTypeFunction · 0.45
selectDeviceOutputFunction · 0.45

Calls 3

messageClass · 0.85
closePortMethod · 0.45
openPortMethod · 0.45

Tested by

no test coverage detected