Added API functions to activate logging
This commit is contained in:
parent
1461680e20
commit
1bb373cfa0
7 changed files with 70 additions and 2 deletions
15
src/sfizz.h
15
src/sfizz.h
|
|
@ -361,6 +361,21 @@ SFIZZ_EXPORTED_API char* sfizz_get_unknown_opcodes(sfizz_synth_t* synth);
|
||||||
*/
|
*/
|
||||||
SFIZZ_EXPORTED_API bool sfizz_should_reload_file(sfizz_synth_t* synth);
|
SFIZZ_EXPORTED_API bool sfizz_should_reload_file(sfizz_synth_t* synth);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable logging of timings to sidecar CSV files. This can produce
|
||||||
|
* many outputs so use with caution.
|
||||||
|
*
|
||||||
|
* @param synth
|
||||||
|
*/
|
||||||
|
SFIZZ_EXPORTED_API void sfizz_enable_logging(sfizz_synth_t* synth);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disable logging
|
||||||
|
*
|
||||||
|
* @param synth
|
||||||
|
*/
|
||||||
|
SFIZZ_EXPORTED_API void sfizz_disable_logging(sfizz_synth_t* synth);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -248,6 +248,17 @@ public:
|
||||||
* @return false
|
* @return false
|
||||||
*/
|
*/
|
||||||
bool shouldReloadFile();
|
bool shouldReloadFile();
|
||||||
|
/**
|
||||||
|
* @brief Enable logging of timings to sidecar CSV files. This can produce
|
||||||
|
* many outputs so use with caution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void enableLogging() noexcept;
|
||||||
|
/**
|
||||||
|
* @brief Disable logging;
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void disableLogging() noexcept;
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<sfz::Synth> synth;
|
std::unique_ptr<sfz::Synth> synth;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ sfz::Logger::~Logger()
|
||||||
<< prefix
|
<< prefix
|
||||||
<< "_file_log.csv";
|
<< "_file_log.csv";
|
||||||
fs::path fileLogPath{ fs::current_path() / fileLogFilename.str() };
|
fs::path fileLogPath{ fs::current_path() / fileLogFilename.str() };
|
||||||
DBG("Logging file times to " << fileLogPath.filename());
|
std::cout << "Logging file times to " << fileLogPath.filename() << '\n';
|
||||||
std::ofstream loadLogFile { fileLogPath.native() };
|
std::ofstream loadLogFile { fileLogPath.native() };
|
||||||
loadLogFile << "WaitDuration,LoadDuration,FileSize,FileName" << '\n';
|
loadLogFile << "WaitDuration,LoadDuration,FileSize,FileName" << '\n';
|
||||||
for (auto& time: fileTimes)
|
for (auto& time: fileTimes)
|
||||||
|
|
@ -81,7 +81,7 @@ sfz::Logger::~Logger()
|
||||||
<< prefix
|
<< prefix
|
||||||
<< "_callback_log.csv";
|
<< "_callback_log.csv";
|
||||||
fs::path callbackLogPath{ fs::current_path() / callbackLogFilename.str() };
|
fs::path callbackLogPath{ fs::current_path() / callbackLogFilename.str() };
|
||||||
DBG("Logging callback times to " << callbackLogPath.filename());
|
std::cout << "Logging callback times to " << callbackLogPath.filename() << '\n';
|
||||||
std::ofstream callbackLogFile { callbackLogPath.native() };
|
std::ofstream callbackLogFile { callbackLogPath.native() };
|
||||||
callbackLogFile << "Dispatch,RenderMethod,Data,Amplitude,Filters,Panning,NumVoices,NumSamples" << '\n';
|
callbackLogFile << "Dispatch,RenderMethod,Data,Amplitude,Filters,Panning,NumVoices,NumSamples" << '\n';
|
||||||
for (auto& time: callbackTimes)
|
for (auto& time: callbackTimes)
|
||||||
|
|
|
||||||
|
|
@ -822,3 +822,13 @@ bool sfz::Synth::shouldReloadFile()
|
||||||
{
|
{
|
||||||
return (checkModificationTime() > modificationTime);
|
return (checkModificationTime() > modificationTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sfz::Synth::enableLogging() noexcept
|
||||||
|
{
|
||||||
|
resources.logger.enableLogging();
|
||||||
|
}
|
||||||
|
|
||||||
|
void sfz::Synth::disableLogging() noexcept
|
||||||
|
{
|
||||||
|
resources.logger.disableLogging();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -340,6 +340,17 @@ public:
|
||||||
* @return false
|
* @return false
|
||||||
*/
|
*/
|
||||||
bool shouldReloadFile();
|
bool shouldReloadFile();
|
||||||
|
/**
|
||||||
|
* @brief Enable logging of timings to sidecar CSV files. This can produce
|
||||||
|
* many outputs so use with caution.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void enableLogging() noexcept;
|
||||||
|
/**
|
||||||
|
* @brief Disable logging;
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void disableLogging() noexcept;
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief The parser callback; this is called by the parent object each time
|
* @brief The parser callback; this is called by the parent object each time
|
||||||
|
|
|
||||||
|
|
@ -184,3 +184,13 @@ bool sfz::Sfizz::shouldReloadFile()
|
||||||
{
|
{
|
||||||
return synth->shouldReloadFile();
|
return synth->shouldReloadFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sfz::Sfizz::enableLogging() noexcept
|
||||||
|
{
|
||||||
|
synth->enableLogging();
|
||||||
|
}
|
||||||
|
|
||||||
|
void sfz::Sfizz::disableLogging() noexcept
|
||||||
|
{
|
||||||
|
synth->disableLogging();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,17 @@ bool sfizz_should_reload_file(sfizz_synth_t* synth)
|
||||||
return self->shouldReloadFile();
|
return self->shouldReloadFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sfizz_enable_logging(sfizz_synth_t* synth)
|
||||||
|
{
|
||||||
|
auto self = reinterpret_cast<sfz::Synth*>(synth);
|
||||||
|
return self->enableLogging();
|
||||||
|
}
|
||||||
|
void sfizz_disable_logging(sfizz_synth_t* synth)
|
||||||
|
{
|
||||||
|
auto self = reinterpret_cast<sfz::Synth*>(synth);
|
||||||
|
return self->disableLogging();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue