fix reading VST shell-plugin .fsi cache
[ardour.git] / libs / ardour / vst_info_file.cc
index ec1223c11c27c404320a069bf1b7b469c77dbc2e..90076815b37a75ca36585e7d3fbee7e3712ae5e1 100644 (file)
@@ -251,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);
@@ -562,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;
@@ -740,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
 }
@@ -772,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;
 }
@@ -802,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