I removed code in a previous commit that deleted ended samples since
that sometimes caused issues when the samples had loop points. However,
removing the code caused issues with the release samples. Thus, now it
removes ended samples only if they are release samples. Otherwise, the
keyup event and ADSR handle ending the note.
Previously if you release a C4 then all C4 notes would be released. Now
it stores the pointer to the plugin data which is unique for each key
press and determines which to release based on the matching pointers.
Now it'll honor the loop regions specified in the file and it'll
properly use the fine tuning for the samples if specified. Also,
modified the exponential decay code again since it was glitching at the
end of some notes for some reason.
Now if a Gig file provides a few samples per octave, it'll change the
pitch of the sample specified for a note instead of just assuming it is
the right pitch.
Also, fixed issue where if attack length was zero the note would never
sound.
Moving the code to detect the sample rates of the currently used samples
after the code deleting notes seemed to fix these glitches. Also, fixed a
few ADSR issues that could have resulted in clipping in the attack or
glitching after the release.
When providing extra frames, libsamplerate stores the extras internally
and outputs them in the next period. But, when it has enough internally
to output a whole period, it just outputs the internal buffer while not
using any more input frames. Now I provide some extra frames, check to
see how many frames we used actually used, and update the sample
positions and ADSR accordingly.