Add effects in the callback log
This commit is contained in:
parent
7794861ce1
commit
49a182d90f
3 changed files with 28 additions and 19 deletions
|
|
@ -83,7 +83,7 @@ sfz::Logger::~Logger()
|
|||
fs::path callbackLogPath{ fs::current_path() / callbackLogFilename.str() };
|
||||
std::cout << "Logging " << callbackTimes.size() << " callback times to " << callbackLogPath.filename() << '\n';
|
||||
std::ofstream callbackLogFile { callbackLogPath.string() };
|
||||
callbackLogFile << "Dispatch,RenderMethod,Data,Amplitude,Filters,Panning,NumVoices,NumSamples" << '\n';
|
||||
callbackLogFile << "Dispatch,RenderMethod,Data,Amplitude,Filters,Panning,Effects,NumVoices,NumSamples" << '\n';
|
||||
for (auto& time: callbackTimes)
|
||||
callbackLogFile << time.breakdown.dispatch.count() << ','
|
||||
<< time.breakdown.renderMethod.count() << ','
|
||||
|
|
@ -91,6 +91,7 @@ sfz::Logger::~Logger()
|
|||
<< time.breakdown.amplitude.count() << ','
|
||||
<< time.breakdown.filters.count() << ','
|
||||
<< time.breakdown.panning.count() << ','
|
||||
<< time.breakdown.effects.count() << ','
|
||||
<< time.numVoices << ','
|
||||
<< time.numSamples << '\n';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ struct CallbackBreakdown
|
|||
Duration amplitude { 0 };
|
||||
Duration filters { 0 };
|
||||
Duration panning { 0 };
|
||||
Duration effects { 0 };
|
||||
};
|
||||
|
||||
struct CallbackTime
|
||||
|
|
|
|||
|
|
@ -501,14 +501,16 @@ void sfz::Synth::renderBlock(AudioSpan<float> buffer) noexcept
|
|||
auto temp = AudioSpan<float>(tempBuffer).first(numFrames);
|
||||
auto tempMixNode = AudioSpan<float>(tempMixNodeBuffer).first(numFrames);
|
||||
|
||||
// Prepare the effect inputs. They are mixes of per-region outputs.
|
||||
for (size_t i = 0; i < numEffectBuses; ++i) {
|
||||
if (EffectBus* bus = effectBuses[i].get())
|
||||
bus->clearInputs(numFrames);
|
||||
CallbackBreakdown callbackBreakdown;
|
||||
|
||||
{ // Prepare the effect inputs. They are mixes of per-region outputs.
|
||||
ScopedTiming logger { callbackBreakdown.effects };
|
||||
for (size_t i = 0; i < numEffectBuses; ++i) {
|
||||
if (EffectBus* bus = effectBuses[i].get())
|
||||
bus->clearInputs(numFrames);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
CallbackBreakdown callbackBreakdown;
|
||||
int numActiveVoices { 0 };
|
||||
{ // Main render block
|
||||
ScopedTiming logger { callbackBreakdown.renderMethod };
|
||||
|
|
@ -525,11 +527,13 @@ void sfz::Synth::renderBlock(AudioSpan<float> buffer) noexcept
|
|||
numActiveVoices++;
|
||||
voice->renderBlock(temp);
|
||||
|
||||
// Add the output into the effects linked to this region
|
||||
for (size_t i = 0; i < numEffectBuses; ++i) {
|
||||
if (EffectBus* bus = effectBuses[i].get()) {
|
||||
float addGain = region->getGainToEffectBus(i);
|
||||
bus->addToInputs(temp, addGain, numFrames);
|
||||
{ // Add the output into the effects linked to this region
|
||||
ScopedTiming logger { callbackBreakdown.renderMethod, ScopedTiming::Operation::addToDuration };
|
||||
for (size_t i = 0; i < numEffectBuses; ++i) {
|
||||
if (EffectBus* bus = effectBuses[i].get()) {
|
||||
float addGain = region->getGainToEffectBus(i);
|
||||
bus->addToInputs(temp, addGain, numFrames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -540,13 +544,16 @@ void sfz::Synth::renderBlock(AudioSpan<float> buffer) noexcept
|
|||
}
|
||||
}
|
||||
|
||||
// Apply effect buses
|
||||
// -- note(jpc) there is always a "main" bus which is initially empty.
|
||||
// without any <effect>, the signal is just going to flow through it.
|
||||
for (size_t i = 0; i < numEffectBuses; ++i) {
|
||||
if (EffectBus* bus = effectBuses[i].get()) {
|
||||
bus->process(numFrames);
|
||||
bus->mixOutputsTo(buffer, tempMixNode, numFrames);
|
||||
{ // Apply effect buses
|
||||
// -- note(jpc) there is always a "main" bus which is initially empty.
|
||||
// without any <effect>, the signal is just going to flow through it.
|
||||
ScopedTiming logger { callbackBreakdown.renderMethod, ScopedTiming::Operation::addToDuration };
|
||||
|
||||
for (size_t i = 0; i < numEffectBuses; ++i) {
|
||||
if (EffectBus* bus = effectBuses[i].get()) {
|
||||
bus->process(numFrames);
|
||||
bus->mixOutputsTo(buffer, tempMixNode, numFrames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue