Revert "case insensitive ".dll" for VST plugins - fixes #6285"
[ardour.git] / libs / ardour / vst_info_file.cc
index da49d1b8eb79fd18ca30ff9f02a7cd14999e16da..2d68421103d0d14930f8ff9d5925ba333d39540f 100644 (file)
@@ -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<char*> ("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<char*> ("sendVstEvents"), 0.0f) > 0)
+                      || (plugin->dispatcher (plugin, effCanDo, 0, 0, const_cast<char*> ("sendVstMidiEvent"), 0.0f) > 0)
                         ) {
                        return true;
                }
@@ -712,7 +737,6 @@ vstfx_info_from_plugin (const char *dllpath, VSTState* vstfx, vector<VSTInfo *>
                int id;
                vector< pair<int, string> > ids;
                AEffect *plugin = vstfx->plugin;
-               string path = vstfx->handle->path;
 
                do {
                        char name[65] = "Unknown";