1 |
/*************************************************************************** |
/*************************************************************************** |
2 |
* * |
* * |
3 |
* Copyright (C) 2005, 2006 Christian Schoenebeck * |
* Copyright (C) 2005 - 2008 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 * |
21 |
#ifndef __LS_ENGINECHANNEL_H__ |
#ifndef __LS_ENGINECHANNEL_H__ |
22 |
#define __LS_ENGINECHANNEL_H__ |
#define __LS_ENGINECHANNEL_H__ |
23 |
|
|
24 |
|
#include "../EventListeners.h" |
25 |
#include "../drivers/audio/AudioOutputDevice.h" |
#include "../drivers/audio/AudioOutputDevice.h" |
26 |
#include "../drivers/midi/midi.h" |
#include "../drivers/midi/midi.h" |
27 |
#include "../drivers/midi/MidiInputDevice.h" |
#include "../drivers/midi/MidiInputDevice.h" |
28 |
#include "../drivers/midi/MidiInputPort.h" |
#include "../drivers/midi/MidiInputPort.h" |
29 |
|
#include "../drivers/midi/VirtualMidiDevice.h" |
30 |
#include "Engine.h" |
#include "Engine.h" |
31 |
|
#include "FxSend.h" |
32 |
|
|
33 |
namespace LinuxSampler { |
namespace LinuxSampler { |
34 |
|
|
35 |
// just symbol prototyping |
// just symbol prototyping |
36 |
class AudioOutputDevice; |
class AudioOutputDevice; |
37 |
class MidiInputPort; |
class MidiInputPort; |
38 |
|
class FxSend; |
39 |
|
|
40 |
|
|
41 |
/** @brief Channel Interface for LinuxSampler Sampler Engines |
/** @brief Channel Interface for LinuxSampler Sampler Engines |
42 |
* |
* |
73 |
virtual uint Channels() = 0; |
virtual uint Channels() = 0; |
74 |
virtual void Connect(AudioOutputDevice* pAudioOut) = 0; |
virtual void Connect(AudioOutputDevice* pAudioOut) = 0; |
75 |
virtual void DisconnectAudioOutputDevice() = 0; |
virtual void DisconnectAudioOutputDevice() = 0; |
76 |
|
virtual AudioOutputDevice* GetAudioOutputDevice() = 0; |
77 |
virtual void SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel) = 0; |
virtual void SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel) = 0; |
78 |
virtual int OutputChannel(uint EngineAudioChannel) = 0; |
virtual int OutputChannel(uint EngineAudioChannel) = 0; |
79 |
virtual void Connect(MidiInputPort* pMidiPort, midi_chan_t MidiChannel) = 0; |
virtual void Connect(MidiInputPort* pMidiPort, midi_chan_t MidiChannel) = 0; |
86 |
virtual int InstrumentStatus() = 0; |
virtual int InstrumentStatus() = 0; |
87 |
virtual Engine* GetEngine() = 0; |
virtual Engine* GetEngine() = 0; |
88 |
virtual String EngineName() = 0; |
virtual String EngineName() = 0; |
89 |
|
virtual FxSend* AddFxSend(uint8_t MidiCtrl, String Name = "") throw (Exception) = 0; |
90 |
|
virtual FxSend* GetFxSend(uint FxSendIndex) = 0; |
91 |
|
virtual uint GetFxSendCount() = 0; |
92 |
|
virtual void RemoveFxSend(FxSend* pFxSend) = 0; |
93 |
|
virtual void Connect(VirtualMidiDevice* pDevice) = 0; |
94 |
|
virtual void Disconnect(VirtualMidiDevice* pDevice) = 0; |
95 |
|
|
96 |
|
|
97 |
|
///////////////////////////////////////////////////////////////// |
98 |
|
// normal methods |
99 |
|
// (usually not to be overridden by descendant) |
100 |
|
|
101 |
/** |
/** |
102 |
* Sets the mute state of this channel. |
* Sets the mute state of this channel. |
229 |
*/ |
*/ |
230 |
void SetMidiInstrumentMap(int MidiMap) throw (Exception); |
void SetMidiInstrumentMap(int MidiMap) throw (Exception); |
231 |
|
|
232 |
|
/** |
233 |
|
* Set MIDI Registered Parameter Number (RPN) Controller |
234 |
|
* (upper 8 bits / coarse). |
235 |
|
*/ |
236 |
|
void SetMidiRpnControllerMsb(uint8_t CtrlMSB); |
237 |
|
|
238 |
|
/** |
239 |
|
* Set MIDI Registered Parameter Number (RPN) Controller |
240 |
|
* (lower 8 bits / fine). |
241 |
|
*/ |
242 |
|
void SetMidiRpnControllerLsb(uint8_t CtrlLSB); |
243 |
|
|
244 |
|
/** |
245 |
|
* Reset to no RPN controller currently selected. |
246 |
|
*/ |
247 |
|
void ResetMidiRpnController(); |
248 |
|
|
249 |
|
/** |
250 |
|
* Registers the specified listener to be notified when the number |
251 |
|
* of effect sends on this channel is changed. |
252 |
|
*/ |
253 |
|
void AddFxSendCountListener(FxSendCountListener* l); |
254 |
|
|
255 |
|
/** |
256 |
|
* Removes the specified listener. |
257 |
|
*/ |
258 |
|
void RemoveFxSendCountListener(FxSendCountListener* l); |
259 |
|
|
260 |
|
/** |
261 |
|
* Removes all listeners. |
262 |
|
*/ |
263 |
|
void RemoveAllFxSendCountListeners(); |
264 |
|
|
265 |
|
/** |
266 |
|
* Get currently selected MIDI Registered Parameter Number |
267 |
|
* (RPN) Controller, this method will return the already merged |
268 |
|
* value (MSB and LSB value). |
269 |
|
* |
270 |
|
* @e WARNING: you have to call @c ResetMidiRpnController() |
271 |
|
* after using this value, otherwise all subsequent MIDI CC #6 |
272 |
|
* (Data) messages are interpreted as RPN controller value |
273 |
|
* messages. |
274 |
|
* |
275 |
|
* @returns currently selected RPN controller number, a negative |
276 |
|
* value if no RPN controller currently selected |
277 |
|
*/ |
278 |
|
int GetMidiRpnController(); |
279 |
|
|
280 |
|
/** |
281 |
|
* Gets the current number of active voices. |
282 |
|
*/ |
283 |
|
uint GetVoiceCount(); |
284 |
|
|
285 |
|
/** |
286 |
|
* Sets the current number of active voices. |
287 |
|
*/ |
288 |
|
void SetVoiceCount(uint Voices); |
289 |
|
|
290 |
|
/** |
291 |
|
* Gets the current number of active disk streams. |
292 |
|
*/ |
293 |
|
uint GetDiskStreamCount(); |
294 |
|
|
295 |
|
/** |
296 |
|
* Sets the current number of active disk streams. |
297 |
|
*/ |
298 |
|
void SetDiskStreamCount(uint Streams); |
299 |
|
|
300 |
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) |
301 |
|
|
302 |
protected: |
protected: |
303 |
EngineChannel(); |
EngineChannel(); |
304 |
virtual ~EngineChannel() {}; // MUST only be destroyed by EngineChannelFactory |
virtual ~EngineChannel() {}; // MUST only be destroyed by EngineChannelFactory |
305 |
|
|
306 |
|
/** |
307 |
|
* Notifies listeners that the number of effect sends |
308 |
|
* on a this channel is changed. |
309 |
|
* @param ChannelId The numerical ID of the sampler channel. |
310 |
|
* @param NewCount The new number of sampler channels. |
311 |
|
*/ |
312 |
|
void fireFxSendCountChanged(int ChannelId, int NewCount); |
313 |
|
|
314 |
friend class EngineChannelFactory; |
friend class EngineChannelFactory; |
315 |
|
|
316 |
private: |
private: |
319 |
uint8_t uiMidiProgram; |
uint8_t uiMidiProgram; |
320 |
uint8_t uiMidiBankMsb; |
uint8_t uiMidiBankMsb; |
321 |
uint8_t uiMidiBankLsb; |
uint8_t uiMidiBankLsb; |
322 |
|
uint8_t uiMidiRpnMsb; ///< MIDI Registered Parameter Number (upper 8 bits / coarse) |
323 |
|
uint8_t uiMidiRpnLsb; ///< MIDI Registered Parameter Number (lower 8 bits / fine) |
324 |
bool bMidiBankMsbReceived; |
bool bMidiBankMsbReceived; |
325 |
bool bMidiBankLsbReceived; |
bool bMidiBankLsbReceived; |
326 |
bool bProgramChangeReceived; |
bool bProgramChangeReceived; |
327 |
|
bool bMidiRpnReceived; |
328 |
int iMidiInstrumentMap; |
int iMidiInstrumentMap; |
329 |
|
uint uiVoiceCount; |
330 |
|
uint uiDiskStreamCount; |
331 |
|
ListenerList<FxSendCountListener*> llFxSendCountListeners; |
332 |
}; |
}; |
333 |
|
|
334 |
} // namespace LinuxSampler |
} // namespace LinuxSampler |