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

MONO/MONO FP Gated Porta Fix. Behaviour Change #7318

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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