summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-11-22 01:28:34 +0000
committerCarl Hetherington <carl@carlh.net>2011-11-22 01:28:34 +0000
commitff98e0490d240e1010da92460601b0e7fb5ee848 (patch)
tree10a7e8c1c3a319ba6abb6584659bf942374842a2 /libs/ardour
parentd98b2b6039f4733bc264046810d56c5b56ddb288 (diff)
Share VSTHandle and VSTInfo between windows/linux VSTs.
git-svn-id: svn://localhost/ardour2/branches/3.0@10758 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rwxr-xr-xlibs/ardour/ardour/lxvst_plugin.h8
-rw-r--r--libs/ardour/ardour/vst_types.h39
-rwxr-xr-xlibs/ardour/ardour/vstfx.h61
-rw-r--r--libs/ardour/ardour/windows_vst_plugin.h8
-rwxr-xr-xlibs/ardour/lxvst_plugin.cc4
-rw-r--r--libs/ardour/plugin_manager.cc4
-rwxr-xr-xlibs/ardour/vstfx.cc16
-rwxr-xr-xlibs/ardour/vstfxinfofile.cc47
-rw-r--r--libs/ardour/windows_vst_plugin.cc4
9 files changed, 95 insertions, 96 deletions
diff --git a/libs/ardour/ardour/lxvst_plugin.h b/libs/ardour/ardour/lxvst_plugin.h
index db0d5cd953..9384014100 100755
--- a/libs/ardour/ardour/lxvst_plugin.h
+++ b/libs/ardour/ardour/lxvst_plugin.h
@@ -30,9 +30,9 @@
#include "pbd/stateful.h"
#include "ardour/plugin.h"
-struct _VSTFXHandle;
+struct _VSTHandle;
struct _VSTFX;
-typedef struct _VSTFXHandle VSTFXHandle;
+typedef struct _VSTHandle VSTHandle;
typedef struct _VSTFX VSTFX;
struct _AEffect;
typedef struct _AEffect AEffect;
@@ -44,7 +44,7 @@ class Session;
class LXVSTPlugin : public ARDOUR::Plugin
{
public:
- LXVSTPlugin (ARDOUR::AudioEngine&, ARDOUR::Session&, VSTFXHandle* handle);
+ LXVSTPlugin (ARDOUR::AudioEngine&, ARDOUR::Session&, VSTHandle *);
LXVSTPlugin (const LXVSTPlugin &);
~LXVSTPlugin ();
@@ -102,7 +102,7 @@ private:
bool load_plugin_preset (PresetRecord);
void add_state (XMLNode *) const;
- VSTFXHandle* handle;
+ VSTHandle * handle;
VSTFX* _vstfx;
AEffect* _plugin;
bool been_resumed;
diff --git a/libs/ardour/ardour/vst_types.h b/libs/ardour/ardour/vst_types.h
index 5e97427d9b..f441844e2d 100644
--- a/libs/ardour/ardour/vst_types.h
+++ b/libs/ardour/ardour/vst_types.h
@@ -20,6 +20,8 @@
#ifndef __ardour_vst_types_h__
#define __ardour_vst_types_h__
+#include "ardour/vestige/aeffectx.h"
+
struct _VSTKey
{
/** virtual-key code, or 0 if this _VSTFXKey is a `character' key */
@@ -30,4 +32,41 @@ struct _VSTKey
typedef struct _VSTKey VSTKey;
+struct _VSTInfo
+{
+ char *name;
+ char *creator;
+ int UniqueID;
+ char *Category;
+
+ int numInputs;
+ int numOutputs;
+ int numParams;
+
+ int wantMidi;
+ int wantEvents;
+ int hasEditor;
+ int canProcessReplacing;
+
+ char** ParamNames;
+ char** ParamLabels;
+};
+
+typedef struct _VSTInfo VSTInfo;
+
+typedef AEffect * (* main_entry_t) (audioMasterCallback);
+
+struct _VSTHandle
+{
+ void* dll;
+ char* name;
+ char* nameptr;
+
+ main_entry_t main_entry;
+
+ int plugincnt;
+};
+
+typedef struct _VSTHandle VSTHandle;
+
#endif
diff --git a/libs/ardour/ardour/vstfx.h b/libs/ardour/ardour/vstfx.h
index 7ddc5c39ec..08534e408a 100755
--- a/libs/ardour/ardour/vstfx.h
+++ b/libs/ardour/ardour/vstfx.h
@@ -18,54 +18,9 @@ void vstfx_set_error_function (void (*func)(const char *));
void vstfx_error (const char *fmt, ...);
-#include <ardour/vestige/aeffectx.h>
+#include "ardour/vestige/aeffectx.h"
typedef struct _VSTFX VSTFX;
-typedef struct _VSTFXHandle VSTFXHandle;
-typedef struct _VSTFXInfo VSTFXInfo;
-
-
-/*Struct to contain the info about a plugin*/
-
-struct _VSTFXInfo
-{
- char *name;
- char *creator;
- int UniqueID;
- char *Category;
-
- int numInputs;
- int numOutputs;
- int numParams;
-
- int wantMidi;
- int wantEvents;
- int hasEditor;
- int canProcessReplacing;
-
- /* i think we should save the parameter Info Stuff soon. */
- // struct VstParameterInfo *infos;
- char **ParamNames;
- char **ParamLabels;
-};
-
-/*The AEffect which contains the info about a plugin instance*/
-
-typedef AEffect * (*main_entry_t) (audioMasterCallback);
-
-/*A handle used to identify a plugin to vstfx*/
-
-struct _VSTFXHandle
-{
- void* dll;
- char* name;
- char* nameptr; /* ptr returned from strdup() etc. */
-
- main_entry_t main_entry;
-
- int plugincnt;
-};
-
/*Structure used to describe the instance of VSTFX responsible for
a particular plugin instance. These are connected together in a
@@ -84,7 +39,7 @@ struct _VSTFX
void* event_callback_thisptr;
void (*eventProc) (void* event);
- VSTFXHandle* handle;
+ VSTHandle* handle;
int width;
int height;
@@ -127,9 +82,9 @@ struct _VSTFX
extern int vstfx_launch_editor(VSTFX* vstfx);
extern int vstfx_init (void* possible_hmodule);
extern void vstfx_exit ();
-extern VSTFXHandle* vstfx_load (const char*);
-extern int vstfx_unload (VSTFXHandle*);
-extern VSTFX* vstfx_instantiate (VSTFXHandle*, audioMasterCallback amc, void* userptr);
+extern VSTHandle * vstfx_load (const char*);
+extern int vstfx_unload (VSTHandle *);
+extern VSTFX* vstfx_instantiate (VSTHandle *, audioMasterCallback, void *);
extern void vstfx_close (VSTFX*);
extern int vstfx_create_editor (VSTFX* vstfx);
@@ -138,10 +93,10 @@ extern void vstfx_destroy_editor (VSTFX*);
extern int vstfx_get_XID (VSTFX*);
extern void vstfx_move_window_into_view (VSTFX*);
-extern VSTFXInfo* vstfx_get_info (char *dllpathname);
-extern void vstfx_free_info (VSTFXInfo *info);
+extern VSTInfo * vstfx_get_info (char *dllpathname);
+extern void vstfx_free_info (VSTInfo *);
extern void vstfx_event_loop_remove_plugin (VSTFX* fst);
-extern int vstfx_call_dispatcher(VSTFX *vstfx, int opcode, int index, int val, void *ptr, float opt );
+extern int vstfx_call_dispatcher (VSTFX *vstfx, int opcode, int index, int val, void *ptr, float opt);
/** Load a plugin state from a file.**/
diff --git a/libs/ardour/ardour/windows_vst_plugin.h b/libs/ardour/ardour/windows_vst_plugin.h
index e4b23fc46e..973c25e6b0 100644
--- a/libs/ardour/ardour/windows_vst_plugin.h
+++ b/libs/ardour/ardour/windows_vst_plugin.h
@@ -30,12 +30,12 @@
#include "pbd/stateful.h"
#include "ardour/plugin.h"
-struct _FSTHandle;
-typedef struct _FSTHandle FSTHandle;
struct _FST;
typedef struct _FST FST;
struct _AEffect;
typedef struct _AEffect AEffect;
+struct _VSTHandle;
+typedef struct _VSTHandle VSTHandle;
namespace ARDOUR {
class AudioEngine;
@@ -44,7 +44,7 @@ class Session;
class WindowsVSTPlugin : public ARDOUR::Plugin
{
public:
- WindowsVSTPlugin (ARDOUR::AudioEngine&, ARDOUR::Session&, FSTHandle* handle);
+ WindowsVSTPlugin (ARDOUR::AudioEngine&, ARDOUR::Session&, VSTHandle *);
WindowsVSTPlugin (const WindowsVSTPlugin &);
~WindowsVSTPlugin ();
@@ -102,7 +102,7 @@ private:
bool load_plugin_preset (PresetRecord);
void add_state (XMLNode *) const;
- FSTHandle* handle;
+ VSTHandle* handle;
FST* _fst;
AEffect* _plugin;
bool been_resumed;
diff --git a/libs/ardour/lxvst_plugin.cc b/libs/ardour/lxvst_plugin.cc
index 6f4cb557e3..e2a33bef89 100755
--- a/libs/ardour/lxvst_plugin.cc
+++ b/libs/ardour/lxvst_plugin.cc
@@ -67,7 +67,7 @@ using namespace PBD;
using std::min;
using std::max;
-LXVSTPlugin::LXVSTPlugin (AudioEngine& e, Session& session, VSTFXHandle* h)
+LXVSTPlugin::LXVSTPlugin (AudioEngine& e, Session& session, VSTHandle* h)
: Plugin (e, session)
{
handle = h;
@@ -636,7 +636,7 @@ LXVSTPluginInfo::load (Session& session)
PluginPtr plugin;
if (Config->get_use_lxvst()) {
- VSTFXHandle* handle;
+ VSTHandle* handle;
handle = vstfx_load(path.c_str());
diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc
index dc7b3bc0d3..0cfbdd17eb 100644
--- a/libs/ardour/plugin_manager.cc
+++ b/libs/ardour/plugin_manager.cc
@@ -587,7 +587,7 @@ PluginManager::windows_vst_discover_from_path (string path)
int
PluginManager::windows_vst_discover (string path)
{
- FSTInfo* finfo;
+ VSTInfo* finfo;
char buf[32];
if ((finfo = fst_get_info (const_cast<char *> (path.c_str()))) == 0) {
@@ -692,7 +692,7 @@ PluginManager::lxvst_discover_from_path (string path)
int
PluginManager::lxvst_discover (string path)
{
- VSTFXInfo* finfo;
+ VSTInfo* finfo;
char buf[32];
if ((finfo = vstfx_get_info (const_cast<char *> (path.c_str()))) == 0) {
diff --git a/libs/ardour/vstfx.cc b/libs/ardour/vstfx.cc
index ef9112d096..a150ead8ae 100755
--- a/libs/ardour/vstfx.cc
+++ b/libs/ardour/vstfx.cc
@@ -44,9 +44,10 @@ void (*vstfx_error_callback)(const char *desc) = &default_vstfx_error_callback;
/*Create and return a pointer to a new VSTFX handle*/
-VSTFXHandle* vstfx_handle_new()
+VSTHandle *
+vstfx_handle_new ()
{
- VSTFXHandle* vstfx = (VSTFXHandle*)calloc(1, sizeof (VSTFXHandle));
+ VSTHandle* vstfx = (VSTHandle *) calloc (1, sizeof (VSTHandle));
return vstfx;
}
@@ -156,10 +157,11 @@ void* vstfx_load_vst_library(const char* path)
/*This loads up a plugin, given the path to its .so file and
finds its main entry point etc*/
-VSTFXHandle* vstfx_load (const char *path)
+VSTHandle *
+vstfx_load (const char *path)
{
char* buf = NULL;
- VSTFXHandle* fhandle;
+ VSTHandle* fhandle;
int i;
/*Create a new handle we can use to reference the plugin*/
@@ -235,7 +237,8 @@ VSTFXHandle* vstfx_load (const char *path)
/*This unloads a plugin*/
-int vstfx_unload (VSTFXHandle* fhandle)
+int
+vstfx_unload (VSTHandle* fhandle)
{
if (fhandle->plugincnt)
{
@@ -267,7 +270,8 @@ int vstfx_unload (VSTFXHandle* fhandle)
/*This instantiates a plugin*/
-VSTFX* vstfx_instantiate (VSTFXHandle* fhandle, audioMasterCallback amc, void* userptr)
+VSTFX *
+vstfx_instantiate (VSTHandle* fhandle, audioMasterCallback amc, void* userptr)
{
VSTFX* vstfx = vstfx_new ();
diff --git a/libs/ardour/vstfxinfofile.cc b/libs/ardour/vstfxinfofile.cc
index 9c613c654f..e44e16f5c5 100755
--- a/libs/ardour/vstfxinfofile.cc
+++ b/libs/ardour/vstfxinfofile.cc
@@ -42,12 +42,13 @@ static char* read_string(FILE *fp)
}
}
-static VSTFXInfo* load_vstfx_info_file(FILE* fp)
+static VSTInfo *
+load_vstfx_info_file (FILE* fp)
{
- VSTFXInfo *info;
+ VSTInfo *info;
int i;
- if ((info = (VSTFXInfo*) malloc(sizeof(VSTFXInfo))) == 0) {
+ if ((info = (VSTInfo*) malloc (sizeof (VSTInfo))) == 0) {
return 0;
}
@@ -85,7 +86,8 @@ static VSTFXInfo* load_vstfx_info_file(FILE* fp)
return 0;
}
-static int save_vstfx_info_file(VSTFXInfo *info, FILE* fp)
+static int
+save_vstfx_info_file (VSTInfo *info, FILE* fp)
{
int i;
@@ -271,10 +273,10 @@ static int vstfx_can_midi(VSTFX *vstfx)
return false;
}
-static VSTFXInfo* vstfx_info_from_plugin(VSTFX *vstfx)
+static VSTInfo *
+vstfx_info_from_plugin (VSTFX *vstfx)
{
-
- VSTFXInfo* info = (VSTFXInfo*) malloc(sizeof(VSTFXInfo));
+ VSTInfo* info = (VSTInfo*) malloc (sizeof (VSTInfo));
AEffect *plugin;
int i;
@@ -359,15 +361,16 @@ simple_master_callback (AEffect *, int32_t opcode, int32_t, intptr_t, void *, fl
data, and if that doesn't exist, load the plugin, get its data and
then cache it for future ref*/
-VSTFXInfo *vstfx_get_info(char *dllpath)
+VSTInfo *
+vstfx_get_info (char* dllpath)
{
FILE* infofile;
- VSTFXHandle *h;
+ VSTHandle *h;
VSTFX *vstfx;
- VSTFXInfo *info;
+ VSTInfo *info;
if ((infofile = vstfx_infofile_for_read (dllpath)) != 0) {
- VSTFXInfo *info;
+ VSTInfo *info;
info = load_vstfx_info_file (infofile);
fclose (infofile);
return info;
@@ -402,20 +405,18 @@ VSTFXInfo *vstfx_get_info(char *dllpath)
return info;
}
-void vstfx_free_info(VSTFXInfo *info )
+void
+vstfx_free_info (VSTInfo *info)
{
- int i;
-
- for(i=0; i < info->numParams; i++)
- {
- free(info->ParamNames[i]);
- free(info->ParamLabels[i]);
- }
+ for (int i = 0; i < info->numParams; i++) {
+ free (info->ParamNames[i]);
+ free (info->ParamLabels[i]);
+ }
- free(info->name);
- free(info->creator);
- free(info->Category);
- free(info);
+ free (info->name);
+ free (info->creator);
+ free (info->Category);
+ free (info);
}
diff --git a/libs/ardour/windows_vst_plugin.cc b/libs/ardour/windows_vst_plugin.cc
index 73aa839ac6..96294d6cd3 100644
--- a/libs/ardour/windows_vst_plugin.cc
+++ b/libs/ardour/windows_vst_plugin.cc
@@ -61,7 +61,7 @@ using namespace PBD;
using std::min;
using std::max;
-WindowsVSTPlugin::WindowsVSTPlugin (AudioEngine& e, Session& session, FSTHandle* h)
+WindowsVSTPlugin::WindowsVSTPlugin (AudioEngine& e, Session& session, VSTHandle* h)
: Plugin (e, session)
{
handle = h;
@@ -683,7 +683,7 @@ WindowsVSTPluginInfo::load (Session& session)
PluginPtr plugin;
if (Config->get_use_windows_vst ()) {
- FSTHandle* handle;
+ VSTHandle* handle;
handle = fst_load(path.c_str());