diff --git a/src/sfizz.h b/src/sfizz.h index 35ab02ba..69c9c788 100644 --- a/src/sfizz.h +++ b/src/sfizz.h @@ -424,6 +424,16 @@ SFIZZ_EXPORTED_API char* sfizz_get_unknown_opcodes(sfizz_synth_t* synth); */ SFIZZ_EXPORTED_API bool sfizz_should_reload_file(sfizz_synth_t* synth); +/** + * @brief Check if the scala file should be reloaded. + * Depending on the platform this can create file descriptors. + * + * @param synth The synth. + * + * @return @true if the scala file has been modified since loading. + */ +SFIZZ_EXPORTED_API bool sfizz_should_reload_scala(sfizz_synth_t* synth); + /** * @brief Enable logging of timings to sidecar CSV files. This can produce * many outputs so use with caution. diff --git a/src/sfizz.hpp b/src/sfizz.hpp index c64b748d..863a57e8 100644 --- a/src/sfizz.hpp +++ b/src/sfizz.hpp @@ -350,6 +350,16 @@ public: */ bool shouldReloadFile(); + /** + * @brief Check if the tuning (scala) file should be reloaded. + * + * Depending on the platform this can create file descriptors. + * + * @return true if a scala file has been loaded and has changed + * @return false + */ + bool shouldReloadScala(); + /** * @brief Enable logging of timings to sidecar CSV files. This can produce * many outputs so use with caution. diff --git a/src/sfizz/Synth.cpp b/src/sfizz/Synth.cpp index b6d9a566..c38906ac 100644 --- a/src/sfizz/Synth.cpp +++ b/src/sfizz/Synth.cpp @@ -1212,6 +1212,11 @@ bool sfz::Synth::shouldReloadFile() return (checkModificationTime() > modificationTime); } +bool sfz::Synth::shouldReloadScala() +{ + return resources.tuning.shouldReloadScala(); +} + void sfz::Synth::enableLogging(absl::string_view prefix) noexcept { resources.logger.enableLogging(prefix); diff --git a/src/sfizz/Synth.h b/src/sfizz/Synth.h index 83f49e63..fc25290c 100644 --- a/src/sfizz/Synth.h +++ b/src/sfizz/Synth.h @@ -423,6 +423,17 @@ public: * @return false */ bool shouldReloadFile(); + + /** + * @brief Check if the tuning (scala) file should be reloaded. + * + * Depending on the platform this can create file descriptors. + * + * @return true if a scala file has been loaded and has changed + * @return false + */ + bool shouldReloadScala(); + /** * @brief Enable logging of timings to sidecar CSV files. This can produce * many outputs so use with caution. diff --git a/src/sfizz/sfizz.cpp b/src/sfizz/sfizz.cpp index 2b33edd7..68021616 100644 --- a/src/sfizz/sfizz.cpp +++ b/src/sfizz/sfizz.cpp @@ -221,6 +221,11 @@ bool sfz::Sfizz::shouldReloadFile() return synth->shouldReloadFile(); } +bool sfz::Sfizz::shouldReloadScala() +{ + return synth->shouldReloadScala(); +} + void sfz::Sfizz::enableLogging() noexcept { synth->enableLogging(); diff --git a/src/sfizz/sfizz_wrapper.cpp b/src/sfizz/sfizz_wrapper.cpp index eb06640b..ec161737 100644 --- a/src/sfizz/sfizz_wrapper.cpp +++ b/src/sfizz/sfizz_wrapper.cpp @@ -275,6 +275,12 @@ bool sfizz_should_reload_file(sfizz_synth_t* synth) return self->shouldReloadFile(); } +bool sfizz_should_reload_scala(sfizz_synth_t* synth) +{ + auto self = reinterpret_cast(synth); + return self->shouldReloadScala(); +} + void sfizz_enable_logging(sfizz_synth_t* synth) { auto self = reinterpret_cast(synth);