fix reading VST shell-plugin .fsi cache
[ardour.git] / libs / ardour / vst_info_file.cc
index acb2d66579e9ebef9632299dd6ea2e4957e42a2d..90076815b37a75ca36585e7d3fbee7e3712ae5e1 100644 (file)
 #define EXT_ERRORFILE ".err"
 #define EXT_INFOFILE  ".fsi"
 
+#ifdef PLATFORM_WINDOWS
+#define PFX_DOTFILE   ""
+#else
 #define PFX_DOTFILE   "."
+#endif
 
 
 using namespace std;
@@ -247,7 +251,7 @@ vstfx_load_info_file (FILE* fp, vector<VSTInfo*> *infos)
                } else {
                        int plugin_cnt = 0;
                        vstfx_free_info(info);
-                       if (read_int (fp, &plugin_cnt)) {
+                       if (!read_int (fp, &plugin_cnt)) {
                                for (int i = 0; i < plugin_cnt; i++) {
                                        if ((info = (VSTInfo*) calloc (1, sizeof (VSTInfo))) == 0) {
                                                vstfx_clear_info_list(infos);
@@ -558,10 +562,17 @@ static intptr_t
 simple_master_callback (AEffect *, int32_t opcode, int32_t, intptr_t, void *ptr, float)
 {
        const char* vstfx_can_do_strings[] = {
+               "supplyIdle",
+               "sendVstTimeInfo",
+               "sendVstEvents",
+               "sendVstMidiEvent",
+               "receiveVstEvents",
+               "receiveVstMidiEvent",
                "supportShell",
-               "shellCategory"
+               "shellCategory",
+               "shellCategorycurID"
        };
-       const int vstfx_can_do_string_count = 2;
+       const int vstfx_can_do_string_count = 9;
 
        if (opcode == audioMasterVersion) {
                return 2400;
@@ -698,10 +709,10 @@ vstfx_info_from_plugin (const char *dllpath, VSTState* vstfx, vector<VSTInfo *>
 
                switch(type) {
 #ifdef WINDOWS_VST_SUPPORT
-                       case 1: fst_close(vstfx); break;
+                       case ARDOUR::Windows_VST: fst_close(vstfx); break;
 #endif
 #ifdef LXVST_SUPPORT
-                       case 2: vstfx_close (vstfx); break;
+                       case ARDOUR::LXVST: vstfx_close (vstfx); break;
 #endif
                        default: assert(0); break;
                }
@@ -736,6 +747,16 @@ vstfx_info_from_plugin (const char *dllpath, VSTState* vstfx, vector<VSTInfo *>
                                }
                        }
                }
+       } else {
+               switch(type) {
+#ifdef WINDOWS_VST_SUPPORT
+                       case ARDOUR::Windows_VST: fst_close(vstfx); break;
+#endif
+#ifdef LXVST_SUPPORT
+                       case ARDOUR::LXVST: vstfx_close (vstfx); break;
+#endif
+                       default: assert(0); break;
+               }
        }
 #endif
 }
@@ -768,7 +789,6 @@ vstfx_instantiate_and_get_info_lx (
 
        vstfx_info_from_plugin(dllpath, vstfx, infos, ARDOUR::LXVST);
 
-       vstfx_close (vstfx);
        vstfx_unload (h);
        return true;
 }
@@ -798,8 +818,6 @@ vstfx_instantiate_and_get_info_fst (
 
        vstfx_info_from_plugin(dllpath, vstfx, infos, ARDOUR::Windows_VST);
 
-       fst_close(vstfx);
-       //fst_unload(&h); // XXX -> fst_close()
        return true;
 }
 #endif