fix(tests): rework testNoteOffReleasesNewestSameNote to actually prove newest-first release; add single-frame-loop test; add two comments in sampler_core.cpp
This commit is contained in:
@@ -199,6 +199,9 @@ AudioSample Voice::renderFrame() {
|
||||
if (loopUsable && i1 >= loop.end) {
|
||||
i1 = loop.start; // seamless wrap for the interpolation partner.
|
||||
}
|
||||
// i0 is always in [0, frameCount) after the early-out above; the guard is purely
|
||||
// defensive. i1 (the interpolation partner) can exceed frameCount when no loop
|
||||
// wraps it — only that partner actually needs the clamp.
|
||||
const double s0 = (i0 >= 0 && i0 < frameCount) ? static_cast<double>(pcm[i0]) : 0.0;
|
||||
const double s1 = (i1 >= 0 && i1 < frameCount) ? static_cast<double>(pcm[i1]) : 0.0;
|
||||
const double interp = s0 + (s1 - s0) * frac;
|
||||
@@ -288,7 +291,7 @@ void VoiceEngine::noteOff(int note) {
|
||||
|
||||
void VoiceEngine::render(std::vector<AudioSample>& out, std::size_t frameCount) {
|
||||
const std::size_t base = out.size();
|
||||
out.resize(base + frameCount, 0.0f);
|
||||
out.resize(base + frameCount, 0.0f); // S4: caller must pre-reserve — no allocation allowed under the VST3 process callback.
|
||||
for (Voice& voice : voices_) {
|
||||
if (!voice.active()) continue;
|
||||
for (std::size_t f = 0; f < frameCount; ++f) {
|
||||
|
||||
Reference in New Issue
Block a user