Skip to content

Commit

Permalink
Fixup for commit bab6ba6: a call to resampler.last() was missing, cau…
Browse files Browse the repository at this point in the history
…sing a glitch (and test failure)
  • Loading branch information
gvnnz committed Jan 30, 2024
1 parent 940f7ef commit 21ee595
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/core/rendering/sampleRendering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,23 @@ void renderSampleChannel(const Channel& ch, bool seqIsRunning)
while (ch.shared->renderQueue->pop(renderInfo))
;

const Frame begin = ch.sampleChannel->begin;
const Frame end = ch.sampleChannel->end;
mcl::AudioBuffer& buf = ch.shared->audioBuffer;
Frame tracker = std::clamp(ch.shared->tracker.load(), begin, end); /* Make sure tracker stays within begin-end range. */
const Frame begin = ch.sampleChannel->begin;
const Frame end = ch.sampleChannel->end;
const Resampler& resampler = ch.shared->resampler.value();
mcl::AudioBuffer& buf = ch.shared->audioBuffer;
Frame tracker = std::clamp(ch.shared->tracker.load(), begin, end); /* Make sure tracker stays within begin-end range. */

if (renderInfo.mode == RenderInfo::Mode::NORMAL)
{
tracker = render_(ch, buf, tracker, renderInfo.offset, seqIsRunning);
}
else
{
/* Both modes: fill whole buffer first: [abcdefghijklmnopq]. */
/* Both modes: fill whole buffer first: [abcdefghijklmnopq]. Also tell
resampler this is the last read before either a rewind or a stop. */

render_(ch, buf, tracker, 0, seqIsRunning);
resampler.last();

/* Mode::REWIND: fill buffer from offset: [abcdefghi|abcdfefg]
Mode::STOP: clear buffer from offset: [abcdefghi|--------] */
Expand Down

0 comments on commit 21ee595

Please sign in to comment.