"Clear" the synth by loading an empty instrument
For instruments saved without the default sine, this should keep them from sounding
This commit is contained in:
parent
b23071e5ac
commit
5b298f10ba
2 changed files with 13 additions and 0 deletions
0
lv2/resources/EmptyInstrument.sfz
Normal file
0
lv2/resources/EmptyInstrument.sfz
Normal file
13
lv2/sfizz.c
13
lv2/sfizz.c
|
|
@ -305,6 +305,13 @@ sfizz_lv2_get_default_sfz_path(LV2_Handle instance, char *path, size_t size)
|
||||||
snprintf(path, size, "%s/%s", self->bundle_path, "Resources/DefaultInstrument.sfz");
|
snprintf(path, size, "%s/%s", self->bundle_path, "Resources/DefaultInstrument.sfz");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sfizz_lv2_get_empty_sfz_path(LV2_Handle instance, char *path, size_t size)
|
||||||
|
{
|
||||||
|
sfizz_plugin_t *self = (sfizz_plugin_t *)instance;
|
||||||
|
snprintf(path, size, "%s/%s", self->bundle_path, "Resources/EmptyInstrument.sfz");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sfizz_lv2_get_default_scala_path(LV2_Handle instance, char *path, size_t size)
|
sfizz_lv2_get_default_scala_path(LV2_Handle instance, char *path, size_t size)
|
||||||
{
|
{
|
||||||
|
|
@ -967,6 +974,11 @@ restore(LV2_Handle instance,
|
||||||
}
|
}
|
||||||
|
|
||||||
lv2_log_note(&self->logger, "[sfizz] Restoring the file %s\n", path);
|
lv2_log_note(&self->logger, "[sfizz] Restoring the file %s\n", path);
|
||||||
|
// Load an empty file to remove the default sine
|
||||||
|
sfizz_lv2_get_empty_sfz_path(instance, self->sfz_file_path, MAX_PATH_SIZE);
|
||||||
|
sfizz_lv2_load_file(instance, self->sfz_file_path);
|
||||||
|
|
||||||
|
// Try loading the new file
|
||||||
sfizz_lv2_load_file(instance, path);
|
sfizz_lv2_load_file(instance, path);
|
||||||
|
|
||||||
if (map_path)
|
if (map_path)
|
||||||
|
|
@ -1144,6 +1156,7 @@ work(LV2_Handle instance,
|
||||||
uint32_t size,
|
uint32_t size,
|
||||||
const void *data)
|
const void *data)
|
||||||
{
|
{
|
||||||
|
UNUSED(size);
|
||||||
sfizz_plugin_t *self = (sfizz_plugin_t *)instance;
|
sfizz_plugin_t *self = (sfizz_plugin_t *)instance;
|
||||||
if (!data) {
|
if (!data) {
|
||||||
lv2_log_error(&self->logger, "[sfizz] Ignoring empty data in the worker thread\n");
|
lv2_log_error(&self->logger, "[sfizz] Ignoring empty data in the worker thread\n");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue