Skip to content

Commit

Permalink
Add support for loop mode release (#1400)
Browse files Browse the repository at this point in the history
Adds support for the new "sample mode release" introduced by Polyphone 2.4
  • Loading branch information
spessasus authored Oct 26, 2024
1 parent e27738b commit 98b1d3e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/rvoice/fluid_rvoice.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,14 @@ fluid_rvoice_write(fluid_rvoice_t *voice, fluid_real_t *dsp_buf)
voice->dsp.phase_incr = 1;
}

/* loop mode release? if not in release, the voice is silent
* note: this intentionally processes the volenv before returning silence,
* since that's what polyphone does (PR #1400) */
if(voice->dsp.samplemode == FLUID_START_ON_RELEASE && fluid_adsr_env_get_section(&voice->envlfo.volenv) < FLUID_VOICE_ENVRELEASE)
{
return -1;
}

/* voice is currently looping? */
is_looping = voice->dsp.samplemode == FLUID_LOOP_DURING_RELEASE
|| (voice->dsp.samplemode == FLUID_LOOP_UNTIL_RELEASE
Expand Down
2 changes: 1 addition & 1 deletion src/rvoice/fluid_rvoice.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ enum fluid_loop
{
FLUID_UNLOOPED = 0,
FLUID_LOOP_DURING_RELEASE = 1,
FLUID_NOTUSED = 2,
FLUID_START_ON_RELEASE = 2, /* this is a looping mode introduced by Polyphone, see #1398 for more info */
FLUID_LOOP_UNTIL_RELEASE = 3
};

Expand Down

0 comments on commit 98b1d3e

Please sign in to comment.