+ bool s;
+
+ if (r.user) {
+ s = load_user_preset (r);
+ } else {
+ s = load_plugin_preset (r);
+ }
+
+ if (s) {
+ Plugin::load_preset (r);
+ }
+
+ return s;
+}
+
+bool
+VSTPlugin::load_plugin_preset (PresetRecord r)
+{
+ /* This is a plugin-provided preset.
+ We can't dispatch directly here; too many plugins expects only one GUI thread.
+ */
+
+ /* Extract the index of this preset from the URI */
+ int id;
+ int index;
+#ifndef NDEBUG
+ int const p = sscanf (r.uri.c_str(), "VST:%d:%d", &id, &index);
+ assert (p == 2);
+#else
+ sscanf (r.uri.c_str(), "VST:%d:%d", &id, &index);
+#endif
+
+ _state->want_program = index;
+ return true;
+}
+
+bool
+VSTPlugin::load_user_preset (PresetRecord r)
+{
+ /* This is a user preset; we load it, and this code also knows about the
+ non-direct-dispatch thing.
+ */
+