45 |
|
|
46 |
class AudioThread : public Thread { |
class AudioThread : public Thread { |
47 |
public: |
public: |
48 |
int ActiveVoiceCount; ///< number of currently active voices |
double Volume; ///< overall volume (a value < 1.0 means attenuation, a value > 1.0 means amplification) |
49 |
int ActiveVoiceCountMax; ///< the maximum voice usage since application start |
int ActiveVoiceCount; ///< number of currently active voices |
50 |
|
int ActiveVoiceCountMax; ///< the maximum voice usage since application start |
51 |
|
|
52 |
AudioThread(AudioIO* pAudioIO, DiskThread* pDiskThread, gig::Instrument* pInstrument); |
AudioThread(AudioIO* pAudioIO, DiskThread* pDiskThread, gig::Instrument* pInstrument); |
53 |
~AudioThread(); |
~AudioThread(); |
54 |
void ProcessNoteOn(uint8_t Pitch, uint8_t Velocity); |
void SendNoteOn(uint8_t Pitch, uint8_t Velocity); |
55 |
void ProcessNoteOff(uint8_t Pitch, uint8_t Velocity); |
void SendNoteOff(uint8_t Pitch, uint8_t Velocity); |
56 |
void ProcessContinuousController(uint8_t Channel, uint8_t Number, uint8_t Value); |
void SendControlChange(uint8_t Channel, uint8_t Number, uint8_t Value); |
57 |
protected: |
protected: |
58 |
int Main(); ///< Implementation of virtual method from class Thread |
int Main(); ///< Implementation of virtual method from class Thread |
59 |
private: |
private: |
71 |
uint8_t value; |
uint8_t value; |
72 |
} command; |
} command; |
73 |
struct midi_key_info_t { |
struct midi_key_info_t { |
74 |
RTEList<Voice*>* pActiveVoices; ///< Contains the active voices associated with the MIDI key. |
RTEList<Voice*>* pActiveVoices; ///< Contains the active voices associated with the MIDI key. |
75 |
RTEList<Voice*>::NodeHandle hSustainPtr; ///< 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) |
RTEList<Voice*>::NodeHandle hSustainPtr; ///< 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) |
76 |
bool Sustained; ///< Is true if the MIDI key is currently sustained, thus if Note-off arrived while sustain pedal pressed. |
bool Sustained; ///< Is true if the MIDI key is currently sustained, thus if Note-off arrived while sustain pedal pressed. |
77 |
|
bool KeyPressed; ///< Is true if the respective MIDI key is currently pressed. |
78 |
|
uint* pSustainPoolNode; ///< FIXME: hack to allow fast deallocation of the key from the sustained key pool |
79 |
}; |
}; |
80 |
|
|
81 |
RingBuffer<command_t>* pCommandQueue; |
RingBuffer<command_t>* pCommandQueue; |
95 |
bool SustainPedal; ///< true if sustain pedal is down |
bool SustainPedal; ///< true if sustain pedal is down |
96 |
uint8_t PrevHoldCCValue; |
uint8_t PrevHoldCCValue; |
97 |
|
|
98 |
void ActivateVoice(uint8_t MIDIKey, uint8_t Velocity); |
void ProcessNoteOn(uint8_t MIDIKey, uint8_t Velocity); |
99 |
void ReleaseVoice(uint8_t MIDIKey, uint8_t Velocity); |
void ProcessNoteOff(uint8_t MIDIKey, uint8_t Velocity); |
100 |
|
void ProcessControlChange(uint8_t Channel, uint8_t Number, uint8_t Value); |
101 |
void ReleaseVoice(Voice* pVoice); |
void ReleaseVoice(Voice* pVoice); |
|
void ContinuousController(uint8_t Channel, uint8_t Number, uint8_t Value); |
|
102 |
void CacheInitialSamples(gig::Sample* pSample); |
void CacheInitialSamples(gig::Sample* pSample); |
103 |
}; |
}; |
104 |
|
|