Add button to reset scala file

This commit is contained in:
Jean Pierre Cimalando 2021-02-23 22:52:35 +01:00
parent f16151e2c2
commit dc0f8692f2
2 changed files with 18 additions and 2 deletions

View file

@ -1483,7 +1483,7 @@ void Editor::Impl::valueChanged(CControl* ctl)
if (value != 1) if (value != 1)
break; break;
// TODO(jpc) Reset Scala File changeScalaFile(std::string());
break; break;
case kTagSetVolume: case kTagSetVolume:

View file

@ -1178,6 +1178,14 @@ static bool
sfizz_lv2_load_file(LV2_Handle instance, const char *file_path) sfizz_lv2_load_file(LV2_Handle instance, const char *file_path)
{ {
sfizz_plugin_t *self = (sfizz_plugin_t *)instance; 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); bool status = sfizz_load_file(self->synth, file_path);
sfizz_lv2_update_file_info(self, file_path); sfizz_lv2_update_file_info(self, file_path);
return status; return status;
@ -1187,6 +1195,14 @@ static bool
sfizz_lv2_load_scala_file(LV2_Handle instance, const char *file_path) sfizz_lv2_load_scala_file(LV2_Handle instance, const char *file_path)
{ {
sfizz_plugin_t *self = (sfizz_plugin_t *)instance; 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); bool status = sfizz_load_scala_file(self->synth, file_path);
if (file_path != self->scala_file_path) if (file_path != self->scala_file_path)
strcpy(self->scala_file_path, 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); "[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, lv2_log_note(&self->logger,
"[sfizz] Restoring the scale %s\n", self->scala_file_path); "[sfizz] Restoring the scale %s\n", self->scala_file_path);