3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005, 2006 Christian Schoenebeck * |
* Copyright (C) 2005 - 2007 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
40 |
uiMidiProgram = 0; |
uiMidiProgram = 0; |
41 |
bProgramChangeReceived = bMidiBankMsbReceived = bMidiBankLsbReceived = false; |
bProgramChangeReceived = bMidiBankMsbReceived = bMidiBankLsbReceived = false; |
42 |
iMidiInstrumentMap = NO_MIDI_INSTRUMENT_MAP; |
iMidiInstrumentMap = NO_MIDI_INSTRUMENT_MAP; |
43 |
|
uiVoiceCount = 0; |
44 |
|
uiDiskStreamCount = 0; |
45 |
|
ResetMidiRpnController(); |
46 |
} |
} |
47 |
|
|
48 |
void EngineChannel::SetMute(int state) throw (Exception) { |
void EngineChannel::SetMute(int state) throw (Exception) { |
146 |
} |
} |
147 |
|
|
148 |
void EngineChannel::SetMidiInstrumentMapToNone() { |
void EngineChannel::SetMidiInstrumentMapToNone() { |
149 |
|
if (iMidiInstrumentMap == NO_MIDI_INSTRUMENT_MAP) return; |
150 |
iMidiInstrumentMap = NO_MIDI_INSTRUMENT_MAP; |
iMidiInstrumentMap = NO_MIDI_INSTRUMENT_MAP; |
151 |
|
StatusChanged(true); |
152 |
} |
} |
153 |
|
|
154 |
void EngineChannel::SetMidiInstrumentMapToDefault() { |
void EngineChannel::SetMidiInstrumentMapToDefault() { |
155 |
|
if (iMidiInstrumentMap == DEFAULT_MIDI_INSTRUMENT_MAP) return; |
156 |
iMidiInstrumentMap = DEFAULT_MIDI_INSTRUMENT_MAP; |
iMidiInstrumentMap = DEFAULT_MIDI_INSTRUMENT_MAP; |
157 |
|
StatusChanged(true); |
158 |
} |
} |
159 |
|
|
160 |
void EngineChannel::SetMidiInstrumentMap(int MidiMap) throw (Exception) { |
void EngineChannel::SetMidiInstrumentMap(int MidiMap) throw (Exception) { |
161 |
|
if (iMidiInstrumentMap == MidiMap) return; |
162 |
|
|
163 |
// check if given map actually exists in the MIDI instrument mapper |
// check if given map actually exists in the MIDI instrument mapper |
164 |
std::vector<int> maps = MidiInstrumentMapper::Maps(); |
std::vector<int> maps = MidiInstrumentMapper::Maps(); |
165 |
if (find(maps.begin(), maps.end(), MidiMap) == maps.end()) |
if (find(maps.begin(), maps.end(), MidiMap) == maps.end()) |
166 |
throw Exception("MIDI instrument map doesn't exist"); |
throw Exception("MIDI instrument map doesn't exist"); |
167 |
iMidiInstrumentMap = MidiMap; // assign the new map ID |
iMidiInstrumentMap = MidiMap; // assign the new map ID |
168 |
|
StatusChanged(true); |
169 |
|
} |
170 |
|
|
171 |
|
void EngineChannel::SetMidiRpnControllerMsb(uint8_t CtrlMSB) { |
172 |
|
uiMidiRpnMsb = CtrlMSB; |
173 |
|
bMidiRpnReceived = true; |
174 |
|
} |
175 |
|
|
176 |
|
void EngineChannel::SetMidiRpnControllerLsb(uint8_t CtrlLSB) { |
177 |
|
uiMidiRpnLsb = CtrlLSB; |
178 |
|
bMidiRpnReceived = true; |
179 |
|
} |
180 |
|
|
181 |
|
void EngineChannel::ResetMidiRpnController() { |
182 |
|
uiMidiRpnMsb = uiMidiRpnLsb = 0; |
183 |
|
bMidiRpnReceived = false; |
184 |
|
} |
185 |
|
|
186 |
|
int EngineChannel::GetMidiRpnController() { |
187 |
|
return (bMidiRpnReceived) ? (uiMidiRpnMsb << 8) | uiMidiRpnLsb : -1; |
188 |
|
} |
189 |
|
|
190 |
|
uint EngineChannel::GetVoiceCount() { |
191 |
|
return uiVoiceCount; |
192 |
|
} |
193 |
|
|
194 |
|
void EngineChannel::SetVoiceCount(uint Voices) { |
195 |
|
uiVoiceCount = Voices; |
196 |
|
} |
197 |
|
|
198 |
|
uint EngineChannel::GetDiskStreamCount() { |
199 |
|
return uiDiskStreamCount; |
200 |
|
} |
201 |
|
|
202 |
|
void EngineChannel::SetDiskStreamCount(uint Streams) { |
203 |
|
uiDiskStreamCount = Streams; |
204 |
|
} |
205 |
|
|
206 |
|
void EngineChannel::AddFxSendCountListener(FxSendCountListener* l) { |
207 |
|
llFxSendCountListeners.AddListener(l); |
208 |
|
} |
209 |
|
|
210 |
|
void EngineChannel::RemoveFxSendCountListener(FxSendCountListener* l) { |
211 |
|
llFxSendCountListeners.RemoveListener(l); |
212 |
|
} |
213 |
|
|
214 |
|
void EngineChannel::RemoveAllFxSendCountListeners() { |
215 |
|
llFxSendCountListeners.RemoveAllListeners(); |
216 |
|
} |
217 |
|
|
218 |
|
void EngineChannel::fireFxSendCountChanged(int ChannelId, int NewCount) { |
219 |
|
for (int i = 0; i < llFxSendCountListeners.GetListenerCount(); i++) { |
220 |
|
llFxSendCountListeners.GetListener(i)->FxSendCountChanged(ChannelId, NewCount); |
221 |
|
} |
222 |
} |
} |
223 |
|
|
224 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |