Skip to content

Commit

Permalink
move sample loop fixup to dedicated function
Browse files Browse the repository at this point in the history
in order to stay in sync with FluidSynth#184
  • Loading branch information
derselbst authored Aug 4, 2017
1 parent 4ecdced commit c254b43
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions fluidsynth/src/sfloader/fluid_defsfont.c
Original file line number Diff line number Diff line change
Expand Up @@ -1959,23 +1959,7 @@ fluid_sample_import_sfont(fluid_sample_t* sample, SFSample* sfsample, fluid_defs
sample->start = 0;
sample->end = sfinfo.frames - 1;

/* loop is fowled?? (cluck cluck :) */
if (sample->loopend > sample->end ||
sample->loopstart >= sample->loopend ||
sample->loopstart <= sample->start)
{
/* can pad loop by 8 samples and ensure at least 4 for loop (2*8+4) */
if ((sample->end - sample->start) >= 20)
{
sample->loopstart = sample->start + 8;
sample->loopend = sample->end - 8;
}
else /* loop is fowled, sample is tiny (can't pad 8 samples) */
{
sample->loopstart = sample->start + 1;
sample->loopend = sample->end - 1;
}
}
fixup_sample_loop(sample);
#endif
}

Expand Down

0 comments on commit c254b43

Please sign in to comment.