From dc0f8692f228b5fe4bb019a4a4ffd13badc6b8e1 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Tue, 23 Feb 2021 22:52:35 +0100 Subject: [PATCH] Add button to reset scala file --- plugins/editor/src/editor/Editor.cpp | 2 +- plugins/lv2/sfizz.cpp | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/plugins/editor/src/editor/Editor.cpp b/plugins/editor/src/editor/Editor.cpp index 98d06a60..b4f3f08e 100644 --- a/plugins/editor/src/editor/Editor.cpp +++ b/plugins/editor/src/editor/Editor.cpp @@ -1483,7 +1483,7 @@ void Editor::Impl::valueChanged(CControl* ctl) if (value != 1) break; - // TODO(jpc) Reset Scala File + changeScalaFile(std::string()); break; case kTagSetVolume: diff --git a/plugins/lv2/sfizz.cpp b/plugins/lv2/sfizz.cpp index 3ab874ed..61d6c581 100644 --- a/plugins/lv2/sfizz.cpp +++ b/plugins/lv2/sfizz.cpp @@ -1178,6 +1178,14 @@ static bool sfizz_lv2_load_file(LV2_Handle instance, const char *file_path) { sfizz_plugin_t *self = (sfizz_plugin_t *)instance; + + char buf[MAX_PATH_SIZE]; + if (file_path[0] == '\0') + { + sfizz_lv2_get_default_sfz_path(instance, buf, MAX_PATH_SIZE); + file_path = buf; + } + bool status = sfizz_load_file(self->synth, file_path); sfizz_lv2_update_file_info(self, file_path); return status; @@ -1187,6 +1195,14 @@ static bool sfizz_lv2_load_scala_file(LV2_Handle instance, const char *file_path) { sfizz_plugin_t *self = (sfizz_plugin_t *)instance; + + char buf[MAX_PATH_SIZE]; + if (file_path[0] == '\0') + { + sfizz_lv2_get_default_scala_path(instance, buf, MAX_PATH_SIZE); + file_path = buf; + } + bool status = sfizz_load_scala_file(self->synth, file_path); if (file_path != self->scala_file_path) strcpy(self->scala_file_path, file_path); @@ -1308,7 +1324,7 @@ restore(LV2_Handle instance, "[sfizz] Error while restoring the file %s\n", self->sfz_file_path); } - if (sfizz_load_scala_file(self->synth, self->scala_file_path)) + if (sfizz_lv2_load_scala_file(self->synth, self->scala_file_path)) { lv2_log_note(&self->logger, "[sfizz] Restoring the scale %s\n", self->scala_file_path);