Use the bufferpool in the synth
This commit is contained in:
parent
5e8cb7de0a
commit
1a55b42bd7
2 changed files with 10 additions and 8 deletions
|
|
@ -506,10 +506,9 @@ void sfz::Synth::setSamplesPerBlock(int samplesPerBlock) noexcept
|
|||
}
|
||||
|
||||
this->samplesPerBlock = samplesPerBlock;
|
||||
this->tempBuffer.resize(samplesPerBlock);
|
||||
this->tempMixNodeBuffer.resize(samplesPerBlock);
|
||||
for (auto& voice : voices)
|
||||
voice->setSamplesPerBlock(samplesPerBlock);
|
||||
|
||||
resources.setSamplesPerBlock(samplesPerBlock);
|
||||
|
||||
for (auto& bus : effectBuses) {
|
||||
|
|
@ -549,8 +548,15 @@ void sfz::Synth::renderBlock(AudioSpan<float> buffer) noexcept
|
|||
return;
|
||||
|
||||
size_t numFrames = buffer.getNumFrames();
|
||||
auto temp = AudioSpan<float>(tempBuffer).first(numFrames);
|
||||
auto tempMixNode = AudioSpan<float>(tempMixNodeBuffer).first(numFrames);
|
||||
auto tempBuffer = resources.bufferPool.getStereoBuffer(numFrames);
|
||||
auto tempMixNodeBuffer = resources.bufferPool.getStereoBuffer(numFrames);
|
||||
if (!tempBuffer || !tempMixNodeBuffer) {
|
||||
DBG("[sfizz] Could not get a temporary buffer; exiting callback... ");
|
||||
return;
|
||||
}
|
||||
|
||||
auto temp = AudioSpan<float>(*tempBuffer).first(numFrames);
|
||||
auto tempMixNode = AudioSpan<float>(*tempMixNodeBuffer).first(numFrames);
|
||||
|
||||
CallbackBreakdown callbackBreakdown;
|
||||
|
||||
|
|
|
|||
|
|
@ -516,10 +516,6 @@ private:
|
|||
// Curves
|
||||
CurveSet curves;
|
||||
|
||||
// Intermediate buffers
|
||||
AudioBuffer<float> tempBuffer { 2, config::defaultSamplesPerBlock };
|
||||
AudioBuffer<float> tempMixNodeBuffer { 2, config::defaultSamplesPerBlock };
|
||||
|
||||
int samplesPerBlock { config::defaultSamplesPerBlock };
|
||||
float sampleRate { config::defaultSampleRate };
|
||||
float volume { Default::globalVolume };
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue