Fix VST2 state restore for plugins without custom UI

VST preset restore has to happen in the GUI thread, specifically
the plugin's own UI event-loop (which on Linux and Windows is
not usually Ardour's Thread 1). However if there is no plugin
GUI, it should be safe to use Ardour's UI thread.
This commit is contained in:
Robin Gareus 2022-09-21 16:13:18 +02:00
parent 3ad819da4c
commit 86f0f0ca11
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 15 additions and 2 deletions

View File

@ -40,6 +40,7 @@
#include "ardour/session.h"
#include "ardour/filesystem_paths.h"
#include "ardour/audio_buffer.h"
#include "ardour/plugin_insert.h"
#include "pbd/i18n.h"
@ -464,7 +465,13 @@ VSTPlugin::load_plugin_preset (PresetRecord r)
sscanf (r.uri.c_str(), "VST:%d:%d", &id, &index);
#endif
_state->want_program = index;
LoadPresetProgram (); /* EMIT SIGNAL */ /* used for macvst */
if (!has_editor () || 0 == plugin_insert ()->window_proxy ()) {
vststate_maybe_set_program (_state);
_state->want_chunk = 0;
_state->want_program = -1;
} else {
LoadPresetProgram (); /* EMIT SIGNAL */ /* used for macvst */
}
return true;
}
@ -506,7 +513,13 @@ VSTPlugin::load_user_preset (PresetRecord r)
_state->wanted_chunk = raw_data;
_state->wanted_chunk_size = size;
_state->want_chunk = 1;
LoadPresetProgram (); /* EMIT SIGNAL */ /* used for macvst */
if (!has_editor () || 0 == plugin_insert ()->window_proxy ()) {
vststate_maybe_set_program (_state);
_state->want_chunk = 0;
_state->want_program = -1;
} else {
LoadPresetProgram (); /* EMIT SIGNAL */ /* used for macvst */
}
return true;
}
}