detect VST midi-in/midi-out ports separately.

This commit is contained in:
Robin Gareus 2014-03-03 13:35:09 +01:00
parent 76fb7278dd
commit 6442f316d4
2 changed files with 32 additions and 5 deletions

View File

@ -713,7 +713,8 @@ PluginManager::windows_vst_discover (string path, bool cache_only)
info->index = 0;
info->n_inputs.set_audio (finfo->numInputs);
info->n_outputs.set_audio (finfo->numOutputs);
info->n_inputs.set_midi (finfo->wantMidi ? 1 : 0);
info->n_inputs.set_midi ((finfo->wantMidi&1) ? 1 : 0);
info->n_outputs.set_midi ((finfo->wantMidi&2) ? 1 : 0);
info->type = ARDOUR::Windows_VST;
// TODO: check dup-IDs (lxvst AND windows vst)
@ -833,7 +834,8 @@ PluginManager::lxvst_discover (string path, bool cache_only)
info->index = 0;
info->n_inputs.set_audio (finfo->numInputs);
info->n_outputs.set_audio (finfo->numOutputs);
info->n_inputs.set_midi (finfo->wantMidi ? 1 : 0);
info->n_inputs.set_midi ((finfo->wantMidi&1) ? 1 : 0);
info->n_outputs.set_midi ((finfo->wantMidi&2) ? 1 : 0);
info->type = ARDOUR::LXVST;
/* Make sure we don't find the same plugin in more than one place along

View File

@ -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);