summaryrefslogtreecommitdiff
path: root/libs/ardour/vst_info_file.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-03-03 13:35:09 +0100
committerRobin Gareus <robin@gareus.org>2014-03-03 13:35:09 +0100
commit6442f316d4fa49847d19a3cb6b27dff45f588881 (patch)
tree193fbed29fb0def61d82e093081baa6b4b38043e /libs/ardour/vst_info_file.cc
parent76fb7278dd1b83660ee70f1d11fc912806ed892e (diff)
detect VST midi-in/midi-out ports separately.
Diffstat (limited to 'libs/ardour/vst_info_file.cc')
-rw-r--r--libs/ardour/vst_info_file.cc31
1 files changed, 28 insertions, 3 deletions
diff --git a/libs/ardour/vst_info_file.cc b/libs/ardour/vst_info_file.cc
index e6ab197fd0..d7b83fcab8 100644
--- a/libs/ardour/vst_info_file.cc
+++ b/libs/ardour/vst_info_file.cc
@@ -147,6 +147,11 @@ vstfx_load_info_block(FILE* fp, VSTInfo *info)
if (read_int (fp, &info->hasEditor)) return false;
if (read_int (fp, &info->canProcessReplacing)) return false;
+ /* backwards compatibility with old .fsi files */
+ if (info->wantMidi == -1) {
+ info->wantMidi = 1;
+ }
+
if ((info->ParamNames = (char **) malloc(sizeof(char*)*info->numParams)) == 0) {
return false;
}
@@ -434,7 +439,7 @@ vstfx_infofile_for_write (const char* dllpath)
}
static
-int vstfx_can_midi (VSTState* vstfx)
+bool vstfx_midi_input (VSTState* vstfx)
{
AEffect* plugin = vstfx->plugin;
@@ -444,7 +449,27 @@ int vstfx_can_midi (VSTState* vstfx)
/* should we send it VST events (i.e. MIDI) */
if ((plugin->flags & effFlagsIsSynth) || (plugin->dispatcher (plugin, effCanDo, 0, 0,(void*) "receiveVstEvents", 0.0f) > 0)) {
- return -1;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+static
+bool vstfx_midi_output (VSTState* vstfx)
+{
+ AEffect* plugin = vstfx->plugin;
+
+ int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, 0, 0.0f);
+
+ if (vst_version >= 2) {
+ /* should we send it VST events (i.e. MIDI) */
+
+ if ( (plugin->dispatcher (plugin, effCanDo, 0, 0,(void*) "sendVstEvents", 0.0f) > 0)
+ || (plugin->dispatcher (plugin, effCanDo, 0, 0,(void*) "sendVstMidiEvent", 0.0f) > 0)
+ ) {
+ return true;
}
}
@@ -507,7 +532,7 @@ vstfx_parse_vst_state (VSTState* vstfx)
info->numInputs = plugin->numInputs;
info->numOutputs = plugin->numOutputs;
info->numParams = plugin->numParams;
- info->wantMidi = vstfx_can_midi(vstfx);
+ info->wantMidi = (vstfx_midi_input(vstfx) ? 1 : 0) | (vstfx_midi_output(vstfx) ? 2 : 0);
info->hasEditor = plugin->flags & effFlagsHasEditor ? true : false;
info->canProcessReplacing = plugin->flags & effFlagsCanReplacing ? true : false;
info->ParamNames = (char **) malloc(sizeof(char*)*info->numParams);