31 |
#include "../../common/RTMath.h" |
#include "../../common/RTMath.h" |
32 |
#include "../../common/Pool.h" |
#include "../../common/Pool.h" |
33 |
#include "../../drivers/audio/AudioOutputDevice.h" |
#include "../../drivers/audio/AudioOutputDevice.h" |
|
#include "Engine.h" |
|
|
#include "EngineChannel.h" |
|
34 |
#include "Stream.h" |
#include "Stream.h" |
35 |
#include "DiskThread.h" |
#include "DiskThread.h" |
36 |
#include "EGADSR.h" |
#include "EGADSR.h" |
37 |
#include "EGDecay.h" |
#include "EGDecay.h" |
38 |
#include "Filter.h" |
#include "Filter.h" |
39 |
#include "../common/LFOBase.h" |
#include "../common/LFOBase.h" |
40 |
|
#include "../common/VoiceBase.h" |
41 |
#include "SynthesisParam.h" |
#include "SynthesisParam.h" |
42 |
#include "SmoothVolume.h" |
#include "SmoothVolume.h" |
43 |
|
|
64 |
#endif |
#endif |
65 |
|
|
66 |
namespace LinuxSampler { namespace gig { |
namespace LinuxSampler { namespace gig { |
|
|
|
67 |
class Engine; |
class Engine; |
68 |
|
class EngineChannel; |
69 |
|
|
70 |
/// Reflects a MIDI controller |
/// Reflects a MIDI controller |
71 |
struct midi_ctrl { |
struct midi_ctrl { |
94 |
* |
* |
95 |
* Renders a voice for the Gigasampler format. |
* Renders a voice for the Gigasampler format. |
96 |
*/ |
*/ |
97 |
class Voice { |
class Voice : public LinuxSampler::VoiceBase< ::gig::DimensionRegion> { |
98 |
public: |
public: |
|
// Types |
|
|
enum type_t { |
|
|
type_normal, |
|
|
type_release_trigger_required, ///< If the key of this voice will be released, it causes a release triggered voice to be spawned |
|
|
type_release_trigger ///< Release triggered voice which cannot be killed by releasing its key |
|
|
}; |
|
|
|
|
99 |
// Attributes |
// Attributes |
100 |
type_t Type; ///< Voice Type |
type_t Type; ///< Voice Type |
101 |
int MIDIKey; ///< MIDI key number of the key that triggered the voice |
int MIDIKey; ///< MIDI key number of the key that triggered the voice |
109 |
void Render(uint Samples); |
void Render(uint Samples); |
110 |
void Reset(); |
void Reset(); |
111 |
void SetOutput(AudioOutputDevice* pAudioOutputDevice); |
void SetOutput(AudioOutputDevice* pAudioOutputDevice); |
112 |
void SetEngine(Engine* pEngine); |
void SetEngine(LinuxSampler::Engine* pEngine); |
113 |
int Trigger(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOnEvent, int PitchBend, ::gig::DimensionRegion* pDimRgn, type_t VoiceType, int iKeyGroup); |
int Trigger(EngineChannel* pEngineChannel, Pool<Event>::Iterator& itNoteOnEvent, int PitchBend, ::gig::DimensionRegion* pDimRgn, type_t VoiceType, int iKeyGroup); |
114 |
inline bool IsActive() { return PlaybackState; } |
inline bool IsActive() { return PlaybackState; } |
115 |
inline bool IsStealable() { return !itKillEvent && PlaybackState >= playback_state_ram; } |
inline bool IsStealable() { return !itKillEvent && PlaybackState >= playback_state_ram; } |
116 |
void UpdatePortamentoPos(Pool<Event>::Iterator& itNoteOffEvent); |
void UpdatePortamentoPos(Pool<Event>::Iterator& itNoteOffEvent); |
117 |
|
|
118 |
//private: |
virtual ::gig::DimensionRegion* GetRegion() { return pDimRgn; } |
|
// Types |
|
|
enum playback_state_t { |
|
|
playback_state_end = 0, |
|
|
playback_state_init = 1, |
|
|
playback_state_ram = 2, |
|
|
playback_state_disk = 3 |
|
|
}; |
|
119 |
|
|
120 |
|
//private: |
121 |
// Attributes |
// Attributes |
122 |
EngineChannel* pEngineChannel; |
EngineChannel* pEngineChannel; |
123 |
Engine* pEngine; ///< Pointer to the sampler engine, to be able to access the event lists. |
Engine* pEngine; ///< Pointer to the sampler engine, to be able to access the event lists. |