Synth using samples with short loops become distorted when playing high notes

,

...and it so happens that in the course of writing that sample code for the above bug report, I found another bug. :sweat: I'll go ahead and post it here:

It seems PDSynth ignores the release portion of its ADSR envelope. The following uses the same sample from above, and you can hear the attack, decay, and sustain phases. But when the note ends, it just stops abruptly rather than fading out for one second:

AudioSample *sample = pd->sound->sample->load("audio/7001_lead-c4");
PDSynth *synth = pd->sound->synth->newSynth();
pd->sound->synth->setSample(synth, sample, 520, 1368);
pd->sound->synth->setAttackTime(synth, 0.2f);
pd->sound->synth->setDecayTime(synth, 0.4f);
pd->sound->synth->setSustainLevel(synth, 0.5f);
pd->sound->synth->setReleaseTime(synth, 1.0);
pd->sound->channel->addSource(pd->sound->getDefaultChannel(), (SoundSource *)synth);
pd->sound->synth->playMIDINote(synth, NOTE_C4, 0.5, 2.0, 0);

This very well may be the same bug as this report I made earlier.