summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-02-21 18:00:12 +0100
committerRobin Gareus <robin@gareus.org>2014-02-22 03:11:48 +0100
commitdfeb68aeb4cfb23b335e3a171314b78327d832e3 (patch)
tree0de9636e5cbf283c08e21b0da5eb0c8423ce8015 /libs
parent40aa7e5e9034321f8af0b3067bd5f3005c537d5d (diff)
Windows VST GUI related rework
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/session_vst.cc22
-rw-r--r--libs/ardour/vst_plugin.cc22
2 files changed, 42 insertions, 2 deletions
diff --git a/libs/ardour/session_vst.cc b/libs/ardour/session_vst.cc
index c746a9d388..3f2054aadc 100644
--- a/libs/ardour/session_vst.cc
+++ b/libs/ardour/session_vst.cc
@@ -90,7 +90,7 @@ intptr_t Session::vst_callback (
case audioMasterVersion:
SHOW_CALLBACK ("amc: audioMasterVersion\n");
// vst version, currently 2 (0 for older)
- return 2;
+ return 2; // XXX 2400
case audioMasterCurrentId:
SHOW_CALLBACK ("amc: audioMasterCurrentId\n");
@@ -102,6 +102,24 @@ intptr_t Session::vst_callback (
SHOW_CALLBACK ("amc: audioMasterIdle\n");
// call application idle routine (this will
// call effEditIdle for all open editors too)
+
+#if 0 // TODO -> emit to GUI OR better delegete to fst/fst
+
+ // This allows the main GUI window to update if needed.
+ // Some plugins take over the GUI event loop
+ // which causes the main GUI to freeze while the plugin GUI continues to run. This code
+ // prevents the main GUI from being frozen.
+
+ do {
+#ifdef GDK_WINDOWING_X11
+ gtk_main_iteration_do(false);
+#else
+ gtk_main_iteration()
+#endif
+ } while (gtk_events_pending());
+#endif
+ printf("audioMasterIdle\n");
+
if (effect) {
effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f);
}
@@ -404,7 +422,7 @@ intptr_t Session::vst_callback (
case audioMasterCanDo:
SHOW_CALLBACK ("amc: audioMasterCanDo\n");
- // string in ptr, see below
+ // string in ptr, (const char*)ptr
return 0;
case audioMasterGetLanguage:
diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc
index 5c9c94bdac..f22ddf525e 100644
--- a/libs/ardour/vst_plugin.cc
+++ b/libs/ardour/vst_plugin.cc
@@ -351,8 +351,30 @@ VSTPlugin::load_plugin_preset (PresetRecord r)
#else
sscanf (r.uri.c_str(), "VST:%d:%d", &id, &index);
#endif
+
+#ifdef PLATFORM_WINDOWS
+ int const vst_version = _plugin->dispatcher (_plugin, effGetVstVersion, 0, 0, NULL, 0);
+ if (vst_version >= 2) {
+ _plugin->dispatcher (_plugin, effBeginSetProgram, 0, 0, NULL, 0);
+ }
+
+ _plugin->dispatcher (_plugin, effSetProgram, 0, index, NULL, 0);
+
+ if (vst_version >= 2) {
+ _plugin->dispatcher (_plugin, effEndSetProgram, 0, 0, NULL, 0);
+ }
+
+ //unfortunately, we don't get any opcodes back from the plugin when this happens (?!)
+ //so we have to manually update param values from the plugin to our listeners
+ for (int n = 0; n < parameter_count(); n++ ) {
+ float p = get_parameter(n); //ask the plugin what its new setting is
+ Plugin::set_parameter (which, newval);
+ }
+
+#else
_state->want_program = index;
+#endif
return true;
}