Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure 0 portamento is 0 in all modes #6986

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions src/common/dsp/SurgeVoice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,20 +617,25 @@ void SurgeVoice::update_portamento()
int quantStep = 12;

if (!storage->isStandardTuning && storage->currentScale.count > 1)
{
quantStep = storage->currentScale.count;
}

// portamento constant rate mode (multiply portamento time with every octave traversed (or scale
// length in case of microtuning)
// portamento constant rate mode (multiply portamento time with every octave traversed
// (or scale length in case of microtuning)
if (scene->portamento.porta_constrate)
{
const_rate_factor =
(1.f /
((1.f / quantStep) * fabs(state.getPitch(storage) - state.portasrc_key) + 0.00001));
}

state.portaphase +=
storage->envelope_rate_linear(localcopy[scene->portamento.param_id_in_scene].f) *
(scene->portamento.temposync ? storage->temposyncratio : 1.f) * const_rate_factor;

if (state.portaphase < 1)
if ((state.portaphase < 1) &&
(localcopy[scene->portamento.param_id_in_scene].f > scene->portamento.val_min.f))
{
// exponential or linear key traversal for the portamento
float phase;
Expand All @@ -649,15 +654,23 @@ void SurgeVoice::update_portamento()

state.pkey = (1.f - phase) * state.portasrc_key + (float)phase * state.getPitch(storage);

if (scene->portamento.porta_gliss) // quantize portamento to keys
// quantize portamento to keys
if (scene->portamento.porta_gliss)
{
state.pkey = floor(state.pkey + 0.5);
}

state.porta_doretrigger = false;

if (scene->portamento.porta_retrigger)
{
retriggerPortaIfKeyChanged();
}
}
else
{
state.pkey = state.getPitch(storage);
}

state.pkey += noteExpressions[PITCH];
}
Expand Down