summaryrefslogtreecommitdiff
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
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
-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
-rw-r--r--libs/fst/fst.h49
-rw-r--r--libs/fst/fstinfofile.c68
-rw-r--r--libs/fst/jackvst.h2
-rw-r--r--libs/fst/vstwin.c12
13 files changed, 144 insertions, 178 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());
diff --git a/libs/fst/fst.h b/libs/fst/fst.h
index f4482ec377..545bfaf165 100644
--- a/libs/fst/fst.h
+++ b/libs/fst/fst.h
@@ -29,50 +29,13 @@ void fst_set_error_function (void (*func)(const char *));
void fst_error (const char *fmt, ...);
typedef struct _FST FST;
-typedef struct _FSTHandle FSTHandle;
-typedef struct _FSTInfo FSTInfo;
-
-struct _FSTInfo
-{
- char *name;
- char *creator;
- int UniqueID;
- char *Category;
-
- int numInputs;
- int numOutputs;
- int numParams;
-
- int wantMidi;
- int wantEvents;
- int hasEditor;
- int canProcessReplacing; // what do we need this for ?
-
- // i think we should save the parameter Info Stuff soon.
- // struct VstParameterInfo *infos;
- char **ParamNames;
- char **ParamLabels;
-};
-
-typedef AEffect * (*main_entry_t)(audioMasterCallback);
-
-struct _FSTHandle
-{
- void* dll;
- char* name;
- char* nameptr; /* ptr returned from strdup() etc. */
- //struct AEffect* (*main_entry)(audioMasterCallback);
- main_entry_t main_entry;
-
- int plugincnt;
-};
struct _FST
{
AEffect* plugin;
void* window; /* win32 HWND */
int xid; /* X11 XWindow */
- FSTHandle* handle;
+ VSTHandle* handle;
int width;
int height;
int wantIdle;
@@ -114,10 +77,10 @@ extern "C" {
extern int fst_init (void* possible_hmodule);
extern void fst_exit ();
-extern FSTHandle* fst_load (const char*);
-extern int fst_unload (FSTHandle*);
+extern VSTHandle* fst_load (const char*);
+extern int fst_unload (VSTHandle*);
-extern FST* fst_instantiate (FSTHandle*, audioMasterCallback amc, void* userptr);
+extern FST* fst_instantiate (VSTHandle*, audioMasterCallback amc, void* userptr);
extern void fst_close (FST*);
extern int fst_create_editor (FST* fst);
@@ -126,8 +89,8 @@ extern void fst_destroy_editor (FST*);
extern int fst_get_XID (FST*);
extern void fst_move_window_into_view (FST*);
-extern FSTInfo *fst_get_info (char *dllpathname);
-extern void fst_free_info (FSTInfo *info);
+extern VSTInfo *fst_get_info (char *dllpathname);
+extern void fst_free_info (VSTInfo *info);
extern void fst_event_loop_remove_plugin (FST* fst);
extern int fst_call_dispatcher(FST *fst, int opcode, int index, int val, void *ptr, float opt );
diff --git a/libs/fst/fstinfofile.c b/libs/fst/fstinfofile.c
index d848d3ae34..dec6db760a 100644
--- a/libs/fst/fstinfofile.c
+++ b/libs/fst/fstinfofile.c
@@ -31,22 +31,23 @@ static char *read_string( FILE *fp ) {
}
}
-static FSTInfo *load_fst_info_file( char *filename ) {
-
- FSTInfo *info = (FSTInfo *) malloc( sizeof( FSTInfo ) );
- FILE *fp;
- int i;
-
-
- if( info == NULL )
- return NULL;
+static VSTInfo *
+load_fst_info_file (char* filename)
+{
+ VSTInfo *info = (VSTInfo *) malloc (sizeof (VSTInfo));
+ FILE *fp;
+ int i;
+
+ if (info == NULL) {
+ return NULL;
+ }
- fp = fopen( filename, "r" );
-
- if( fp == NULL ) {
- free( info );
- return NULL;
- }
+ fp = fopen( filename, "r" );
+
+ if (fp == NULL) {
+ free (info);
+ return NULL;
+ }
if( (info->name = read_string( fp )) == NULL ) goto error;
if( (info->creator = read_string( fp )) == NULL ) goto error;
@@ -78,8 +79,9 @@ error:
return NULL;
}
-static int save_fst_info_file( FSTInfo *info, char *filename ) {
-
+static int
+save_fst_info_file (VSTInfo* info, char* filename)
+{
FILE *fp;
int i;
@@ -162,10 +164,10 @@ fst_can_midi (FST *fst)
return FALSE;
}
-static FSTInfo *
+static VSTInfo *
fst_info_from_plugin (FST* fst)
{
- FSTInfo* info = (FSTInfo *) malloc( sizeof( FSTInfo ) );
+ VSTInfo* info = (VSTInfo *) malloc (sizeof (VSTInfo));
AEffect* plugin;
int i;
char creator[65];
@@ -226,21 +228,22 @@ simple_master_callback (AEffect *fx, int32_t opcode, int32_t index, intptr_t val
}
}
-FSTInfo *fst_get_info( char *dllpath ) {
-
- if( fst_info_file_is_valid( dllpath ) ) {
- FSTInfo *info;
- char *fstpath = fst_dllpath_to_infopath( dllpath );
-
- info = load_fst_info_file( fstpath );
- free( fstpath );
- return info;
+VSTInfo *
+fst_get_info (char* dllpath)
+{
+ if( fst_info_file_is_valid( dllpath ) ) {
+ VSTInfo *info;
+ char *fstpath = fst_dllpath_to_infopath( dllpath );
+
+ info = load_fst_info_file( fstpath );
+ free( fstpath );
+ return info;
} else {
- FSTHandle *h;
+ VSTHandle *h;
FST *fst;
- FSTInfo *info;
+ VSTInfo *info;
char *fstpath;
if( !(h = fst_load( dllpath )) ) return NULL;
@@ -266,8 +269,9 @@ FSTInfo *fst_get_info( char *dllpath ) {
}
}
-void fst_free_info( FSTInfo *info ) {
-
+void
+fst_free_info (VSTInfo *info)
+{
int i;
for( i=0; i<info->numParams; i++ ) {
diff --git a/libs/fst/jackvst.h b/libs/fst/jackvst.h
index 31e34f55b9..28c6f05852 100644
--- a/libs/fst/jackvst.h
+++ b/libs/fst/jackvst.h
@@ -12,7 +12,7 @@ typedef struct _JackVST JackVST;
struct _JackVST {
jack_client_t *client;
- FSTHandle* handle;
+ VSTHandle* handle;
FST* fst;
float **ins;
float **outs;
diff --git a/libs/fst/vstwin.c b/libs/fst/vstwin.c
index cdc9e3af07..91a25e5852 100644
--- a/libs/fst/vstwin.c
+++ b/libs/fst/vstwin.c
@@ -84,10 +84,10 @@ fst_new ()
return fst;
}
-static FSTHandle*
+static VSTHandle*
fst_handle_new ()
{
- FSTHandle* fst = (FSTHandle*) calloc (1, sizeof (FSTHandle));
+ VSTHandle* fst = (VSTHandle*) calloc (1, sizeof (VSTHandle));
return fst;
}
@@ -522,11 +522,11 @@ fst_load_vst_library(const char * path)
return dll;
}
-FSTHandle*
+VSTHandle *
fst_load (const char *path)
{
char* buf;
- FSTHandle* fhandle;
+ VSTHandle* fhandle;
char* period;
fhandle = fst_handle_new ();
@@ -581,7 +581,7 @@ fst_load (const char *path)
}
int
-fst_unload (FSTHandle* fhandle)
+fst_unload (VSTHandle* fhandle)
{
if (fhandle->plugincnt) {
return -1;
@@ -602,7 +602,7 @@ fst_unload (FSTHandle* fhandle)
}
FST*
-fst_instantiate (FSTHandle* fhandle, audioMasterCallback amc, void* userptr)
+fst_instantiate (VSTHandle* fhandle, audioMasterCallback amc, void* userptr)
{
FST* fst = fst_new ();