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 Christian Schoenebeck * |
* Copyright (C) 2005, 2006 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 * |
264 |
|
|
265 |
// setup EG 3 (VCO EG) |
// setup EG 3 (VCO EG) |
266 |
{ |
{ |
267 |
double eg3depth = RTMath::CentsToFreqRatio(pDimRgn->EG3Depth); |
// if portamento mode is on, we dedicate EG3 purely for portamento, otherwise if portamento is off we do as told by the patch |
268 |
EG3.trigger(eg3depth, pDimRgn->EG3Attack, pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
bool bPortamento = pEngineChannel->PortamentoMode && pEngineChannel->PortamentoPos >= 0.0f; |
269 |
|
float eg3depth = (bPortamento) |
270 |
|
? RTMath::CentsToFreqRatio((pEngineChannel->PortamentoPos - (float) MIDIKey) * 100) |
271 |
|
: RTMath::CentsToFreqRatio(pDimRgn->EG3Depth); |
272 |
|
float eg3time = (bPortamento) |
273 |
|
? pEngineChannel->PortamentoTime |
274 |
|
: pDimRgn->EG3Attack; |
275 |
|
EG3.trigger(eg3depth, eg3time, pEngine->SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
276 |
|
dmsg(5,("PortamentoPos=%f, depth=%f, time=%f\n", pEngineChannel->PortamentoPos, eg3depth, eg3time)); |
277 |
} |
} |
278 |
|
|
279 |
|
|
804 |
fFinalCutoff *= EG2.getLevel(); |
fFinalCutoff *= EG2.getLevel(); |
805 |
break; // noop |
break; // noop |
806 |
} |
} |
807 |
if (EG3.active()) finalSynthesisParameters.fFinalPitch *= RTMath::CentsToFreqRatio(EG3.render()); |
if (EG3.active()) finalSynthesisParameters.fFinalPitch *= EG3.render(); |
808 |
|
|
809 |
// process low frequency oscillators |
// process low frequency oscillators |
810 |
if (bLFO1Enabled) fFinalVolume *= pLFO1->render(); |
if (bLFO1Enabled) fFinalVolume *= pLFO1->render(); |
857 |
} |
} |
858 |
} |
} |
859 |
|
|
860 |
|
/** @brief Update current portamento position. |
861 |
|
* |
862 |
|
* Will be called when portamento mode is enabled to get the final |
863 |
|
* portamento position of this active voice from where the next voice(s) |
864 |
|
* might continue to slide on. |
865 |
|
* |
866 |
|
* @param itNoteOffEvent - event which causes this voice to die soon |
867 |
|
*/ |
868 |
|
void Voice::UpdatePortamentoPos(Pool<Event>::Iterator& itNoteOffEvent) { |
869 |
|
const float fFinalEG3Level = EG3.level(itNoteOffEvent->FragmentPos()); |
870 |
|
pEngineChannel->PortamentoPos = (float) MIDIKey + RTMath::FreqRatioToCents(fFinalEG3Level) * 0.01f; |
871 |
|
} |
872 |
|
|
873 |
/** |
/** |
874 |
* Immediately kill the voice. This method should not be used to kill |
* Immediately kill the voice. This method should not be used to kill |
875 |
* a normal, active voice, because it doesn't take care of things like |
* a normal, active voice, because it doesn't take care of things like |