41 |
class midi_key_info_t; |
class midi_key_info_t; |
42 |
class Voice; |
class Voice; |
43 |
|
|
44 |
|
/** @brief Engine Channel of a gig::Engine |
45 |
|
* |
46 |
|
* Encapsulates a engine channel for the Gigasampler format capable |
47 |
|
* sampler engine. |
48 |
|
*/ |
49 |
class EngineChannel : public LinuxSampler::EngineChannel, public InstrumentConsumer { |
class EngineChannel : public LinuxSampler::EngineChannel, public InstrumentConsumer { |
50 |
public: |
public: |
51 |
EngineChannel(); |
EngineChannel(); |
52 |
virtual ~EngineChannel(); |
virtual ~EngineChannel(); |
53 |
|
|
54 |
// implementation of abstract methods derived from interface class 'LinuxSampler::EngineChannel' |
// implementation of abstract methods derived from interface class 'LinuxSampler::EngineChannel' |
55 |
virtual void PrepareLoadInstrument(const char* FileName, uint Instrument); |
virtual void PrepareLoadInstrument(const char* FileName, uint Instrument); |
56 |
virtual void LoadInstrument(); |
virtual void LoadInstrument(); |
57 |
|
virtual void Reset(); |
58 |
virtual void SendNoteOn(uint8_t Key, uint8_t Velocity); |
virtual void SendNoteOn(uint8_t Key, uint8_t Velocity); |
59 |
virtual void SendNoteOff(uint8_t Key, uint8_t Velocity); |
virtual void SendNoteOff(uint8_t Key, uint8_t Velocity); |
60 |
virtual void SendPitchbend(int Pitch); |
virtual void SendPitchbend(int Pitch); |
61 |
virtual void SendControlChange(uint8_t Controller, uint8_t Value); |
virtual void SendControlChange(uint8_t Controller, uint8_t Value); |
62 |
|
virtual bool StatusChanged(bool bNewStatus = false); |
63 |
virtual float Volume(); |
virtual float Volume(); |
64 |
virtual void Volume(float f); |
virtual void Volume(float f); |
65 |
virtual uint Channels(); |
virtual uint Channels(); |
67 |
virtual void DisconnectAudioOutputDevice(); |
virtual void DisconnectAudioOutputDevice(); |
68 |
virtual void SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel); |
virtual void SetOutputChannel(uint EngineAudioChannel, uint AudioDeviceChannel); |
69 |
virtual int OutputChannel(uint EngineAudioChannel); |
virtual int OutputChannel(uint EngineAudioChannel); |
70 |
|
virtual void Connect(MidiInputPort* pMidiPort, midi_chan_t MidiChannel); |
71 |
|
virtual void DisconnectMidiInputPort(); |
72 |
|
virtual MidiInputPort* GetMidiInputPort(); |
73 |
|
virtual midi_chan_t MidiChannel(); |
74 |
virtual String InstrumentFileName(); |
virtual String InstrumentFileName(); |
75 |
virtual String InstrumentName(); |
virtual String InstrumentName(); |
76 |
virtual int InstrumentIndex(); |
virtual int InstrumentIndex(); |
77 |
virtual int InstrumentStatus(); |
virtual int InstrumentStatus(); |
78 |
virtual LinuxSampler::Engine* GetEngine(); |
virtual LinuxSampler::Engine* GetEngine(); |
79 |
|
virtual String EngineName(); |
80 |
|
|
81 |
// implementation of abstract methods derived from interface class 'InstrumentConsumer' |
// implementation of abstract methods derived from interface class 'InstrumentConsumer' |
82 |
virtual void ResourceToBeUpdated(::gig::Instrument* pResource, void*& pUpdateArg); |
virtual void ResourceToBeUpdated(::gig::Instrument* pResource, void*& pUpdateArg); |
83 |
virtual void ResourceUpdated(::gig::Instrument* pOldResource, ::gig::Instrument* pNewResource, void* pUpdateArg); |
virtual void ResourceUpdated(::gig::Instrument* pOldResource, ::gig::Instrument* pNewResource, void* pUpdateArg); |
84 |
|
virtual void OnResourceProgress(float fProgress); |
85 |
//protected: |
|
86 |
|
//protected: |
87 |
Engine* pEngine; |
Engine* pEngine; |
88 |
float* pOutputLeft; ///< Audio output channel buffer (left) |
float* pOutputLeft; ///< Audio output channel buffer (left) |
89 |
float* pOutputRight; ///< Audio output channel buffer (right) |
float* pOutputRight; ///< Audio output channel buffer (right) |
90 |
int AudioDeviceChannelLeft; ///< audio device channel number to which the left channel is connected to |
int AudioDeviceChannelLeft; ///< audio device channel number to which the left channel is connected to |
91 |
int AudioDeviceChannelRight; ///< audio device channel number to which the right channel is connected to |
int AudioDeviceChannelRight; ///< audio device channel number to which the right channel is connected to |
92 |
|
MidiInputPort* pMidiInputPort; ///< Points to the connected MIDI input port or NULL if none assigned. |
93 |
|
midi_chan_t midiChannel; ///< MIDI channel(s) on which this engine channel listens to. |
94 |
RingBuffer<Event>* pEventQueue; ///< Input event queue. |
RingBuffer<Event>* pEventQueue; ///< Input event queue. |
95 |
uint8_t ControllerTable[128]; ///< Reflects the current values (0-127) of all MIDI controllers for this engine / sampler channel. |
RTList<Event>* pEvents; ///< All engine channel specific events for the current audio fragment. |
96 |
|
uint8_t ControllerTable[128]; ///< Reflects the current values (0-127) of all MIDI controllers for this engine / sampler channel. |
97 |
midi_key_info_t* pMIDIKeyInfo; ///< Contains all active voices sorted by MIDI key number and other informations to the respective MIDI key |
midi_key_info_t* pMIDIKeyInfo; ///< Contains all active voices sorted by MIDI key number and other informations to the respective MIDI key |
98 |
Pool<uint>* pActiveKeys; ///< Holds all keys in it's allocation list with active voices. |
Pool<uint>* pActiveKeys; ///< Holds all keys in it's allocation list with active voices. |
99 |
std::map<uint,uint*> ActiveKeyGroups; ///< Contains active keys (in case they belong to a key group) ordered by key group ID. |
std::map<uint,uint*> ActiveKeyGroups; ///< Contains active keys (in case they belong to a key group) ordered by key group ID. |
100 |
::gig::Instrument* pInstrument; |
::gig::Instrument* pInstrument; |
101 |
bool SustainPedal; ///< true if sustain pedal is down |
bool SustainPedal; ///< true if sustain pedal is down |
102 |
|
bool SostenutoPedal; ///< true if sostenuto pedal is down |
103 |
double GlobalVolume; ///< overall volume (a value < 1.0 means attenuation, a value > 1.0 means amplification) |
double GlobalVolume; ///< overall volume (a value < 1.0 means attenuation, a value > 1.0 means amplification) |
104 |
float GlobalPanLeft; |
float GlobalPanLeft; |
105 |
float GlobalPanRight; |
float GlobalPanRight; |
109 |
int InstrumentIdx; |
int InstrumentIdx; |
110 |
String InstrumentIdxName; |
String InstrumentIdxName; |
111 |
int InstrumentStat; |
int InstrumentStat; |
112 |
RTList<Voice>::Iterator itLastStolenVoice; ///< Only for voice stealing: points to the last voice which was theft in current audio fragment, NULL otherwise. |
int iEngineIndexSelf; ///< Reflects the index of this EngineChannel in the Engine's ArrayList. |
113 |
RTList<uint>::Iterator iuiLastStolenKey; ///< Only for voice stealing: key number of last key on which the last voice was theft in current audio fragment, NULL otherwise. |
bool bStatusChanged; ///< true in case an engine parameter has changed (e.g. new instrument, another volumet) |
114 |
|
|
115 |
|
void ResetControllers(); |
116 |
|
void ClearEventLists(); |
117 |
|
void ImportEvents(uint Samples); |
118 |
|
|
119 |
friend class Engine; |
friend class Engine; |
120 |
friend class Voice; |
friend class Voice; |
121 |
friend class InstrumentResourceManager; |
friend class InstrumentResourceManager; |
122 |
|
|
123 |
private: |
private: |
124 |
void ResetInternal(); |
void ResetInternal(); |
125 |
}; |
}; |