X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fvst_info_file.cc;h=2d68421103d0d14930f8ff9d5925ba333d39540f;hb=3f2306c4fbecf4ca321a6f32ce7cef8f8b2fc61c;hp=f74bdca771fbedccc0442324849a0d0bf92c3cc4;hpb=0de7c8920b57e9af99597affb1b18e3435fc1f67;p=ardour.git diff --git a/libs/ardour/vst_info_file.cc b/libs/ardour/vst_info_file.cc index f74bdca771..2d68421103 100644 --- a/libs/ardour/vst_info_file.cc +++ b/libs/ardour/vst_info_file.cc @@ -96,7 +96,8 @@ vstfx_cache_file (const char* dllpath, int personal, const char *ext) { string dir; if (personal) { - dir = get_personal_vst_blacklist_dir(); + dir = get_personal_vst_info_cache_dir(); + // TODO prefix path relative to scan-root to avoid duplicates } else { dir = Glib::path_get_dirname (std::string(dllpath)); } @@ -109,7 +110,16 @@ vstfx_cache_file (const char* dllpath, int personal, const char *ext) static string vstfx_blacklist_path (const char* dllpath, int personal) { - return vstfx_cache_file(dllpath, personal, EXT_BLACKLIST); + string dir; + if (personal) { + dir = get_personal_vst_blacklist_dir(); + } else { + dir = Glib::path_get_dirname (std::string(dllpath)); + } + + stringstream s; + s << PFX_DOTFILE << Glib::path_get_basename (dllpath) << EXT_BLACKLIST; + return Glib::build_filename (dir, s.str ()); } static string @@ -218,6 +228,12 @@ vstfx_load_info_block(FILE* fp, VSTInfo *info) info->wantMidi = 1; } + if ((info->numParams) == 0) { + info->ParamNames = NULL; + info->ParamLabels = NULL; + return true; + } + if ((info->ParamNames = (char **) malloc(sizeof(char*)*info->numParams)) == 0) { return false; } @@ -374,10 +390,16 @@ static FILE * vstfx_blacklist_file (const char *dllpath) { FILE *f; - if ((f = fopen (vstfx_blacklist_path (dllpath, 0).c_str(), "w"))) { + if ((f = fopen (vstfx_blacklist_path (dllpath, 0).c_str(), "wb"))) { +#ifndef NDEBUG + PBD::info << "Blacklisted VST: '" << vstfx_blacklist_path (dllpath, 0) << "'" << endmsg; +#endif return f; } - return fopen (vstfx_blacklist_path (dllpath, 1).c_str(), "w"); +#ifndef NDEBUG + PBD::info << "Blacklisted VST: '" << vstfx_blacklist_path (dllpath, 1) << "'" << endmsg; +#endif + return fopen (vstfx_blacklist_path (dllpath, 1).c_str(), "wb"); } /** mark plugin as blacklisted */ @@ -477,7 +499,10 @@ vstfx_infofile_create (const char* dllpath, int personal) } string const path = vstfx_infofile_path (dllpath, personal); - return fopen (path.c_str(), "w"); +#ifndef NDEBUG + PBD::info << "Creating VST cache file " << path << endmsg; +#endif + return fopen (path.c_str(), "wb"); } /** newly created cache file for given plugin @@ -528,7 +553,7 @@ bool vstfx_midi_input (VSTState* vstfx) if (vst_version >= 2) { /* should we send it VST events (i.e. MIDI) */ - if ((plugin->flags & effFlagsIsSynth) || (plugin->dispatcher (plugin, effCanDo, 0, 0,(void*) "receiveVstEvents", 0.0f) > 0)) { + if ((plugin->flags & effFlagsIsSynth) || (plugin->dispatcher (plugin, effCanDo, 0, 0, const_cast ("receiveVstEvents"), 0.0f) > 0)) { return true; } } @@ -546,8 +571,8 @@ bool vstfx_midi_output (VSTState* vstfx) 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) + if ( (plugin->dispatcher (plugin, effCanDo, 0, 0, const_cast ("sendVstEvents"), 0.0f) > 0) + || (plugin->dispatcher (plugin, effCanDo, 0, 0, const_cast ("sendVstMidiEvent"), 0.0f) > 0) ) { return true; } @@ -610,14 +635,26 @@ vstfx_parse_vst_state (VSTState* vstfx) fail to implement getVendorString, and so won't stuff the string with any name*/ - char creator[65] = "Unknown\0"; + char creator[65] = "Unknown"; + char name[65] = ""; AEffect* plugin = vstfx->plugin; - info->name = strdup (vstfx->handle->name); + + plugin->dispatcher (plugin, effGetEffectName, 0, 0, name, 0); + + if (strlen(name) == 0) { + plugin->dispatcher (plugin, effGetProductString, 0, 0, name, 0); + } + + if (strlen(name) == 0) { + info->name = strdup (vstfx->handle->name); + } else { + info->name = strdup (name); + } /*If the plugin doesn't bother to implement GetVendorString we will - have pre-stuffed the string with 'Unkown' */ + have pre-stuffed the string with 'Unknown' */ plugin->dispatcher (plugin, effGetVendorString, 0, 0, creator, 0); @@ -700,10 +737,9 @@ vstfx_info_from_plugin (const char *dllpath, VSTState* vstfx, vector int id; vector< pair > ids; AEffect *plugin = vstfx->plugin; - string path = vstfx->handle->path; do { - char name[65] = "Unknown\0"; + char name[65] = "Unknown"; id = plugin->dispatcher (plugin, effShellGetNextPlugin, 0, 0, name, 0); ids.push_back(std::make_pair(id, name)); } while ( id != 0 );