Add the ability to set a log filename (non abi breaking change)
This commit is contained in:
parent
36cb6db974
commit
a6cbb48222
8 changed files with 58 additions and 10 deletions
|
|
@ -379,6 +379,14 @@ SFIZZ_EXPORTED_API void sfizz_enable_logging(sfizz_synth_t* synth);
|
|||
*/
|
||||
SFIZZ_EXPORTED_API void sfizz_disable_logging(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_set_logging_prefix(sfizz_synth_t* synth, const char* prefix);
|
||||
|
||||
/**
|
||||
* @brief Shuts down the current processing, clear buffers and reset the voices.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -258,8 +258,22 @@ public:
|
|||
* @brief Enable logging of timings to sidecar CSV files. This can produce
|
||||
* many outputs so use with caution.
|
||||
*
|
||||
* @param prefix the file prefix to use for logging
|
||||
*/
|
||||
void enableLogging() noexcept;
|
||||
/**
|
||||
* @brief Enable logging of timings to sidecar CSV files. This can produce
|
||||
* many outputs so use with caution.
|
||||
*
|
||||
* @param prefix the file prefix to use for logging
|
||||
*/
|
||||
void enableLogging(const std::string& prefix) noexcept;
|
||||
/**
|
||||
* @brief Set the logging prefix
|
||||
*
|
||||
* @param prefix
|
||||
*/
|
||||
void setLoggingPrefix(const std::string& prefix) noexcept;
|
||||
/**
|
||||
* @brief Disable logging;
|
||||
*
|
||||
|
|
|
|||
|
|
@ -112,15 +112,14 @@ void sfz::Logger::logFileTime(std::chrono::duration<double> waitDuration, std::c
|
|||
fileTimeQueue.try_push<FileTime>({ waitDuration, loadDuration, fileSize, filename });
|
||||
}
|
||||
|
||||
void sfz::Logger::setPrefix(const std::string& prefix)
|
||||
void sfz::Logger::setPrefix(absl::string_view prefix)
|
||||
{
|
||||
this->prefix = prefix;
|
||||
this->prefix = std::string(prefix);
|
||||
}
|
||||
|
||||
void sfz::Logger::clear()
|
||||
{
|
||||
clearFlag.clear();
|
||||
prefix.clear();
|
||||
}
|
||||
|
||||
void sfz::Logger::moveEvents() noexcept
|
||||
|
|
@ -143,8 +142,9 @@ void sfz::Logger::moveEvents() noexcept
|
|||
}
|
||||
}
|
||||
|
||||
void sfz::Logger::enableLogging()
|
||||
void sfz::Logger::enableLogging(absl::string_view prefix)
|
||||
{
|
||||
setPrefix(prefix);
|
||||
loggingEnabled = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public:
|
|||
*
|
||||
* @param prefix
|
||||
*/
|
||||
void setPrefix(const std::string& prefix);
|
||||
void setPrefix(absl::string_view prefix);
|
||||
|
||||
/**
|
||||
* @brief Removes all logged data
|
||||
|
|
@ -111,7 +111,7 @@ public:
|
|||
* @brief Enables logging and writing to log files on destruction
|
||||
*
|
||||
*/
|
||||
void enableLogging();
|
||||
void enableLogging(absl::string_view prefix);
|
||||
|
||||
/**
|
||||
* @brief Disables logging and writing to log files on destruction
|
||||
|
|
|
|||
|
|
@ -291,7 +291,6 @@ bool sfz::Synth::loadSfzFile(const fs::path& file)
|
|||
return false;
|
||||
|
||||
resources.filePool.setRootDirectory(this->originalDirectory);
|
||||
resources.logger.setPrefix(file.filename().string());
|
||||
|
||||
auto currentRegion = regions.begin();
|
||||
auto lastRegion = regions.rbegin();
|
||||
|
|
@ -953,9 +952,14 @@ bool sfz::Synth::shouldReloadFile()
|
|||
return (checkModificationTime() > modificationTime);
|
||||
}
|
||||
|
||||
void sfz::Synth::enableLogging() noexcept
|
||||
void sfz::Synth::enableLogging(absl::string_view prefix) noexcept
|
||||
{
|
||||
resources.logger.enableLogging();
|
||||
resources.logger.enableLogging(prefix);
|
||||
}
|
||||
|
||||
void sfz::Synth::setLoggingPrefix(absl::string_view prefix) noexcept
|
||||
{
|
||||
resources.logger.setPrefix(prefix);
|
||||
}
|
||||
|
||||
void sfz::Synth::disableLogging() noexcept
|
||||
|
|
|
|||
|
|
@ -355,7 +355,13 @@ public:
|
|||
* many outputs so use with caution.
|
||||
*
|
||||
*/
|
||||
void enableLogging() noexcept;
|
||||
void enableLogging(absl::string_view prefix = "") noexcept;
|
||||
/**
|
||||
* @brief Enable logging of timings to sidecar CSV files. This can produce
|
||||
* many outputs so use with caution.
|
||||
*
|
||||
*/
|
||||
void setLoggingPrefix(absl::string_view prefix) noexcept;
|
||||
/**
|
||||
* @brief Disable logging;
|
||||
*
|
||||
|
|
|
|||
|
|
@ -191,6 +191,16 @@ void sfz::Sfizz::enableLogging() noexcept
|
|||
synth->enableLogging();
|
||||
}
|
||||
|
||||
void sfz::Sfizz::enableLogging(const std::string& prefix) noexcept
|
||||
{
|
||||
synth->enableLogging(prefix);
|
||||
}
|
||||
|
||||
void sfz::Sfizz::setLoggingPrefix(const std::string& prefix) noexcept
|
||||
{
|
||||
synth->setLoggingPrefix(prefix);
|
||||
}
|
||||
|
||||
void sfz::Sfizz::disableLogging() noexcept
|
||||
{
|
||||
synth->disableLogging();
|
||||
|
|
|
|||
|
|
@ -238,6 +238,12 @@ void sfizz_enable_logging(sfizz_synth_t* synth)
|
|||
return self->enableLogging();
|
||||
}
|
||||
|
||||
void sfizz_set_logging_prefix(sfizz_synth_t* synth, const char* prefix)
|
||||
{
|
||||
auto self = reinterpret_cast<sfz::Synth*>(synth);
|
||||
return self->setLoggingPrefix(prefix);
|
||||
}
|
||||
|
||||
void sfizz_disable_logging(sfizz_synth_t* synth)
|
||||
{
|
||||
auto self = reinterpret_cast<sfz::Synth*>(synth);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue