26 |
|
|
27 |
#include "../../common/global.h" |
#include "../../common/global.h" |
28 |
|
|
|
#if DEBUG_HEADERS |
|
|
# warning Voice.h included |
|
|
#endif // DEBUG_HEADERS |
|
|
|
|
29 |
#include <gig.h> |
#include <gig.h> |
30 |
|
|
31 |
#include "../../common/RTMath.h" |
#include "../../common/RTMath.h" |
86 |
void Reset(); |
void Reset(); |
87 |
void SetOutput(AudioOutputDevice* pAudioOutputDevice); |
void SetOutput(AudioOutputDevice* pAudioOutputDevice); |
88 |
void SetEngine(Engine* pEngine); |
void SetEngine(Engine* pEngine); |
89 |
int Trigger(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOnEvent, int PitchBend, ::gig::Instrument* pInstrument, int iLayer, bool ReleaseTriggerVoice, bool VoiceStealingAllowed); |
int Trigger(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOnEvent, int PitchBend, ::gig::DimensionRegion* pDimRgn, type_t VoiceType, int iKeyGroup); |
90 |
inline bool IsActive() { return PlaybackState; } |
inline bool IsActive() { return PlaybackState; } |
91 |
|
inline bool IsStealable() { return !itKillEvent && PlaybackState >= playback_state_ram; } |
92 |
//private: |
//private: |
93 |
// Types |
// Types |
94 |
enum playback_state_t { |
enum playback_state_t { |
95 |
playback_state_end = 0, |
playback_state_end = 0, |
96 |
playback_state_ram = 1, |
playback_state_init = 1, |
97 |
playback_state_disk = 2 |
playback_state_ram = 2, |
98 |
|
playback_state_disk = 3 |
99 |
}; |
}; |
100 |
|
|
101 |
// Attributes |
// Attributes |
109 |
float PitchBase; ///< Basic pitch depth, stays the same for the whole life time of the voice |
float PitchBase; ///< Basic pitch depth, stays the same for the whole life time of the voice |
110 |
float PitchBend; ///< Current pitch value of the pitchbend wheel |
float PitchBend; ///< Current pitch value of the pitchbend wheel |
111 |
::gig::Sample* pSample; ///< Pointer to the sample to be played back |
::gig::Sample* pSample; ///< Pointer to the sample to be played back |
|
::gig::Region* pRegion; ///< Pointer to the articulation information of the respective keyboard region of this voice |
|
112 |
::gig::DimensionRegion* pDimRgn; ///< Pointer to the articulation information of current dimension region of this voice |
::gig::DimensionRegion* pDimRgn; ///< Pointer to the articulation information of current dimension region of this voice |
113 |
playback_state_t PlaybackState; ///< When a sample will be triggered, it will be first played from RAM cache and after a couple of sample points it will switch to disk streaming and at the end of a disk stream we have to add null samples, so the interpolator can do it's work correctly |
playback_state_t PlaybackState; ///< When a sample will be triggered, it will be first played from RAM cache and after a couple of sample points it will switch to disk streaming and at the end of a disk stream we have to add null samples, so the interpolator can do it's work correctly |
114 |
bool DiskVoice; ///< If the sample is very short it completely fits into the RAM cache and doesn't need to be streamed from disk, in that case this flag is set to false |
bool DiskVoice; ///< If the sample is very short it completely fits into the RAM cache and doesn't need to be streamed from disk, in that case this flag is set to false |