38 |
|
|
39 |
#define PITCHBEND_SEMITONES 12 |
#define PITCHBEND_SEMITONES 12 |
40 |
#define MAX_AUDIO_VOICES 64 |
#define MAX_AUDIO_VOICES 64 |
|
#define MAX_EVENTS_PER_FRAGMENT 1024 |
|
41 |
|
|
42 |
// preload 64k samples = 128kB of data in RAM for 16 bit mono samples |
// preload 64k samples = 128kB of data in RAM for 16 bit mono samples |
43 |
#define NUM_RAM_PRELOAD_SAMPLES 32768 |
#define NUM_RAM_PRELOAD_SAMPLES 32768 |
65 |
protected: |
protected: |
66 |
struct midi_key_info_t { |
struct midi_key_info_t { |
67 |
RTEList<Voice>* pActiveVoices; ///< Contains the active voices associated with the MIDI key. |
RTEList<Voice>* pActiveVoices; ///< Contains the active voices associated with the MIDI key. |
|
Voice* pSustainPtr; ///< Points to the voice element in the active voice list which has not received a note-off yet (this pointer is needed for sustain pedal handling) |
|
|
bool Sustained; ///< Is true if the MIDI key is currently sustained, thus if Note-off arrived while sustain pedal pressed. |
|
68 |
bool KeyPressed; ///< Is true if the respective MIDI key is currently pressed. |
bool KeyPressed; ///< Is true if the respective MIDI key is currently pressed. |
69 |
uint* pSustainPoolNode; ///< FIXME: hack to allow fast deallocation of the key from the sustained key pool |
bool Active; ///< If the key contains active voices. |
70 |
|
uint* pSelf; ///< hack to allow fast deallocation of the key from the list of active keys |
71 |
|
RTEList<ModulationSystem::Event>* pEvents; ///< Key specific events (only Note-on, Note-off and sustain pedal currently) |
72 |
}; |
}; |
73 |
|
|
74 |
RingBuffer<ModulationSystem::Event>* pEventQueue; ///< Input event queue. |
RingBuffer<ModulationSystem::Event>* pEventQueue; ///< Input event queue. |
75 |
float* pAudioSumBuffer[2]; ///< Audio sum of all voices (32 bit, index 0 = left channel, index 1 = right channel) |
float* pAudioSumBuffer[2]; ///< Audio sum of all voices (32 bit, index 0 = left channel, index 1 = right channel) |
76 |
midi_key_info_t pMIDIKeyInfo[128]; ///< Contains all active voices sorted by MIDI key number and other informations to the respective MIDI key |
midi_key_info_t pMIDIKeyInfo[128]; ///< Contains all active voices sorted by MIDI key number and other informations to the respective MIDI key |
|
/* ActiveVoicePool is a memory pool of limited size (size=MAX VOICES) of active voices. |
|
|
it can be allocated dynamically in real time and the allocated elements can be added to |
|
|
the linked lists represented by ActiveVoices[MIDIKey]. This means we can have unlimited |
|
|
active voices per key. This if for example useful to manage the sustain pedal messages |
|
|
*/ |
|
77 |
RTELMemoryPool<Voice>* pVoicePool; ///< Contains all voices that can be activated. |
RTELMemoryPool<Voice>* pVoicePool; ///< Contains all voices that can be activated. |
78 |
RTELMemoryPool<uint>* pSustainedKeyPool; ///< Contains the MIDI key numbers of all currently sustained keys. |
RTELMemoryPool<uint>* pActiveKeys; ///< Holds all keys in it's allocation list with active voices. |
79 |
RTELMemoryPool<ModulationSystem::Event>* pEventPool; ///< Contains all Event objects that can be used. |
RTELMemoryPool<ModulationSystem::Event>* pEventPool; ///< Contains all Event objects that can be used. |
80 |
RTEList<ModulationSystem::Event>* pEvents; ///< All events for the current audio fragment. |
RTEList<ModulationSystem::Event>* pEvents; ///< All events for the current audio fragment. |
81 |
RTEList<ModulationSystem::Event>* pCCEvents[ModulationSystem::destination_count]; ///< Control change events for the current audio fragment. |
RTEList<ModulationSystem::Event>* pCCEvents[ModulationSystem::destination_count]; ///< Control change events for the current audio fragment. |