Moved the empty span checks in the fill* functions
This commit is contained in:
parent
b1638646ed
commit
ae6f10650d
1 changed files with 6 additions and 2 deletions
|
|
@ -239,8 +239,6 @@ void sfz::Voice::renderBlock(AudioSpan<float> buffer) noexcept
|
||||||
auto delay = min(static_cast<size_t>(initialDelay), buffer.getNumFrames());
|
auto delay = min(static_cast<size_t>(initialDelay), buffer.getNumFrames());
|
||||||
auto delayed_buffer = buffer.subspan(delay);
|
auto delayed_buffer = buffer.subspan(delay);
|
||||||
initialDelay -= delay;
|
initialDelay -= delay;
|
||||||
if (delayed_buffer.getNumFrames() == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (region->isGenerator())
|
if (region->isGenerator())
|
||||||
fillWithGenerator(delayed_buffer);
|
fillWithGenerator(delayed_buffer);
|
||||||
|
|
@ -350,6 +348,9 @@ void sfz::Voice::processStereo(AudioSpan<float> buffer) noexcept
|
||||||
|
|
||||||
void sfz::Voice::fillWithData(AudioSpan<float> buffer) noexcept
|
void sfz::Voice::fillWithData(AudioSpan<float> buffer) noexcept
|
||||||
{
|
{
|
||||||
|
if (buffer.getNumFrames() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
auto source { [&]() {
|
auto source { [&]() {
|
||||||
if (region->canUsePreloadedData())
|
if (region->canUsePreloadedData())
|
||||||
return AudioSpan<const float>(*region->preloadedData);
|
return AudioSpan<const float>(*region->preloadedData);
|
||||||
|
|
@ -435,6 +436,9 @@ void sfz::Voice::fillWithGenerator(AudioSpan<float> buffer) noexcept
|
||||||
if (region->sample != "*sine")
|
if (region->sample != "*sine")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (buffer.getNumFrames() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
float step = baseFrequency * twoPi<float> / sampleRate;
|
float step = baseFrequency * twoPi<float> / sampleRate;
|
||||||
phase = linearRamp<float>(tempSpan1, phase, step);
|
phase = linearRamp<float>(tempSpan1, phase, step);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue