diff options
author | Carl Hetherington <carl@carlh.net> | 2011-11-22 02:27:26 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-11-22 02:27:26 +0000 |
commit | 16aece1d47ad1c1137d68ab12989cbc94b112c0f (patch) | |
tree | 4d07547a58e4209f3d40642f40907e2b658fef2b /libs/ardour | |
parent | 51e43ae5a7df65c2d0b7c1f2dcec22511cfb8a98 (diff) |
Share main VSTFX / FST struct between windows / linux VSTs.
git-svn-id: svn://localhost/ardour2/branches/3.0@10762 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rwxr-xr-x | libs/ardour/ardour/lxvst_plugin.h | 6 | ||||
-rw-r--r-- | libs/ardour/ardour/vst_types.h | 59 | ||||
-rwxr-xr-x | libs/ardour/ardour/vstfx.h | 87 | ||||
-rw-r--r-- | libs/ardour/ardour/windows_vst_plugin.h | 8 | ||||
-rwxr-xr-x | libs/ardour/vstfx.cc | 19 | ||||
-rwxr-xr-x | libs/ardour/vstfxinfofile.cc | 11 |
6 files changed, 96 insertions, 94 deletions
diff --git a/libs/ardour/ardour/lxvst_plugin.h b/libs/ardour/ardour/lxvst_plugin.h index 9384014100..f47bb140aa 100755 --- a/libs/ardour/ardour/lxvst_plugin.h +++ b/libs/ardour/ardour/lxvst_plugin.h @@ -87,7 +87,7 @@ class LXVSTPlugin : public ARDOUR::Plugin int set_state (XMLNode const &, int); AEffect * plugin () const { return _plugin; } - VSTFX * vstfx () const { return _vstfx; } + VSTState * vstfx () const { return _vstfx; } private: @@ -103,8 +103,8 @@ private: void add_state (XMLNode *) const; VSTHandle * handle; - VSTFX* _vstfx; - AEffect* _plugin; + VSTState * _vstfx; + AEffect * _plugin; bool been_resumed; }; diff --git a/libs/ardour/ardour/vst_types.h b/libs/ardour/ardour/vst_types.h index f441844e2d..9bc64b269f 100644 --- a/libs/ardour/ardour/vst_types.h +++ b/libs/ardour/ardour/vst_types.h @@ -69,4 +69,63 @@ struct _VSTHandle typedef struct _VSTHandle VSTHandle; +struct _VSTState +{ + AEffect* plugin; + + /* Linux */ + int linux_window; /* The plugin's parent X11 XWindow */ + int linux_plugin_ui_window; /*The ID of the plugin UI window created by the plugin*/ + + /* Windows */ + void* windows_window; + + int xid; /* X11 XWindow */ + + int want_resize; /*Set to signal the plugin resized its UI*/ + void* extra_data; /*Pointer to any extra data*/ + + void* event_callback_thisptr; + void (*eventProc) (void* event); + + VSTHandle* handle; + + int width; + int height; + int wantIdle; + int destroy; + int vst_version; + int has_editor; + + int program_set_without_editor; + + int want_program; + int want_chunk; + int n_pending_keys; + unsigned char* wanted_chunk; + int wanted_chunk_size; + int current_program; + float * want_params; + float * set_params; + + VSTKey pending_keys[16]; + + int dispatcher_wantcall; + int dispatcher_opcode; + int dispatcher_index; + int dispatcher_val; + void * dispatcher_ptr; + float dispatcher_opt; + int dispatcher_retval; + + struct _VSTState * next; + pthread_mutex_t lock; + pthread_cond_t window_status_change; + pthread_cond_t plugin_dispatcher_called; + pthread_cond_t window_created; + int been_activated; +}; + +typedef struct _VSTState VSTState; + #endif diff --git a/libs/ardour/ardour/vstfx.h b/libs/ardour/ardour/vstfx.h index 08534e408a..0f8772230b 100755 --- a/libs/ardour/ardour/vstfx.h +++ b/libs/ardour/ardour/vstfx.h @@ -18,93 +18,34 @@ void vstfx_set_error_function (void (*func)(const char *)); void vstfx_error (const char *fmt, ...); -#include "ardour/vestige/aeffectx.h" - -typedef struct _VSTFX VSTFX; - -/*Structure used to describe the instance of VSTFX responsible for - a particular plugin instance. These are connected together in a - linked list*/ - -struct _VSTFX -{ - AEffect* plugin; - int window; /* The plugin's parent X11 XWindow */ - int plugin_ui_window; /*The ID of the plugin UI window created by the plugin*/ - int xid; /* X11 XWindow */ - - int want_resize; /*Set to signal the plugin resized its UI*/ - void* extra_data; /*Pointer to any extra data*/ - - void* event_callback_thisptr; - void (*eventProc) (void* event); - - VSTHandle* handle; - - int width; - int height; - int wantIdle; - int destroy; - int vst_version; - int has_editor; - - int program_set_without_editor; - - int want_program; - int want_chunk; - int n_pending_keys; - unsigned char* wanted_chunk; - int wanted_chunk_size; - int current_program; - float *want_params; - float *set_params; - - VSTKey pending_keys[16]; - - int dispatcher_wantcall; - int dispatcher_opcode; - int dispatcher_index; - int dispatcher_val; - void * dispatcher_ptr; - float dispatcher_opt; - int dispatcher_retval; - - struct _VSTFX* next; - pthread_mutex_t lock; - pthread_cond_t window_status_change; - pthread_cond_t plugin_dispatcher_called; - pthread_cond_t window_created; - int been_activated; -}; - /*API to vstfx*/ -extern int vstfx_launch_editor(VSTFX* vstfx); -extern int vstfx_init (void* possible_hmodule); +extern int vstfx_launch_editor (VSTState *); +extern int vstfx_init (void *); extern void vstfx_exit (); extern VSTHandle * vstfx_load (const char*); extern int vstfx_unload (VSTHandle *); -extern VSTFX* vstfx_instantiate (VSTHandle *, audioMasterCallback, void *); -extern void vstfx_close (VSTFX*); +extern VSTState * vstfx_instantiate (VSTHandle *, audioMasterCallback, void *); +extern void vstfx_close (VSTState*); -extern int vstfx_create_editor (VSTFX* vstfx); -extern int vstfx_run_editor (VSTFX*); -extern void vstfx_destroy_editor (VSTFX*); -extern int vstfx_get_XID (VSTFX*); -extern void vstfx_move_window_into_view (VSTFX*); +extern int vstfx_create_editor (VSTState *); +extern int vstfx_run_editor (VSTState *); +extern void vstfx_destroy_editor (VSTState *); +extern int vstfx_get_XID (VSTState *); +extern void vstfx_move_window_into_view (VSTState *); -extern VSTInfo * vstfx_get_info (char *dllpathname); +extern VSTInfo * vstfx_get_info (char *); 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 void vstfx_event_loop_remove_plugin (VSTState *); +extern int vstfx_call_dispatcher (VSTState *, int, int, int, void *, float); /** Load a plugin state from a file.**/ -extern int vstfx_load_state (VSTFX* vstfx, char * filename); +extern int vstfx_load_state (VSTState* vstfx, char * filename); /** Save a plugin state to a file.**/ -extern bool vstfx_save_state (VSTFX* vstfx, char * filename); +extern bool vstfx_save_state (VSTState* vstfx, char * filename); #endif /* __vstfx_h__ */ diff --git a/libs/ardour/ardour/windows_vst_plugin.h b/libs/ardour/ardour/windows_vst_plugin.h index 973c25e6b0..6de87aee89 100644 --- a/libs/ardour/ardour/windows_vst_plugin.h +++ b/libs/ardour/ardour/windows_vst_plugin.h @@ -30,8 +30,8 @@ #include "pbd/stateful.h" #include "ardour/plugin.h" -struct _FST; -typedef struct _FST FST; +struct _VSTState; +typedef struct _VSTState VSTState; struct _AEffect; typedef struct _AEffect AEffect; struct _VSTHandle; @@ -87,7 +87,7 @@ class WindowsVSTPlugin : public ARDOUR::Plugin int set_state (XMLNode const &, int); AEffect * plugin () const { return _plugin; } - FST * fst () const { return _fst; } + VSTState * fst () const { return _fst; } private: @@ -103,7 +103,7 @@ private: void add_state (XMLNode *) const; VSTHandle* handle; - FST* _fst; + VSTState* _fst; AEffect* _plugin; bool been_resumed; }; diff --git a/libs/ardour/vstfx.cc b/libs/ardour/vstfx.cc index a150ead8ae..4cff1deb25 100755 --- a/libs/ardour/vstfx.cc +++ b/libs/ardour/vstfx.cc @@ -53,9 +53,10 @@ vstfx_handle_new () /*Create and return a pointer to a new vstfx instance*/ -VSTFX* vstfx_new () +VSTState * +vstfx_new () { - VSTFX* vstfx = (VSTFX*) calloc (1, sizeof (VSTFX)); + VSTState* vstfx = (VSTState *) calloc (1, sizeof (VSTState)); /*Mutexes*/ @@ -72,8 +73,8 @@ VSTFX* vstfx_new () vstfx->n_pending_keys = 0; vstfx->has_editor = 0; vstfx->program_set_without_editor = 0; - vstfx->window = 0; - vstfx->plugin_ui_window = 0; + vstfx->linux_window = 0; + vstfx->linux_plugin_ui_window = 0; vstfx->eventProc = NULL; vstfx->extra_data = NULL; vstfx->want_resize = 0; @@ -270,10 +271,10 @@ vstfx_unload (VSTHandle* fhandle) /*This instantiates a plugin*/ -VSTFX * +VSTState * vstfx_instantiate (VSTHandle* fhandle, audioMasterCallback amc, void* userptr) { - VSTFX* vstfx = vstfx_new (); + VSTState* vstfx = vstfx_new (); if(fhandle == NULL) { @@ -315,7 +316,7 @@ vstfx_instantiate (VSTHandle* fhandle, audioMasterCallback amc, void* userptr) /*Close a vstfx instance*/ -void vstfx_close (VSTFX* vstfx) +void vstfx_close (VSTState* vstfx) { vstfx_destroy_editor(vstfx); @@ -358,7 +359,7 @@ void vstfx_close (VSTFX* vstfx) bool -vstfx_save_state (VSTFX* vstfx, char * filename) +vstfx_save_state (VSTState* vstfx, char * filename) { FILE* f = fopen (filename, "wb"); if (f) @@ -460,7 +461,7 @@ vstfx_save_state (VSTFX* vstfx, char * filename) /*Set up a call to the plugins 'dispatcher' function*/ -int vstfx_call_dispatcher (VSTFX *vstfx, int opcode, int index, int val, void *ptr, float opt) +int vstfx_call_dispatcher (VSTState* vstfx, int opcode, int index, int val, void *ptr, float opt) { pthread_mutex_lock (&vstfx->lock); diff --git a/libs/ardour/vstfxinfofile.cc b/libs/ardour/vstfxinfofile.cc index e44e16f5c5..070c646dbe 100755 --- a/libs/ardour/vstfxinfofile.cc +++ b/libs/ardour/vstfxinfofile.cc @@ -257,7 +257,8 @@ static FILE* vstfx_infofile_for_write (char* dllpath) return f; } -static int vstfx_can_midi(VSTFX *vstfx) +static +int vstfx_can_midi (VSTState* vstfx) { AEffect *plugin = vstfx->plugin; @@ -274,7 +275,7 @@ static int vstfx_can_midi(VSTFX *vstfx) } static VSTInfo * -vstfx_info_from_plugin (VSTFX *vstfx) +vstfx_info_from_plugin (VSTState* vstfx) { VSTInfo* info = (VSTInfo*) malloc (sizeof (VSTInfo)); @@ -365,9 +366,9 @@ VSTInfo * vstfx_get_info (char* dllpath) { FILE* infofile; - VSTHandle *h; - VSTFX *vstfx; - VSTInfo *info; + VSTHandle* h; + VSTState* vstfx; + VSTInfo* info; if ((infofile = vstfx_infofile_for_read (dllpath)) != 0) { VSTInfo *info; |