3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003,2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005-2009 Christian Schoenebeck * |
* Copyright (C) 2005-2011 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
22 |
***************************************************************************/ |
***************************************************************************/ |
23 |
|
|
24 |
#ifndef __LS_VOICE_H__ |
#ifndef __LS_VOICE_H__ |
25 |
#define __LS_VOICE_H__ |
#define __LS_VOICE_H__ |
26 |
|
|
27 |
#include "Event.h" |
#include "Event.h" |
28 |
|
#include "../gig/Filter.h" |
29 |
#include "../../common/Pool.h" |
#include "../../common/Pool.h" |
30 |
|
|
31 |
#include <gig.h> // TODO: remove gig dependency |
#include <gig.h> // TODO: remove gig dependency |
41 |
playback_state_disk = 3 |
playback_state_disk = 3 |
42 |
}; |
}; |
43 |
|
|
44 |
// Types |
// Type bits. Mostly mutual exclusive, but a voice may both be of one shot type and require a release trigger at the same time. |
45 |
enum type_t { |
enum type_t { |
46 |
type_normal, |
type_normal = 0, |
47 |
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_required = 1 << 1, ///< If the key of this voice will be released, it causes a release triggered voice to be spawned |
48 |
type_release_trigger ///< Release triggered voice which cannot be killed by releasing its key |
type_release_trigger = 1 << 2, ///< Release triggered voice which cannot be killed by releasing its key |
49 |
|
type_one_shot = 1 << 3, ///< Voice should not be released by note off |
50 |
|
type_controller_triggered = 1 << 4 ///< Voice is triggered by MIDI CC instead of a note on |
51 |
}; |
}; |
52 |
|
|
53 |
struct PitchInfo { |
struct PitchInfo { |
81 |
int Pan; ///< Panorama / Balance (-64..0..63 <-> left..middle..right) |
int Pan; ///< Panorama / Balance (-64..0..63 <-> left..middle..right) |
82 |
uint SampleStartOffset; ///< Number of samples the sample start should be moved |
uint SampleStartOffset; ///< Number of samples the sample start should be moved |
83 |
|
|
|
double EG1PreAttack; ///< Preattack value of the sample amplitude EG (in permilles) |
|
|
double EG1Attack; ///< Attack time of the sample amplitude EG (in seconds) |
|
|
double EG1Hold; ///< If true, Decay1 stage should be postponed until the sample reached the sample loop start |
|
|
double EG1Decay1; ///< Decay time of the sample amplitude EG (in seconds) |
|
|
double EG1Decay2; ///< Only if (EG1InfiniteSustain == false): 2nd decay stage time of the sample amplitude EG (in seconds) |
|
|
double EG1Sustain; ///< Sustain value of the sample amplitude EG (in permilles) |
|
|
bool EG1InfiniteSustain; ///< If true, instead of going into Decay2 phase, Decay1 level will be hold until note will be released. |
|
|
double EG1Release; ///< Release time of the sample amplitude EG (in seconds) |
|
|
|
|
84 |
double EG2PreAttack; ///< Preattack value of the filter cutoff EG (in permilles) |
double EG2PreAttack; ///< Preattack value of the filter cutoff EG (in permilles) |
85 |
double EG2Attack; ///< Attack time of the filter cutoff EG (in seconds) |
double EG2Attack; ///< Attack time of the filter cutoff EG (in seconds) |
86 |
double EG2Decay1; ///< Decay time of the filter cutoff EG (in seconds) |
double EG2Decay1; ///< Decay time of the filter cutoff EG (in seconds) |
91 |
|
|
92 |
double EG3Attack; ///< Attack time of the sample pitch EG (in seconds) |
double EG3Attack; ///< Attack time of the sample pitch EG (in seconds) |
93 |
int EG3Depth; ///< Depth of the sample pitch EG (-1200 - +1200) |
int EG3Depth; ///< Depth of the sample pitch EG (-1200 - +1200) |
94 |
uint8_t ReleaseTriggerDecay; ///< 0 - 8 |
double ReleaseTriggerDecay; ///< How much release sample volume depends on note length. Release sample amplitude is multiplied with (1 - ReleaseTriggerDecay * note length). |
95 |
|
|
96 |
bool VCFEnabled; ///< If filter should be used. |
bool VCFEnabled; ///< If filter should be used. |
97 |
::gig::vcf_type_t VCFType; ///< Defines the general filter characteristic (lowpass, highpass, bandpass, etc.). |
Filter::vcf_type_t VCFType; ///< Defines the general filter characteristic (lowpass, highpass, bandpass, etc.). |
98 |
uint8_t VCFResonance; ///< Firm internal filter resonance weight. |
uint8_t VCFResonance; ///< Firm internal filter resonance weight. |
99 |
}; |
}; |
100 |
|
|
113 |
Voice() { } |
Voice() { } |
114 |
virtual ~Voice() { } |
virtual ~Voice() { } |
115 |
}; |
}; |
|
} // namespace LinuxSampler |
|
116 |
|
|
117 |
#endif /* __LS_VOICE_H__ */ |
// |= operator for the type_t enum |
118 |
|
inline Voice::type_t operator|=(Voice::type_t& lhs, Voice::type_t rhs) { |
119 |
|
return lhs = static_cast<Voice::type_t>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); |
120 |
|
} |
121 |
|
|
122 |
|
} // namespace LinuxSampler |
123 |
|
|
124 |
|
#endif /* __LS_VOICE_H__ */ |