1 |
/*************************************************************************** |
2 |
* * |
3 |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 - 2008 Christian Schoenebeck * |
7 |
* Copyright (C) 2009 - 2011 Christian Schoenebeck and Grigor Iliev * |
8 |
* * |
9 |
* This program is free software; you can redistribute it and/or modify * |
10 |
* it under the terms of the GNU General Public License as published by * |
11 |
* the Free Software Foundation; either version 2 of the License, or * |
12 |
* (at your option) any later version. * |
13 |
* * |
14 |
* This program is distributed in the hope that it will be useful, * |
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
17 |
* GNU General Public License for more details. * |
18 |
* * |
19 |
* You should have received a copy of the GNU General Public License * |
20 |
* along with this program; if not, write to the Free Software * |
21 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * |
22 |
* MA 02111-1307 USA * |
23 |
***************************************************************************/ |
24 |
|
25 |
#include "Voice.h" |
26 |
|
27 |
#include "Engine.h" |
28 |
#include "EngineChannel.h" |
29 |
|
30 |
namespace LinuxSampler { namespace sf2 { |
31 |
|
32 |
Voice::Voice(): SignalRack(this) { |
33 |
pEngine = NULL; |
34 |
pEG1 = &EG1; |
35 |
pEG2 = &EG2; |
36 |
} |
37 |
|
38 |
Voice::~Voice() { |
39 |
|
40 |
} |
41 |
|
42 |
void Voice::AboutToTrigger() { |
43 |
|
44 |
} |
45 |
|
46 |
EngineChannel* Voice::GetSf2EngineChannel() { |
47 |
return static_cast<EngineChannel*>(pEngineChannel); |
48 |
} |
49 |
|
50 |
void Voice::SetEngine(LinuxSampler::Engine* pEngine) { |
51 |
Engine* engine = static_cast<Engine*>(pEngine); |
52 |
this->pEngine = engine; |
53 |
this->pDiskThread = engine->pDiskThread; |
54 |
dmsg(6,("Voice::SetEngine()\n")); |
55 |
} |
56 |
|
57 |
Voice::SampleInfo Voice::GetSampleInfo() { |
58 |
SampleInfo si; |
59 |
si.SampleRate = pSample->SampleRate; |
60 |
si.ChannelCount = pSample->GetChannelCount(); |
61 |
si.FrameSize = pSample->GetFrameSize(); |
62 |
si.BitDepth = (pSample->GetFrameSize() / pSample->GetChannelCount()) * 8; |
63 |
si.TotalFrameCount = pSample->GetTotalFrameCount(); |
64 |
|
65 |
si.HasLoops = pRegion->HasLoop; |
66 |
si.LoopStart = (si.HasLoops) ? pRegion->LoopStart : 0; |
67 |
si.LoopLength = (si.HasLoops) ? ((pRegion->LoopEnd) - pRegion->LoopStart): 0; |
68 |
si.LoopPlayCount = 0; // TODO: |
69 |
si.Unpitched = pSample->IsUnpitched(); |
70 |
|
71 |
return si; |
72 |
} |
73 |
|
74 |
Voice::RegionInfo Voice::GetRegionInfo() { |
75 |
::sf2::Region* reg = NULL; |
76 |
::sf2::Preset* preset = GetSf2EngineChannel()->pInstrument; |
77 |
for (int i = 0; i < preset->GetRegionCount(); i++) { // TODO: some optimization? |
78 |
if (preset->GetRegion(i)->pInstrument == pRegion->GetParentInstrument()) { |
79 |
reg = preset->GetRegion(i); // TODO: Can the instrument belong to more than one preset region? |
80 |
break; |
81 |
} |
82 |
} |
83 |
pPresetRegion = reg; |
84 |
|
85 |
RegionInfo ri; |
86 |
ri.UnityNote = pRegion->GetUnityNote(); |
87 |
ri.FineTune = pRegion->GetFineTune(reg) + (pRegion->GetCoarseTune(reg) * 100); |
88 |
ri.Pan = pRegion->GetPan(reg); |
89 |
ri.SampleStartOffset = pRegion->startAddrsOffset + pRegion->startAddrsCoarseOffset; |
90 |
|
91 |
// filter cutoff frequency |
92 |
ri.EG2PreAttack = 1000; |
93 |
ri.EG2Attack = pRegion->GetEG2Attack(reg); |
94 |
//ri.EG2Hold = pRegion->EG2Hold; // TODO: |
95 |
ri.EG2Decay1 = pRegion->GetEG2Decay(reg); |
96 |
ri.EG2Decay2 = pRegion->GetEG2Decay(reg); |
97 |
ri.EG2Sustain = pRegion->GetEG2Sustain(reg); |
98 |
ri.EG2InfiniteSustain = true; |
99 |
ri.EG2Release = pRegion->GetEG2Release(reg); |
100 |
|
101 |
// sample pitch |
102 |
ri.EG3Attack = 0; // TODO: |
103 |
ri.EG3Depth = 0; // TODO: |
104 |
ri.VCFEnabled = false; // TODO: |
105 |
ri.VCFType = Filter::vcf_type_2p_lowpass; // TODO: |
106 |
ri.VCFResonance = 0; // TODO: |
107 |
|
108 |
ri.ReleaseTriggerDecay = 0; // TODO: |
109 |
|
110 |
return ri; |
111 |
} |
112 |
|
113 |
Voice::InstrumentInfo Voice::GetInstrumentInfo() { |
114 |
InstrumentInfo ii; |
115 |
ii.FineTune = 0; // TODO: |
116 |
ii.PitchbendRange = 2; // TODO: |
117 |
|
118 |
return ii; |
119 |
} |
120 |
|
121 |
double Voice::GetSampleAttenuation() { |
122 |
return 1.0; // TODO: |
123 |
} |
124 |
|
125 |
double Voice::GetVelocityAttenuation(uint8_t MIDIKeyVelocity) { |
126 |
return double(MIDIKeyVelocity) / 127.0f; // TODO: |
127 |
} |
128 |
|
129 |
double Voice::GetVelocityRelease(uint8_t MIDIKeyVelocity) { |
130 |
return 0.9; // TODO: |
131 |
} |
132 |
|
133 |
void Voice::ProcessCCEvent(RTList<Event>::Iterator& itEvent) { |
134 |
/*if (itEvent->Type == Event::type_control_change && itEvent->Param.CC.Controller) { // if (valid) MIDI control change event |
135 |
if (pRegion->AttenuationController.type == ::gig::attenuation_ctrl_t::type_controlchange && |
136 |
itEvent->Param.CC.Controller == pRegion->AttenuationController.controller_number) { |
137 |
CrossfadeSmoother.update(AbstractEngine::CrossfadeCurve[CrossfadeAttenuation(itEvent->Param.CC.Value)]); |
138 |
} |
139 |
}*/ // TODO: ^^^ |
140 |
} |
141 |
|
142 |
void Voice::ProcessCutoffEvent(RTList<Event>::Iterator& itEvent) { |
143 |
/*int ccvalue = itEvent->Param.CC.Value; |
144 |
if (VCFCutoffCtrl.value == ccvalue) return; |
145 |
VCFCutoffCtrl.value == ccvalue; |
146 |
if (pRegion->VCFCutoffControllerInvert) ccvalue = 127 - ccvalue; |
147 |
if (ccvalue < pRegion->VCFVelocityScale) ccvalue = pRegion->VCFVelocityScale; |
148 |
float cutoff = CutoffBase * float(ccvalue); |
149 |
if (cutoff > 127.0f) cutoff = 127.0f; |
150 |
|
151 |
VCFCutoffCtrl.fvalue = cutoff; // needed for initialization of fFinalCutoff next time |
152 |
fFinalCutoff = cutoff;*/ // TODO: ^^^ |
153 |
} |
154 |
|
155 |
double Voice::CalculateCrossfadeVolume(uint8_t MIDIKeyVelocity) { |
156 |
/*float crossfadeVolume; |
157 |
switch (pRegion->AttenuationController.type) { |
158 |
case ::gig::attenuation_ctrl_t::type_channelaftertouch: |
159 |
crossfadeVolume = Engine::CrossfadeCurve[CrossfadeAttenuation(GetSf2EngineChannel()->ControllerTable[128])]; |
160 |
break; |
161 |
case ::gig::attenuation_ctrl_t::type_velocity: |
162 |
crossfadeVolume = Engine::CrossfadeCurve[CrossfadeAttenuation(MIDIKeyVelocity)]; |
163 |
break; |
164 |
case ::gig::attenuation_ctrl_t::type_controlchange: //FIXME: currently not sample accurate |
165 |
crossfadeVolume = Engine::CrossfadeCurve[CrossfadeAttenuation(GetSf2EngineChannel()->ControllerTable[pRegion->AttenuationController.controller_number])]; |
166 |
break; |
167 |
case ::gig::attenuation_ctrl_t::type_none: // no crossfade defined |
168 |
default: |
169 |
crossfadeVolume = 1.0f; |
170 |
} |
171 |
|
172 |
return crossfadeVolume;*/ // TODO: ^^^ |
173 |
return 1.0f; |
174 |
} |
175 |
|
176 |
double Voice::GetEG1ControllerValue(uint8_t MIDIKeyVelocity) { |
177 |
/*double eg1controllervalue = 0; |
178 |
switch (pRegion->EG1Controller.type) { |
179 |
case ::gig::eg1_ctrl_t::type_none: // no controller defined |
180 |
eg1controllervalue = 0; |
181 |
break; |
182 |
case ::gig::eg1_ctrl_t::type_channelaftertouch: |
183 |
eg1controllervalue = GetSf2EngineChannel()->ControllerTable[128]; |
184 |
break; |
185 |
case ::gig::eg1_ctrl_t::type_velocity: |
186 |
eg1controllervalue = MIDIKeyVelocity; |
187 |
break; |
188 |
case ::gig::eg1_ctrl_t::type_controlchange: // MIDI control change controller |
189 |
eg1controllervalue = GetSf2EngineChannel()->ControllerTable[pRegion->EG1Controller.controller_number]; |
190 |
break; |
191 |
} |
192 |
if (pRegion->EG1ControllerInvert) eg1controllervalue = 127 - eg1controllervalue; |
193 |
|
194 |
return eg1controllervalue;*/ // TODO: ^^^ |
195 |
return 0; |
196 |
} |
197 |
|
198 |
Voice::EGInfo Voice::CalculateEG1ControllerInfluence(double eg1ControllerValue) { |
199 |
/*EGInfo eg; |
200 |
// (eg1attack is different from the others) |
201 |
eg.Attack = (pRegion->EG1ControllerAttackInfluence) ? |
202 |
1 + 0.031 * (double) (pRegion->EG1ControllerAttackInfluence == 1 ? |
203 |
1 : 1 << pRegion->EG1ControllerAttackInfluence) * eg1ControllerValue : 1.0; |
204 |
eg.Decay = (pRegion->EG1ControllerDecayInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG1ControllerDecayInfluence) * eg1ControllerValue : 1.0; |
205 |
eg.Release = (pRegion->EG1ControllerReleaseInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG1ControllerReleaseInfluence) * eg1ControllerValue : 1.0; |
206 |
|
207 |
return eg;*/ // TODO: ^^^ |
208 |
EGInfo eg; |
209 |
eg.Attack = 1.0; |
210 |
eg.Decay = 1.0; |
211 |
eg.Release = 1.0; |
212 |
return eg; |
213 |
} |
214 |
|
215 |
void Voice::TriggerEG1(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) { |
216 |
EG1.trigger(0, |
217 |
pRegion->GetEG1Attack(pPresetRegion), |
218 |
pRegion->GetEG1Hold(pPresetRegion), |
219 |
pRegion->GetEG1Decay(pPresetRegion), |
220 |
uint(pRegion->GetEG1Sustain(pPresetRegion)), |
221 |
pRegion->GetEG1Release(pPresetRegion), |
222 |
sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
223 |
} |
224 |
|
225 |
double Voice::GetEG2ControllerValue(uint8_t MIDIKeyVelocity) { |
226 |
/*double eg2controllervalue = 0; |
227 |
switch (pRegion->EG2Controller.type) { |
228 |
case ::gig::eg2_ctrl_t::type_none: // no controller defined |
229 |
eg2controllervalue = 0; |
230 |
break; |
231 |
case ::gig::eg2_ctrl_t::type_channelaftertouch: |
232 |
eg2controllervalue = GetSf2EngineChannel()->ControllerTable[128]; |
233 |
break; |
234 |
case ::gig::eg2_ctrl_t::type_velocity: |
235 |
eg2controllervalue = MIDIKeyVelocity; |
236 |
break; |
237 |
case ::gig::eg2_ctrl_t::type_controlchange: // MIDI control change controller |
238 |
eg2controllervalue = GetSf2EngineChannel()->ControllerTable[pRegion->EG2Controller.controller_number]; |
239 |
break; |
240 |
} |
241 |
if (pRegion->EG2ControllerInvert) eg2controllervalue = 127 - eg2controllervalue; |
242 |
|
243 |
return eg2controllervalue;*/ // TODO: ^^^ |
244 |
return 0; |
245 |
} |
246 |
|
247 |
Voice::EGInfo Voice::CalculateEG2ControllerInfluence(double eg2ControllerValue) { |
248 |
/*EGInfo eg; |
249 |
eg.Attack = (pRegion->EG2ControllerAttackInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG2ControllerAttackInfluence) * eg2ControllerValue : 1.0; |
250 |
eg.Decay = (pRegion->EG2ControllerDecayInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG2ControllerDecayInfluence) * eg2ControllerValue : 1.0; |
251 |
eg.Release = (pRegion->EG2ControllerReleaseInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG2ControllerReleaseInfluence) * eg2ControllerValue : 1.0; |
252 |
|
253 |
return eg;*/ // TODO: ^^^ |
254 |
EGInfo eg; |
255 |
eg.Attack = 1.0; |
256 |
eg.Decay = 1.0; |
257 |
eg.Release = 1.0; |
258 |
return eg; |
259 |
} |
260 |
|
261 |
void Voice::TriggerEG2(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) { |
262 |
EG2.trigger(uint(RgnInfo.EG2PreAttack), |
263 |
RgnInfo.EG2Attack * egInfo.Attack, |
264 |
false, |
265 |
RgnInfo.EG2Decay1 * egInfo.Decay * velrelease, |
266 |
RgnInfo.EG2Decay2 * egInfo.Decay * velrelease, |
267 |
RgnInfo.EG2InfiniteSustain, |
268 |
uint(RgnInfo.EG2Sustain), |
269 |
RgnInfo.EG2Release * egInfo.Release * velrelease, |
270 |
velocityAttenuation, |
271 |
sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
272 |
} |
273 |
|
274 |
void Voice::InitLFO1() { |
275 |
/*uint16_t lfo1_internal_depth; |
276 |
switch (pRegion->LFO1Controller) { |
277 |
case ::gig::lfo1_ctrl_internal: |
278 |
lfo1_internal_depth = pRegion->LFO1InternalDepth; |
279 |
pLFO1->ExtController = 0; // no external controller |
280 |
bLFO1Enabled = (lfo1_internal_depth > 0); |
281 |
break; |
282 |
case ::gig::lfo1_ctrl_modwheel: |
283 |
lfo1_internal_depth = 0; |
284 |
pLFO1->ExtController = 1; // MIDI controller 1 |
285 |
bLFO1Enabled = (pRegion->LFO1ControlDepth > 0); |
286 |
break; |
287 |
case ::gig::lfo1_ctrl_breath: |
288 |
lfo1_internal_depth = 0; |
289 |
pLFO1->ExtController = 2; // MIDI controller 2 |
290 |
bLFO1Enabled = (pRegion->LFO1ControlDepth > 0); |
291 |
break; |
292 |
case ::gig::lfo1_ctrl_internal_modwheel: |
293 |
lfo1_internal_depth = pRegion->LFO1InternalDepth; |
294 |
pLFO1->ExtController = 1; // MIDI controller 1 |
295 |
bLFO1Enabled = (lfo1_internal_depth > 0 || pRegion->LFO1ControlDepth > 0); |
296 |
break; |
297 |
case ::gig::lfo1_ctrl_internal_breath: |
298 |
lfo1_internal_depth = pRegion->LFO1InternalDepth; |
299 |
pLFO1->ExtController = 2; // MIDI controller 2 |
300 |
bLFO1Enabled = (lfo1_internal_depth > 0 || pRegion->LFO1ControlDepth > 0); |
301 |
break; |
302 |
default: |
303 |
lfo1_internal_depth = 0; |
304 |
pLFO1->ExtController = 0; // no external controller |
305 |
bLFO1Enabled = false; |
306 |
} |
307 |
if (bLFO1Enabled) { |
308 |
pLFO1->trigger(pRegion->LFO1Frequency, |
309 |
start_level_min, |
310 |
lfo1_internal_depth, |
311 |
pRegion->LFO1ControlDepth, |
312 |
pRegion->LFO1FlipPhase, |
313 |
pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
314 |
pLFO1->update(pLFO1->ExtController ? GetSf2EngineChannel()->ControllerTable[pLFO1->ExtController] : 0); |
315 |
}*/ // TODO: ^^^ |
316 |
bLFO1Enabled = false; |
317 |
} |
318 |
|
319 |
void Voice::InitLFO2() { |
320 |
/*uint16_t lfo2_internal_depth; |
321 |
switch (pRegion->LFO2Controller) { |
322 |
case ::gig::lfo2_ctrl_internal: |
323 |
lfo2_internal_depth = pRegion->LFO2InternalDepth; |
324 |
pLFO2->ExtController = 0; // no external controller |
325 |
bLFO2Enabled = (lfo2_internal_depth > 0); |
326 |
break; |
327 |
case ::gig::lfo2_ctrl_modwheel: |
328 |
lfo2_internal_depth = 0; |
329 |
pLFO2->ExtController = 1; // MIDI controller 1 |
330 |
bLFO2Enabled = (pRegion->LFO2ControlDepth > 0); |
331 |
break; |
332 |
case ::gig::lfo2_ctrl_foot: |
333 |
lfo2_internal_depth = 0; |
334 |
pLFO2->ExtController = 4; // MIDI controller 4 |
335 |
bLFO2Enabled = (pRegion->LFO2ControlDepth > 0); |
336 |
break; |
337 |
case ::gig::lfo2_ctrl_internal_modwheel: |
338 |
lfo2_internal_depth = pRegion->LFO2InternalDepth; |
339 |
pLFO2->ExtController = 1; // MIDI controller 1 |
340 |
bLFO2Enabled = (lfo2_internal_depth > 0 || pRegion->LFO2ControlDepth > 0); |
341 |
break; |
342 |
case ::gig::lfo2_ctrl_internal_foot: |
343 |
lfo2_internal_depth = pRegion->LFO2InternalDepth; |
344 |
pLFO2->ExtController = 4; // MIDI controller 4 |
345 |
bLFO2Enabled = (lfo2_internal_depth > 0 || pRegion->LFO2ControlDepth > 0); |
346 |
break; |
347 |
default: |
348 |
lfo2_internal_depth = 0; |
349 |
pLFO2->ExtController = 0; // no external controller |
350 |
bLFO2Enabled = false; |
351 |
} |
352 |
if (bLFO2Enabled) { |
353 |
pLFO2->trigger(pRegion->LFO2Frequency, |
354 |
start_level_max, |
355 |
lfo2_internal_depth, |
356 |
pRegion->LFO2ControlDepth, |
357 |
pRegion->LFO2FlipPhase, |
358 |
pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
359 |
pLFO2->update(pLFO2->ExtController ? GetSf2EngineChannel()->ControllerTable[pLFO2->ExtController] : 0); |
360 |
}*/ // TODO: ^^^ |
361 |
bLFO2Enabled = false; |
362 |
} |
363 |
|
364 |
void Voice::InitLFO3() { |
365 |
/*uint16_t lfo3_internal_depth; |
366 |
switch (pRegion->LFO3Controller) { |
367 |
case ::gig::lfo3_ctrl_internal: |
368 |
lfo3_internal_depth = pRegion->LFO3InternalDepth; |
369 |
pLFO3->ExtController = 0; // no external controller |
370 |
bLFO3Enabled = (lfo3_internal_depth > 0); |
371 |
break; |
372 |
case ::gig::lfo3_ctrl_modwheel: |
373 |
lfo3_internal_depth = 0; |
374 |
pLFO3->ExtController = 1; // MIDI controller 1 |
375 |
bLFO3Enabled = (pRegion->LFO3ControlDepth > 0); |
376 |
break; |
377 |
case ::gig::lfo3_ctrl_aftertouch: |
378 |
lfo3_internal_depth = 0; |
379 |
pLFO3->ExtController = 128; |
380 |
bLFO3Enabled = true; |
381 |
break; |
382 |
case ::gig::lfo3_ctrl_internal_modwheel: |
383 |
lfo3_internal_depth = pRegion->LFO3InternalDepth; |
384 |
pLFO3->ExtController = 1; // MIDI controller 1 |
385 |
bLFO3Enabled = (lfo3_internal_depth > 0 || pRegion->LFO3ControlDepth > 0); |
386 |
break; |
387 |
case ::gig::lfo3_ctrl_internal_aftertouch: |
388 |
lfo3_internal_depth = pRegion->LFO3InternalDepth; |
389 |
pLFO1->ExtController = 128; |
390 |
bLFO3Enabled = (lfo3_internal_depth > 0 || pRegion->LFO3ControlDepth > 0); |
391 |
break; |
392 |
default: |
393 |
lfo3_internal_depth = 0; |
394 |
pLFO3->ExtController = 0; // no external controller |
395 |
bLFO3Enabled = false; |
396 |
} |
397 |
if (bLFO3Enabled) { |
398 |
pLFO3->trigger(pRegion->LFO3Frequency, |
399 |
start_level_mid, |
400 |
lfo3_internal_depth, |
401 |
pRegion->LFO3ControlDepth, |
402 |
false, |
403 |
pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
404 |
pLFO3->update(pLFO3->ExtController ? GetSf2EngineChannel()->ControllerTable[pLFO3->ExtController] : 0); |
405 |
}*/ // TODO: ^^^ |
406 |
bLFO3Enabled = false; |
407 |
} |
408 |
|
409 |
SignalUnitRack* Voice::GetSignalUnitRack() { |
410 |
return static_cast<SignalUnitRack*> (&SignalRack); |
411 |
} |
412 |
|
413 |
float Voice::CalculateCutoffBase(uint8_t MIDIKeyVelocity) { |
414 |
/*float cutoff = pRegion->GetVelocityCutoff(MIDIKeyVelocity); |
415 |
if (pRegion->VCFKeyboardTracking) { |
416 |
cutoff *= RTMath::CentsToFreqRatioUnlimited((MIDIKey - pRegion->VCFKeyboardTrackingBreakpoint) * 100); |
417 |
} |
418 |
return cutoff;*/ // TODO: ^^^ |
419 |
return 1.0f; |
420 |
} |
421 |
|
422 |
float Voice::CalculateFinalCutoff(float cutoffBase) { |
423 |
/*int cvalue; |
424 |
if (VCFCutoffCtrl.controller) { |
425 |
cvalue = GetSf2EngineChannel()->ControllerTable[VCFCutoffCtrl.controller]; |
426 |
if (pRegion->VCFCutoffControllerInvert) cvalue = 127 - cvalue; |
427 |
// VCFVelocityScale in this case means Minimum cutoff |
428 |
if (cvalue < pRegion->VCFVelocityScale) cvalue = pRegion->VCFVelocityScale; |
429 |
} |
430 |
else { |
431 |
cvalue = pRegion->VCFCutoff; |
432 |
} |
433 |
float fco = cutoffBase * float(cvalue); |
434 |
if (fco > 127.0f) fco = 127.0f; |
435 |
|
436 |
return fco;*/ // TODO: ^^^ |
437 |
return 0.0f; |
438 |
} |
439 |
|
440 |
uint8_t Voice::GetVCFCutoffCtrl() { |
441 |
/*uint8_t ctrl; |
442 |
switch (pRegion->VCFCutoffController) { |
443 |
case ::gig::vcf_cutoff_ctrl_modwheel: |
444 |
ctrl = 1; |
445 |
break; |
446 |
case ::gig::vcf_cutoff_ctrl_effect1: |
447 |
ctrl = 12; |
448 |
break; |
449 |
case ::gig::vcf_cutoff_ctrl_effect2: |
450 |
ctrl = 13; |
451 |
break; |
452 |
case ::gig::vcf_cutoff_ctrl_breath: |
453 |
ctrl = 2; |
454 |
break; |
455 |
case ::gig::vcf_cutoff_ctrl_foot: |
456 |
ctrl = 4; |
457 |
break; |
458 |
case ::gig::vcf_cutoff_ctrl_sustainpedal: |
459 |
ctrl = 64; |
460 |
break; |
461 |
case ::gig::vcf_cutoff_ctrl_softpedal: |
462 |
ctrl = 67; |
463 |
break; |
464 |
case ::gig::vcf_cutoff_ctrl_genpurpose7: |
465 |
ctrl = 82; |
466 |
break; |
467 |
case ::gig::vcf_cutoff_ctrl_genpurpose8: |
468 |
ctrl = 83; |
469 |
break; |
470 |
case ::gig::vcf_cutoff_ctrl_aftertouch: |
471 |
ctrl = 128; |
472 |
break; |
473 |
case ::gig::vcf_cutoff_ctrl_none: |
474 |
default: |
475 |
ctrl = 0; |
476 |
break; |
477 |
} |
478 |
|
479 |
return ctrl;*/ // TODO: ^^^ |
480 |
return 0; |
481 |
} |
482 |
|
483 |
uint8_t Voice::GetVCFResonanceCtrl() { |
484 |
/*uint8_t ctrl; |
485 |
switch (pRegion->VCFResonanceController) { |
486 |
case ::gig::vcf_res_ctrl_genpurpose3: |
487 |
ctrl = 18; |
488 |
break; |
489 |
case ::gig::vcf_res_ctrl_genpurpose4: |
490 |
ctrl = 19; |
491 |
break; |
492 |
case ::gig::vcf_res_ctrl_genpurpose5: |
493 |
ctrl = 80; |
494 |
break; |
495 |
case ::gig::vcf_res_ctrl_genpurpose6: |
496 |
ctrl = 81; |
497 |
break; |
498 |
case ::gig::vcf_res_ctrl_none: |
499 |
default: |
500 |
ctrl = 0; |
501 |
} |
502 |
|
503 |
return ctrl;*/ // TODO: ^^^ |
504 |
return 0; |
505 |
} |
506 |
|
507 |
void Voice::ProcessGroupEvent(RTList<Event>::Iterator& itEvent) { |
508 |
if (itEvent->Param.Note.Key != MIDIKey) { |
509 |
// kill the voice fast |
510 |
pEG1->enterFadeOutStage(); |
511 |
} |
512 |
} |
513 |
|
514 |
}} // namespace LinuxSampler::sf2 |