Renamed the ScopedLogger as ScopedTiming
This commit is contained in:
parent
805fd5a21c
commit
133885f085
5 changed files with 20 additions and 22 deletions
|
|
@ -324,8 +324,6 @@ void sfz::FilePool::loadingThread() noexcept
|
||||||
|
|
||||||
threadsLoading--;
|
threadsLoading--;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while (!filledPromiseQueue.try_push(promise)) {
|
while (!filledPromiseQueue.try_push(promise)) {
|
||||||
DBG("[sfizz] Error enqueuing the promise for " << promise->filename << " in the filledPromiseQueue");
|
DBG("[sfizz] Error enqueuing the promise for " << promise->filename << " in the filledPromiseQueue");
|
||||||
std::this_thread::sleep_for(1ms);
|
std::this_thread::sleep_for(1ms);
|
||||||
|
|
|
||||||
|
|
@ -155,13 +155,13 @@ void sfz::Logger::disableLogging()
|
||||||
clearFlag.clear();
|
clearFlag.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
sfz::ScopedLogger::ScopedLogger(Duration& targetDuration, Operation operation)
|
sfz::ScopedTiming::ScopedTiming(Duration& targetDuration, Operation operation)
|
||||||
: targetDuration(targetDuration), operation(operation)
|
: targetDuration(targetDuration), operation(operation)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sfz::ScopedLogger::~ScopedLogger()
|
sfz::ScopedTiming::~ScopedTiming()
|
||||||
{
|
{
|
||||||
switch(operation)
|
switch(operation)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ using Duration = std::chrono::duration<double>;
|
||||||
* @brief Creates an RAII logger which fills or adds to a duration on destruction
|
* @brief Creates an RAII logger which fills or adds to a duration on destruction
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
struct ScopedLogger
|
struct ScopedTiming
|
||||||
{
|
{
|
||||||
using TimePoint = std::chrono::time_point<std::chrono::high_resolution_clock>;
|
using TimePoint = std::chrono::time_point<std::chrono::high_resolution_clock>;
|
||||||
enum class Operation
|
enum class Operation
|
||||||
|
|
@ -31,15 +31,15 @@ struct ScopedLogger
|
||||||
addToDuration,
|
addToDuration,
|
||||||
replaceDuration
|
replaceDuration
|
||||||
};
|
};
|
||||||
ScopedLogger() = delete;
|
ScopedTiming() = delete;
|
||||||
/**
|
/**
|
||||||
* @brief Construct a new Scoped Logger object
|
* @brief Construct a new Scoped Logger object
|
||||||
*
|
*
|
||||||
* @param targetDuration
|
* @param targetDuration
|
||||||
* @param op
|
* @param op
|
||||||
*/
|
*/
|
||||||
ScopedLogger(Duration& targetDuration, Operation op = Operation::replaceDuration);
|
ScopedTiming(Duration& targetDuration, Operation op = Operation::replaceDuration);
|
||||||
~ScopedLogger();
|
~ScopedTiming();
|
||||||
Duration& targetDuration;
|
Duration& targetDuration;
|
||||||
const Operation operation;
|
const Operation operation;
|
||||||
const TimePoint creationTime { std::chrono::high_resolution_clock::now() };
|
const TimePoint creationTime { std::chrono::high_resolution_clock::now() };
|
||||||
|
|
|
||||||
|
|
@ -422,7 +422,7 @@ void sfz::Synth::renderBlock(AudioSpan<float> buffer) noexcept
|
||||||
CallbackBreakdown callbackBreakdown;
|
CallbackBreakdown callbackBreakdown;
|
||||||
int numActiveVoices { 0 };
|
int numActiveVoices { 0 };
|
||||||
{ // Main render block
|
{ // Main render block
|
||||||
ScopedLogger logger { callbackBreakdown.renderMethod };
|
ScopedTiming logger { callbackBreakdown.renderMethod };
|
||||||
buffer.fill(0.0f);
|
buffer.fill(0.0f);
|
||||||
resources.filePool.cleanupPromises();
|
resources.filePool.cleanupPromises();
|
||||||
|
|
||||||
|
|
@ -455,7 +455,7 @@ void sfz::Synth::noteOn(int delay, int noteNumber, uint8_t velocity) noexcept
|
||||||
ASSERT(noteNumber < 128);
|
ASSERT(noteNumber < 128);
|
||||||
ASSERT(noteNumber >= 0);
|
ASSERT(noteNumber >= 0);
|
||||||
|
|
||||||
ScopedLogger logger { dispatchDuration, ScopedLogger::Operation::addToDuration };
|
ScopedTiming logger { dispatchDuration, ScopedTiming::Operation::addToDuration };
|
||||||
resources.midiState.noteOnEvent(noteNumber, velocity);
|
resources.midiState.noteOnEvent(noteNumber, velocity);
|
||||||
|
|
||||||
AtomicGuard callbackGuard { inCallback };
|
AtomicGuard callbackGuard { inCallback };
|
||||||
|
|
@ -470,7 +470,7 @@ void sfz::Synth::noteOff(int delay, int noteNumber, uint8_t velocity [[maybe_unu
|
||||||
ASSERT(noteNumber < 128);
|
ASSERT(noteNumber < 128);
|
||||||
ASSERT(noteNumber >= 0);
|
ASSERT(noteNumber >= 0);
|
||||||
|
|
||||||
ScopedLogger logger { dispatchDuration, ScopedLogger::Operation::addToDuration };
|
ScopedTiming logger { dispatchDuration, ScopedTiming::Operation::addToDuration };
|
||||||
resources.midiState.noteOffEvent(noteNumber, velocity);
|
resources.midiState.noteOffEvent(noteNumber, velocity);
|
||||||
|
|
||||||
AtomicGuard callbackGuard { inCallback };
|
AtomicGuard callbackGuard { inCallback };
|
||||||
|
|
@ -526,7 +526,7 @@ void sfz::Synth::cc(int delay, int ccNumber, uint8_t ccValue) noexcept
|
||||||
ASSERT(ccNumber < config::numCCs);
|
ASSERT(ccNumber < config::numCCs);
|
||||||
ASSERT(ccNumber >= 0);
|
ASSERT(ccNumber >= 0);
|
||||||
|
|
||||||
ScopedLogger logger { dispatchDuration, ScopedLogger::Operation::addToDuration };
|
ScopedTiming logger { dispatchDuration, ScopedTiming::Operation::addToDuration };
|
||||||
|
|
||||||
resources.midiState.ccEvent(ccNumber, ccValue);
|
resources.midiState.ccEvent(ccNumber, ccValue);
|
||||||
|
|
||||||
|
|
@ -558,7 +558,7 @@ void sfz::Synth::pitchWheel(int delay, int pitch) noexcept
|
||||||
ASSERT(pitch <= 8192);
|
ASSERT(pitch <= 8192);
|
||||||
ASSERT(pitch >= -8192);
|
ASSERT(pitch >= -8192);
|
||||||
|
|
||||||
ScopedLogger logger { dispatchDuration, ScopedLogger::Operation::addToDuration };
|
ScopedTiming logger { dispatchDuration, ScopedTiming::Operation::addToDuration };
|
||||||
|
|
||||||
resources.midiState.pitchBendEvent(pitch);
|
resources.midiState.pitchBendEvent(pitch);
|
||||||
|
|
||||||
|
|
@ -572,11 +572,11 @@ void sfz::Synth::pitchWheel(int delay, int pitch) noexcept
|
||||||
}
|
}
|
||||||
void sfz::Synth::aftertouch(int /* delay */, uint8_t /* aftertouch */) noexcept
|
void sfz::Synth::aftertouch(int /* delay */, uint8_t /* aftertouch */) noexcept
|
||||||
{
|
{
|
||||||
ScopedLogger logger { dispatchDuration, ScopedLogger::Operation::addToDuration };
|
ScopedTiming logger { dispatchDuration, ScopedTiming::Operation::addToDuration };
|
||||||
}
|
}
|
||||||
void sfz::Synth::tempo(int /* delay */, float /* secondsPerQuarter */) noexcept
|
void sfz::Synth::tempo(int /* delay */, float /* secondsPerQuarter */) noexcept
|
||||||
{
|
{
|
||||||
ScopedLogger logger { dispatchDuration, ScopedLogger::Operation::addToDuration };
|
ScopedTiming logger { dispatchDuration, ScopedTiming::Operation::addToDuration };
|
||||||
}
|
}
|
||||||
|
|
||||||
int sfz::Synth::getNumRegions() const noexcept
|
int sfz::Synth::getNumRegions() const noexcept
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,7 @@ void sfz::Voice::renderBlock(AudioSpan<float> buffer) noexcept
|
||||||
initialDelay -= static_cast<int>(delay);
|
initialDelay -= static_cast<int>(delay);
|
||||||
|
|
||||||
{ // Fill buffer with raw data
|
{ // Fill buffer with raw data
|
||||||
ScopedLogger logger { dataDuration };
|
ScopedTiming logger { dataDuration };
|
||||||
if (region->isGenerator())
|
if (region->isGenerator())
|
||||||
fillWithGenerator(delayed_buffer);
|
fillWithGenerator(delayed_buffer);
|
||||||
else
|
else
|
||||||
|
|
@ -279,7 +279,7 @@ void sfz::Voice::processMono(AudioSpan<float> buffer) noexcept
|
||||||
auto modulationSpan = tempSpan1.first(numSamples);
|
auto modulationSpan = tempSpan1.first(numSamples);
|
||||||
|
|
||||||
{ // Amplitude processing
|
{ // Amplitude processing
|
||||||
ScopedLogger logger { amplitudeDuration };
|
ScopedTiming logger { amplitudeDuration };
|
||||||
|
|
||||||
// Amplitude envelope
|
// Amplitude envelope
|
||||||
amplitudeEnvelope.getBlock(modulationSpan);
|
amplitudeEnvelope.getBlock(modulationSpan);
|
||||||
|
|
@ -299,7 +299,7 @@ void sfz::Voice::processMono(AudioSpan<float> buffer) noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // Filtering and EQ
|
{ // Filtering and EQ
|
||||||
ScopedLogger logger { filterDuration };
|
ScopedTiming logger { filterDuration };
|
||||||
|
|
||||||
const float* inputChannel[1] { leftBuffer.data() };
|
const float* inputChannel[1] { leftBuffer.data() };
|
||||||
float* outputChannel[1] { leftBuffer.data() };
|
float* outputChannel[1] { leftBuffer.data() };
|
||||||
|
|
@ -313,7 +313,7 @@ void sfz::Voice::processMono(AudioSpan<float> buffer) noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // Panning and stereo processing
|
{ // Panning and stereo processing
|
||||||
ScopedLogger logger { panningDuration };
|
ScopedTiming logger { panningDuration };
|
||||||
|
|
||||||
// Prepare for stereo output
|
// Prepare for stereo output
|
||||||
copy<float>(leftBuffer, rightBuffer);
|
copy<float>(leftBuffer, rightBuffer);
|
||||||
|
|
@ -332,7 +332,7 @@ void sfz::Voice::processStereo(AudioSpan<float> buffer) noexcept
|
||||||
auto rightBuffer = buffer.getSpan(1);
|
auto rightBuffer = buffer.getSpan(1);
|
||||||
|
|
||||||
{ // Amplitude processing
|
{ // Amplitude processing
|
||||||
ScopedLogger logger { amplitudeDuration };
|
ScopedTiming logger { amplitudeDuration };
|
||||||
|
|
||||||
// Amplitude envelope
|
// Amplitude envelope
|
||||||
amplitudeEnvelope.getBlock(modulationSpan);
|
amplitudeEnvelope.getBlock(modulationSpan);
|
||||||
|
|
@ -352,7 +352,7 @@ void sfz::Voice::processStereo(AudioSpan<float> buffer) noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // Panning and stereo processing
|
{ // Panning and stereo processing
|
||||||
ScopedLogger logger { panningDuration };
|
ScopedTiming logger { panningDuration };
|
||||||
|
|
||||||
// Apply the width/position process
|
// Apply the width/position process
|
||||||
widthEnvelope.getBlock(modulationSpan);
|
widthEnvelope.getBlock(modulationSpan);
|
||||||
|
|
@ -362,7 +362,7 @@ void sfz::Voice::processStereo(AudioSpan<float> buffer) noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // Filtering and EQ
|
{ // Filtering and EQ
|
||||||
ScopedLogger logger { filterDuration };
|
ScopedTiming logger { filterDuration };
|
||||||
|
|
||||||
const float* inputChannels[2] { leftBuffer.data(), rightBuffer.data() };
|
const float* inputChannels[2] { leftBuffer.data(), rightBuffer.data() };
|
||||||
float* outputChannels[2] { leftBuffer.data(), rightBuffer.data() };
|
float* outputChannels[2] { leftBuffer.data(), rightBuffer.data() };
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue