44 |
#define PITCHBEND_SEMITONES 12 |
#define PITCHBEND_SEMITONES 12 |
45 |
#define MAX_AUDIO_VOICES 128 |
#define MAX_AUDIO_VOICES 128 |
46 |
#define SYSEX_BUFFER_SIZE 2048 // 2kB |
#define SYSEX_BUFFER_SIZE 2048 // 2kB |
47 |
|
#define VOICE_STEAL_ALGORITHM voice_steal_algo_oldestkey ///< @see voice_steal_algo_t for available voice stealing algorithms |
48 |
|
|
49 |
namespace LinuxSampler { namespace gig { |
namespace LinuxSampler { namespace gig { |
50 |
|
|
60 |
*/ |
*/ |
61 |
class gig::Engine : public LinuxSampler::Engine, public InstrumentConsumer { |
class gig::Engine : public LinuxSampler::Engine, public InstrumentConsumer { |
62 |
public: |
public: |
63 |
|
// types |
64 |
|
enum voice_steal_algo_t { |
65 |
|
voice_steal_algo_none, |
66 |
|
voice_steal_algo_keymask, |
67 |
|
voice_steal_algo_oldestkey |
68 |
|
}; |
69 |
|
|
70 |
// methods |
// methods |
71 |
Engine(); |
Engine(); |
72 |
~Engine(); |
~Engine(); |
134 |
RTELMemoryPool<uint>* pActiveKeys; ///< Holds all keys in it's allocation list with active voices. |
RTELMemoryPool<uint>* pActiveKeys; ///< Holds all keys in it's allocation list with active voices. |
135 |
RTELMemoryPool<Event>* pEventPool; ///< Contains all Event objects that can be used. |
RTELMemoryPool<Event>* pEventPool; ///< Contains all Event objects that can be used. |
136 |
EventGenerator* pEventGenerator; |
EventGenerator* pEventGenerator; |
137 |
|
RTEList<Event>* pVoiceStealingQueue; ///< All voice-launching events which had to be postponed due to free voice shortage. |
138 |
RTEList<Event>* pEvents; ///< All events for the current audio fragment. |
RTEList<Event>* pEvents; ///< All events for the current audio fragment. |
139 |
RTEList<Event>* pCCEvents; ///< All control change events for the current audio fragment. |
RTEList<Event>* pCCEvents; ///< All control change events for the current audio fragment. |
140 |
RTEList<Event>* pSynthesisEvents[Event::destination_count]; ///< Events directly affecting synthesis parameter (like pitch, volume and filter). |
RTEList<Event>* pSynthesisEvents[Event::destination_count]; ///< Events directly affecting synthesis parameter (like pitch, volume and filter). |
156 |
int InstrumentIdx; |
int InstrumentIdx; |
157 |
int InstrumentStat; |
int InstrumentStat; |
158 |
int8_t ScaleTuning[12]; ///< contains optional detune factors (-64..+63 cents) for all 12 semitones of an octave |
int8_t ScaleTuning[12]; ///< contains optional detune factors (-64..+63 cents) for all 12 semitones of an octave |
159 |
|
Voice* pLastStolenVoice; ///< Only for voice stealing: points to the last voice which was theft in current audio fragment, NULL otherwise. |
160 |
|
uint* puiLastStolenKey; ///< Only for voice stealing: key number of last key on which the last voice was theft in current audio fragment, NULL otherwise. |
161 |
|
|
162 |
void ProcessNoteOn(Event* pNoteOnEvent); |
void ProcessNoteOn(Event* pNoteOnEvent); |
163 |
void ProcessNoteOff(Event* pNoteOffEvent); |
void ProcessNoteOff(Event* pNoteOffEvent); |
164 |
void ProcessPitchbend(Event* pPitchbendEvent); |
void ProcessPitchbend(Event* pPitchbendEvent); |
165 |
void ProcessControlChange(Event* pControlChangeEvent); |
void ProcessControlChange(Event* pControlChangeEvent); |
166 |
void ProcessSysex(Event* pSysexEvent); |
void ProcessSysex(Event* pSysexEvent); |
167 |
void LaunchVoice(Event* pNoteOnEvent, int iLayer = 0, bool ReleaseTriggerVoice = false); |
Voice* LaunchVoice(Event* pNoteOnEvent, int iLayer = 0, bool ReleaseTriggerVoice = false, bool VoiceStealing = true); |
168 |
|
void StealVoice(Event* pNoteOnEvent, int iLayer, bool ReleaseTriggerVoice); |
169 |
void KillVoiceImmediately(Voice* pVoice); |
void KillVoiceImmediately(Voice* pVoice); |
170 |
void ResetSynthesisParameters(Event::destination_t dst, float val); |
void ResetSynthesisParameters(Event::destination_t dst, float val); |
171 |
void ResetInternal(); |
void ResetInternal(); |