Skip to content

Commit

Permalink
MONO/MONO FP Gated Porta Fix. Behaviour Change (#7318)
Browse files Browse the repository at this point in the history
In Mono and Mono FP the portamento would work incorrectly
on a held release with a partial slide. that is, set portamento
to a long time, Press C, press G wait until you get to about E
in the slide, release the G. The porta-slide-back would start from
G.

This makes it start from E with the appropriate phasing and time.

It is a change in bheaviour but a correct behaviour so there
is no bailout option right now.

Closes #7301
  • Loading branch information
baconpaul committed Nov 20, 2023
1 parent e7cdc3f commit ab0d931
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/common/SurgeSynthesizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,7 @@ void SurgeSynthesizer::playVoice(int scene, char channel, char key, char velocit
int16_t channelToReuse, keyToReuse;
SurgeVoice *stealEnvelopesFrom{nullptr};
bool wasGated{false};
float pkeyToReuse{0.f}, pphaseToReuse{0.f};
for (iter = voices[scene].begin(); iter != voices[scene].end(); iter++)
{
SurgeVoice *v = *iter;
Expand All @@ -902,6 +903,11 @@ void SurgeSynthesizer::playVoice(int scene, char channel, char key, char velocit
channelToReuse = v->originating_host_channel;
keyToReuse = v->originating_host_key;
stealEnvelopesFrom = v;
if (v->state.portaphase < 1 && (v->state.portasrc_key != v->state.pkey))
{
pkeyToReuse = v->state.pkey;
pphaseToReuse = v->state.portaphase;
}
wasGated = true;
}
else
Expand Down Expand Up @@ -952,6 +958,14 @@ void SurgeSynthesizer::playVoice(int scene, char channel, char key, char velocit
&channelState[channel].keyState[key], &channelState[mpeMainChannel],
&channelState[channel], mpeEnabled, voiceCounter++, host_noteid,
host_originating_key, host_originating_channel, aegReuse, fegReuse);

if (wasGated && pkeyToReuse > 0)
{
// In this case we want to continue the preivously
// initiated porta
nvoice->state.pkey = pkeyToReuse;
nvoice->state.portaphase = 1 - pphaseToReuse;
}
}
}
}
Expand Down

0 comments on commit ab0d931

Please sign in to comment.