1 |
/*************************************************************************** |
/*************************************************************************** |
2 |
* * |
* * |
3 |
* Copyright (C) 2005, 2006 Christian Schoenebeck * |
* Copyright (C) 2005 - 2007 Christian Schoenebeck * |
4 |
* * |
* * |
5 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
6 |
* 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 * |
26 |
#include "../drivers/midi/MidiInputDevice.h" |
#include "../drivers/midi/MidiInputDevice.h" |
27 |
#include "../drivers/midi/MidiInputPort.h" |
#include "../drivers/midi/MidiInputPort.h" |
28 |
#include "Engine.h" |
#include "Engine.h" |
29 |
|
#include "FxSend.h" |
30 |
|
|
31 |
namespace LinuxSampler { |
namespace LinuxSampler { |
32 |
|
|
33 |
// just symbol prototyping |
// just symbol prototyping |
34 |
class AudioOutputDevice; |
class AudioOutputDevice; |
35 |
class MidiInputPort; |
class MidiInputPort; |
36 |
|
class FxSend; |
37 |
|
|
38 |
|
|
39 |
/** @brief Channel Interface for LinuxSampler Sampler Engines |
/** @brief Channel Interface for LinuxSampler Sampler Engines |
40 |
* |
* |
71 |
virtual uint Channels() = 0; |
virtual uint Channels() = 0; |
72 |
virtual void Connect(AudioOutputDevice* pAudioOut) = 0; |
virtual void Connect(AudioOutputDevice* pAudioOut) = 0; |
73 |
virtual void DisconnectAudioOutputDevice() = 0; |
virtual void DisconnectAudioOutputDevice() = 0; |
74 |
|
virtual AudioOutputDevice* GetAudioOutputDevice() = 0; |
75 |
virtual void SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel) = 0; |
virtual void SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel) = 0; |
76 |
virtual int OutputChannel(uint EngineAudioChannel) = 0; |
virtual int OutputChannel(uint EngineAudioChannel) = 0; |
77 |
virtual void Connect(MidiInputPort* pMidiPort, midi_chan_t MidiChannel) = 0; |
virtual void Connect(MidiInputPort* pMidiPort, midi_chan_t MidiChannel) = 0; |
84 |
virtual int InstrumentStatus() = 0; |
virtual int InstrumentStatus() = 0; |
85 |
virtual Engine* GetEngine() = 0; |
virtual Engine* GetEngine() = 0; |
86 |
virtual String EngineName() = 0; |
virtual String EngineName() = 0; |
87 |
|
virtual FxSend* AddFxSend(uint8_t MidiCtrl, String Name = "") throw (Exception) = 0; |
88 |
|
virtual FxSend* GetFxSend(uint FxSendIndex) = 0; |
89 |
|
virtual uint GetFxSendCount() = 0; |
90 |
|
virtual void RemoveFxSend(FxSend* pFxSend) = 0; |
91 |
|
|
92 |
|
|
93 |
|
///////////////////////////////////////////////////////////////// |
94 |
|
// normal methods |
95 |
|
// (usually not to be overridden by descendant) |
96 |
|
|
97 |
/** |
/** |
98 |
* Sets the mute state of this channel. |
* Sets the mute state of this channel. |
126 |
*/ |
*/ |
127 |
bool GetSolo(); |
bool GetSolo(); |
128 |
|
|
129 |
|
/** |
130 |
|
* Returns current MIDI program (change) number of this |
131 |
|
* EngineChannel. |
132 |
|
*/ |
133 |
|
uint8_t GetMidiProgram(); |
134 |
|
|
135 |
|
/** |
136 |
|
* Change EngineChannel's MIDI program. |
137 |
|
*/ |
138 |
|
void SetMidiProgram(uint8_t Program); |
139 |
|
|
140 |
|
/** |
141 |
|
* Returns current MIDI bank MSB (coarse) number of this |
142 |
|
* EngineChannel. |
143 |
|
*/ |
144 |
|
uint8_t GetMidiBankMsb(); |
145 |
|
|
146 |
|
/** |
147 |
|
* Change current MIDI bank MSB (coarse) number of this |
148 |
|
* EngineChannel. |
149 |
|
*/ |
150 |
|
void SetMidiBankMsb(uint8_t BankMSB); |
151 |
|
|
152 |
|
/** |
153 |
|
* Returns current MIDI bank LSB (fine) number of this |
154 |
|
* EngineChannel. |
155 |
|
*/ |
156 |
|
uint8_t GetMidiBankLsb(); |
157 |
|
|
158 |
|
/** |
159 |
|
* Change current MIDI bank LSB (fine) number of this |
160 |
|
* EngineChannel. |
161 |
|
*/ |
162 |
|
void SetMidiBankLsb(uint8_t BankLSB); |
163 |
|
|
164 |
|
/** |
165 |
|
* Returns true if this EngineChannel is using no MIDI |
166 |
|
* instrument map at all, that is if it will ignore all MIDI |
167 |
|
* program change messages. |
168 |
|
* |
169 |
|
* @see UsesDefaultMidiInstrumentMap() |
170 |
|
* @see GetMidiInstrumentMap() |
171 |
|
*/ |
172 |
|
bool UsesNoMidiInstrumentMap(); |
173 |
|
|
174 |
|
/** |
175 |
|
* Returns true if this EngineChannel is using the default MIDI |
176 |
|
* instrument map for handling MIDI program changes. |
177 |
|
* |
178 |
|
* @see UsesNoMidiInstrumentMap() |
179 |
|
* @see GetMidiInstrumentMap() |
180 |
|
*/ |
181 |
|
bool UsesDefaultMidiInstrumentMap(); |
182 |
|
|
183 |
|
/** |
184 |
|
* Returns ID of the MIDI instrument map currently used by this |
185 |
|
* EngineChannel to handle MIDI program changes. You should |
186 |
|
* always call @c UsesNoMidiInstrumentMap() and |
187 |
|
* @c UsesDefaultMidiInstrumentMap() before calling this method |
188 |
|
* to check if this EngineChannel is probably using the default |
189 |
|
* map or no map at all, because in these two particular cases |
190 |
|
* this method would throw an exception! |
191 |
|
* |
192 |
|
* @throws Exception - if EngineChannel is set to no map at all |
193 |
|
* or is set to the default map |
194 |
|
* @see UsesNoMidiInstrumentMap() |
195 |
|
* @see UsesDefaultMidiInstrumentMap() |
196 |
|
*/ |
197 |
|
int GetMidiInstrumentMap() throw (Exception); |
198 |
|
|
199 |
|
/** |
200 |
|
* Let this EngineChannel use no MIDI instrument map at all, |
201 |
|
* that is to let it ignore all MIDI program change messages. |
202 |
|
* |
203 |
|
* @see SetMidiInstrumentMapToDefault() |
204 |
|
* @see SetMidiInstrumentMap() |
205 |
|
*/ |
206 |
|
void SetMidiInstrumentMapToNone(); |
207 |
|
|
208 |
|
/** |
209 |
|
* Let this EngineChannel use the default MIDI instrument map to |
210 |
|
* handle MIDI program changes. |
211 |
|
* |
212 |
|
* @see SetMidiInstrumentMapToNone() |
213 |
|
* @see SetMidiInstrumentMap() |
214 |
|
*/ |
215 |
|
void SetMidiInstrumentMapToDefault(); |
216 |
|
|
217 |
|
/** |
218 |
|
* Set a specific MIDI instrument map this EngineChannel should |
219 |
|
* use to handle MIDI program changes. |
220 |
|
* |
221 |
|
* @see SetMidiInstrumentMapToNone() |
222 |
|
* @see SetMidiInstrumentMapToDefault() |
223 |
|
* |
224 |
|
* @throws Exception - in case given map does not exist |
225 |
|
*/ |
226 |
|
void SetMidiInstrumentMap(int MidiMap) throw (Exception); |
227 |
|
|
228 |
|
/** |
229 |
|
* Set MIDI Registered Parameter Number (RPN) Controller |
230 |
|
* (upper 8 bits / coarse). |
231 |
|
*/ |
232 |
|
void SetMidiRpnControllerMsb(uint8_t CtrlMSB); |
233 |
|
|
234 |
|
/** |
235 |
|
* Set MIDI Registered Parameter Number (RPN) Controller |
236 |
|
* (lower 8 bits / fine). |
237 |
|
*/ |
238 |
|
void SetMidiRpnControllerLsb(uint8_t CtrlLSB); |
239 |
|
|
240 |
|
/** |
241 |
|
* Get currently selected MIDI Registered Parameter Number |
242 |
|
* (RPN) Controller, this method will return the already merged |
243 |
|
* value (MSB and LSB value). |
244 |
|
*/ |
245 |
|
int GetMidiRpnController(); |
246 |
|
|
247 |
int iSamplerChannelIndex; ///< FIXME: nasty hack, might be removed (should be 'virtual EngineChannel* EngineChannel() = 0;', but due to cyclic dependencies only a void* solution would be possible ATM) |
int iSamplerChannelIndex; ///< FIXME: nasty hack, might be removed (should be 'virtual EngineChannel* EngineChannel() = 0;', but due to cyclic dependencies only a void* solution would be possible ATM) |
248 |
|
|
249 |
protected: |
protected: |
252 |
friend class EngineChannelFactory; |
friend class EngineChannelFactory; |
253 |
|
|
254 |
private: |
private: |
255 |
int iMute; |
int iMute; |
256 |
bool bSolo; |
bool bSolo; |
257 |
|
uint8_t uiMidiProgram; |
258 |
|
uint8_t uiMidiBankMsb; |
259 |
|
uint8_t uiMidiBankLsb; |
260 |
|
uint8_t uiMidiRpnMsb; ///< MIDI Registered Parameter Number (upper 8 bits / coarse) |
261 |
|
uint8_t uiMidiRpnLsb; ///< MIDI Registered Parameter Number (lower 8 bits / fine) |
262 |
|
bool bMidiBankMsbReceived; |
263 |
|
bool bMidiBankLsbReceived; |
264 |
|
bool bProgramChangeReceived; |
265 |
|
int iMidiInstrumentMap; |
266 |
}; |
}; |
267 |
|
|
268 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |