38 |
uiMidiBankMsb = 0; |
uiMidiBankMsb = 0; |
39 |
uiMidiBankLsb = 0; |
uiMidiBankLsb = 0; |
40 |
uiMidiProgram = 0; |
uiMidiProgram = 0; |
|
uiMidiRpnMsb = uiMidiRpnLsb = 0; |
|
41 |
bProgramChangeReceived = bMidiBankMsbReceived = bMidiBankLsbReceived = false; |
bProgramChangeReceived = bMidiBankMsbReceived = bMidiBankLsbReceived = false; |
42 |
iMidiInstrumentMap = NO_MIDI_INSTRUMENT_MAP; |
iMidiInstrumentMap = NO_MIDI_INSTRUMENT_MAP; |
43 |
|
ResetMidiRpnController(); |
44 |
} |
} |
45 |
|
|
46 |
void EngineChannel::SetMute(int state) throw (Exception) { |
void EngineChannel::SetMute(int state) throw (Exception) { |
144 |
} |
} |
145 |
|
|
146 |
void EngineChannel::SetMidiInstrumentMapToNone() { |
void EngineChannel::SetMidiInstrumentMapToNone() { |
147 |
|
if (iMidiInstrumentMap == NO_MIDI_INSTRUMENT_MAP) return; |
148 |
iMidiInstrumentMap = NO_MIDI_INSTRUMENT_MAP; |
iMidiInstrumentMap = NO_MIDI_INSTRUMENT_MAP; |
149 |
|
StatusChanged(true); |
150 |
} |
} |
151 |
|
|
152 |
void EngineChannel::SetMidiInstrumentMapToDefault() { |
void EngineChannel::SetMidiInstrumentMapToDefault() { |
153 |
|
if (iMidiInstrumentMap == DEFAULT_MIDI_INSTRUMENT_MAP) return; |
154 |
iMidiInstrumentMap = DEFAULT_MIDI_INSTRUMENT_MAP; |
iMidiInstrumentMap = DEFAULT_MIDI_INSTRUMENT_MAP; |
155 |
|
StatusChanged(true); |
156 |
} |
} |
157 |
|
|
158 |
void EngineChannel::SetMidiInstrumentMap(int MidiMap) throw (Exception) { |
void EngineChannel::SetMidiInstrumentMap(int MidiMap) throw (Exception) { |
159 |
|
if (iMidiInstrumentMap == MidiMap) return; |
160 |
|
|
161 |
// check if given map actually exists in the MIDI instrument mapper |
// check if given map actually exists in the MIDI instrument mapper |
162 |
std::vector<int> maps = MidiInstrumentMapper::Maps(); |
std::vector<int> maps = MidiInstrumentMapper::Maps(); |
163 |
if (find(maps.begin(), maps.end(), MidiMap) == maps.end()) |
if (find(maps.begin(), maps.end(), MidiMap) == maps.end()) |
164 |
throw Exception("MIDI instrument map doesn't exist"); |
throw Exception("MIDI instrument map doesn't exist"); |
165 |
iMidiInstrumentMap = MidiMap; // assign the new map ID |
iMidiInstrumentMap = MidiMap; // assign the new map ID |
166 |
|
StatusChanged(true); |
167 |
} |
} |
168 |
|
|
169 |
void EngineChannel::SetMidiRpnControllerMsb(uint8_t CtrlMSB) { |
void EngineChannel::SetMidiRpnControllerMsb(uint8_t CtrlMSB) { |
170 |
uiMidiRpnMsb = CtrlMSB; |
uiMidiRpnMsb = CtrlMSB; |
171 |
|
bMidiRpnReceived = true; |
172 |
} |
} |
173 |
|
|
174 |
void EngineChannel::SetMidiRpnControllerLsb(uint8_t CtrlLSB) { |
void EngineChannel::SetMidiRpnControllerLsb(uint8_t CtrlLSB) { |
175 |
uiMidiRpnLsb = CtrlLSB; |
uiMidiRpnLsb = CtrlLSB; |
176 |
|
bMidiRpnReceived = true; |
177 |
|
} |
178 |
|
|
179 |
|
void EngineChannel::ResetMidiRpnController() { |
180 |
|
uiMidiRpnMsb = uiMidiRpnLsb = 0; |
181 |
|
bMidiRpnReceived = false; |
182 |
} |
} |
183 |
|
|
184 |
int EngineChannel::GetMidiRpnController() { |
int EngineChannel::GetMidiRpnController() { |
185 |
return (uiMidiRpnMsb << 8) | uiMidiRpnLsb; |
return (bMidiRpnReceived) ? (uiMidiRpnMsb << 8) | uiMidiRpnLsb : -1; |
186 |
|
} |
187 |
|
|
188 |
|
void EngineChannel::AddFxSendCountListener(FxSendCountListener* l) { |
189 |
|
llFxSendCountListeners.AddListener(l); |
190 |
|
} |
191 |
|
|
192 |
|
void EngineChannel::RemoveFxSendCountListener(FxSendCountListener* l) { |
193 |
|
llFxSendCountListeners.RemoveListener(l); |
194 |
|
} |
195 |
|
|
196 |
|
void EngineChannel::RemoveAllFxSendCountListeners() { |
197 |
|
llFxSendCountListeners.RemoveAllListeners(); |
198 |
|
} |
199 |
|
|
200 |
|
void EngineChannel::fireFxSendCountChanged(int ChannelId, int NewCount) { |
201 |
|
for (int i = 0; i < llFxSendCountListeners.GetListenerCount(); i++) { |
202 |
|
llFxSendCountListeners.GetListener(i)->FxSendCountChanged(ChannelId, NewCount); |
203 |
|
} |
204 |
} |
} |
205 |
|
|
206 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |