diff options
author | Robin Gareus <robin@gareus.org> | 2016-11-13 16:31:15 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-11-13 16:35:06 +0100 |
commit | 8b93fb02f38148c25c91ed41a4f12735be38dbf0 (patch) | |
tree | 3c10f8bc025cc8ec5489bd289b5eb27c9c6e5079 /libs/ardour/vst_info_file.cc | |
parent | 43bd7f5db18e2bf4c7de0bcf7f614399576712ab (diff) |
Mac VST-2.x support
Diffstat (limited to 'libs/ardour/vst_info_file.cc')
-rw-r--r-- | libs/ardour/vst_info_file.cc | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/libs/ardour/vst_info_file.cc b/libs/ardour/vst_info_file.cc index 80d2f61a2f..dc780975b3 100644 --- a/libs/ardour/vst_info_file.cc +++ b/libs/ardour/vst_info_file.cc @@ -49,6 +49,7 @@ #include "ardour/filesystem_paths.h" #include "ardour/linux_vst_support.h" +#include "ardour/mac_vst_support.h" #include "ardour/plugin_types.h" #include "ardour/vst_info_file.h" @@ -74,6 +75,10 @@ vstfx_instantiate_and_get_info_fst (const char* dllpath, vector<VSTInfo*> *infos static bool vstfx_instantiate_and_get_info_lx (const char* dllpath, vector<VSTInfo*> *infos, int uniqueID); #endif +#ifdef MACVST_SUPPORT +static bool vstfx_instantiate_and_get_info_mac (const char* dllpath, vector<VSTInfo*> *infos, int uniqueID); +#endif + /* ID for shell plugins */ static int vstfx_current_loading_id = 0; @@ -442,6 +447,8 @@ vstfx_infofile_for_read (const char* dllpath) if ( (slen <= 3 || g_ascii_strcasecmp (&dllpath[slen-3], ".so")) && + (slen <= 4 || g_ascii_strcasecmp (&dllpath[slen-4], ".vst")) + && (slen <= 4 || g_ascii_strcasecmp (&dllpath[slen-4], ".dll")) ) { return 0; @@ -477,6 +484,8 @@ vstfx_infofile_for_write (const char* dllpath) if ( (slen <= 3 || g_ascii_strcasecmp (&dllpath[slen-3], ".so")) && + (slen <= 4 || g_ascii_strcasecmp (&dllpath[slen-4], ".vst")) + && (slen <= 4 || g_ascii_strcasecmp (&dllpath[slen-4], ".dll")) ) { return NULL; @@ -665,6 +674,13 @@ vstfx_parse_vst_state (VSTState* vstfx) info->ParamNames = (char **) malloc (sizeof (char*)*info->numParams); info->ParamLabels = (char **) malloc (sizeof (char*)*info->numParams); +#ifdef __APPLE__ + if (info->hasEditor) { + /* we only support Cocoa UIs (just like Reaper) */ + info->hasEditor = (plugin->dispatcher (plugin, effCanDo, 0, 0, const_cast<char*> ("hasCockosViewAsConfig"), 0.0f) & 0xffff0000) == 0xbeef0000; + } +#endif + for (int i = 0; i < info->numParams; ++i) { char name[64]; char label[64]; @@ -725,6 +741,11 @@ vstfx_info_from_plugin (const char *dllpath, VSTState* vstfx, vector<VSTInfo *> vstfx_close (vstfx); break; #endif +#ifdef MACVST_SUPPORT + case ARDOUR::MacVST: + mac_vst_close (vstfx); + break; +#endif default: assert (0); break; @@ -747,6 +768,11 @@ vstfx_info_from_plugin (const char *dllpath, VSTState* vstfx, vector<VSTInfo *> ok = vstfx_instantiate_and_get_info_lx (dllpath, infos, id); break; #endif +#ifdef MACVST_SUPPORT + case ARDOUR::MacVST: + ok = vstfx_instantiate_and_get_info_mac (dllpath, infos, id); + break; +#endif default: ok = false; break; @@ -778,6 +804,11 @@ vstfx_info_from_plugin (const char *dllpath, VSTState* vstfx, vector<VSTInfo *> vstfx_close (vstfx); break; #endif +#ifdef MACVST_SUPPORT + case ARDOUR::MacVST: + mac_vst_close (vstfx); + break; +#endif default: assert (0); break; @@ -847,7 +878,35 @@ vstfx_instantiate_and_get_info_fst ( } #endif +#ifdef MACVST_SUPPORT +static bool +vstfx_instantiate_and_get_info_mac ( + const char* dllpath, vector<VSTInfo*> *infos, int uniqueID) +{ + printf("vstfx_instantiate_and_get_info_mac %s\n", dllpath); + VSTHandle* h; + VSTState* vstfx; + if (!(h = mac_vst_load (dllpath))) { + PBD::warning << string_compose (_("Cannot get MacVST information from '%1': load failed."), dllpath) << endmsg; + return false; + } + + vstfx_current_loading_id = uniqueID; + + if (!(vstfx = mac_vst_instantiate (h, simple_master_callback, 0))) { + mac_vst_unload (h); + PBD::warning << string_compose (_("Cannot get MacVST information from '%1': instantiation failed."), dllpath) << endmsg; + return false; + } + + vstfx_current_loading_id = 0; + vstfx_info_from_plugin (dllpath, vstfx, infos, ARDOUR::MacVST); + + mac_vst_unload (h); + return true; +} +#endif /* *** ERROR LOGGING *** */ #ifndef VST_SCANNER_APP @@ -994,6 +1053,11 @@ vstfx_get_info (const char* dllpath, enum ARDOUR::PluginType type, enum VSTScanM ok = vstfx_instantiate_and_get_info_lx (dllpath, infos, 0); break; #endif +#ifdef MACVST_SUPPORT + case ARDOUR::MacVST: + ok = vstfx_instantiate_and_get_info_mac (dllpath, infos, 0); + break; +#endif default: ok = false; break; @@ -1038,6 +1102,14 @@ vstfx_get_info_lx (char* dllpath, enum VSTScanMode mode) } #endif +#ifdef MACVST_SUPPORT +vector<VSTInfo *> * +vstfx_get_info_mac (char* dllpath, enum VSTScanMode mode) +{ + return vstfx_get_info (dllpath, ARDOUR::MacVST, mode); +} +#endif + #ifdef WINDOWS_VST_SUPPORT vector<VSTInfo *> * vstfx_get_info_fst (char* dllpath, enum VSTScanMode mode) |