diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-09-20 20:29:47 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-09-20 20:29:47 +0000 |
commit | d4433b9ab384196bb5b8876890863d7939339ee2 (patch) | |
tree | 669f503a04696c7869a14d5c5f6239024ba43e76 /libs/ardour/ardour | |
parent | e09e0035a62ce9f8876b6204682bbb3db474d477 (diff) |
(native) Linux VST support from LinuxDSP
git-svn-id: svn://localhost/ardour2/branches/3.0@10101 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/audioengine.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/buffer_set.h | 6 | ||||
-rw-r--r-- | libs/ardour/ardour/jack_port.h | 1 | ||||
-rwxr-xr-x | libs/ardour/ardour/lxvst_plugin.h | 123 | ||||
-rw-r--r-- | libs/ardour/ardour/plugin_manager.h | 9 | ||||
-rw-r--r-- | libs/ardour/ardour/rc_configuration_vars.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 9 | ||||
-rw-r--r-- | libs/ardour/ardour/sndfile_helpers.h | 7 | ||||
-rw-r--r-- | libs/ardour/ardour/types.h | 3 | ||||
-rwxr-xr-x | libs/ardour/ardour/vestige/aeffectx.h | 316 | ||||
-rwxr-xr-x | libs/ardour/ardour/vstfx.h | 176 |
11 files changed, 642 insertions, 11 deletions
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index 68daadd674..05ca38e43b 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -189,8 +189,6 @@ public: void get_physical_outputs (DataType type, std::vector<std::string>&); void get_physical_inputs (DataType type, std::vector<std::string>&); - void update_total_latencies (); - Port *get_port_by_name (const std::string &); enum TransportState { diff --git a/libs/ardour/ardour/buffer_set.h b/libs/ardour/ardour/buffer_set.h index 724eef6a24..930d708989 100644 --- a/libs/ardour/ardour/buffer_set.h +++ b/libs/ardour/ardour/buffer_set.h @@ -29,7 +29,7 @@ #include "ardour/data_type.h" #include "ardour/types.h" -#ifdef VST_SUPPORT +#if defined VST_SUPPORT || defined LXVST_SUPPORT #include "evoral/MIDIEvent.hpp" struct VstEvents; struct VstMidiEvent; @@ -118,7 +118,7 @@ public: void flush_lv2_midi(bool input, size_t i); #endif -#ifdef VST_SUPPORT +#if defined VST_SUPPORT || defined LXVST_SUPPORT VstEvents* get_vst_midi (size_t); #endif @@ -176,7 +176,7 @@ private: LV2Buffers _lv2_buffers; #endif -#ifdef VST_SUPPORT +#if defined VST_SUPPORT || defined LXVST_SUPPORT class VSTBuffer { public: VSTBuffer (size_t); diff --git a/libs/ardour/ardour/jack_port.h b/libs/ardour/ardour/jack_port.h index 0bb0752d55..edbabaae04 100644 --- a/libs/ardour/ardour/jack_port.h +++ b/libs/ardour/ardour/jack_port.h @@ -104,7 +104,6 @@ class JackPort : public virtual Port, public PortConnectableByName { jack_port_t* _port; int disconnect (); - void recompute_total_latency() const; std::set<std::string> _named_connections; }; diff --git a/libs/ardour/ardour/lxvst_plugin.h b/libs/ardour/ardour/lxvst_plugin.h new file mode 100755 index 0000000000..092a786f95 --- /dev/null +++ b/libs/ardour/ardour/lxvst_plugin.h @@ -0,0 +1,123 @@ +/* + Copyright (C) 2004 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __ardour_lxvst_plugin_h__ +#define __ardour_lxvst_plugin_h__ + +#include <list> +#include <map> +#include <set> +#include <vector> +#include <string> +#include <dlfcn.h> + +#include "pbd/stateful.h" +#include "ardour/plugin.h" + +struct _VSTFXHandle; +struct _VSTFX; +typedef struct _VSTFXHandle VSTFXHandle; +typedef struct _VSTFX VSTFX; +class AEffect; + +namespace ARDOUR { +class AudioEngine; +class Session; + +class LXVSTPlugin : public ARDOUR::Plugin +{ + public: + LXVSTPlugin (ARDOUR::AudioEngine&, ARDOUR::Session&, VSTFXHandle* handle); + LXVSTPlugin (const LXVSTPlugin &); + ~LXVSTPlugin (); + + /* Plugin interface */ + + std::string unique_id() const; + const char * label() const; + const char * name() const; + const char * maker() const; + uint32_t parameter_count() const; + float default_value (uint32_t port); + framecnt_t signal_latency() const; + void set_parameter (uint32_t port, float val); + float get_parameter (uint32_t port) const; + int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const; + std::set<Evoral::Parameter> automatable() const; + uint32_t nth_parameter (uint32_t port, bool& ok) const; + void activate (); + void deactivate (); + int set_block_size (pframes_t); + + int connect_and_run (BufferSet&, + ChanMapping in, ChanMapping out, + pframes_t nframes, framecnt_t offset); + + std::string describe_parameter (Evoral::Parameter); + std::string state_node_name() const { return "lxvst"; } + void print_parameter (uint32_t, char*, uint32_t len) const; + + bool parameter_is_audio(uint32_t i) const { return false; } + bool parameter_is_control(uint32_t i) const { return true; } + bool parameter_is_input(uint32_t i) const { return true; } + bool parameter_is_output(uint32_t i) const { return false; } + + bool load_preset (PresetRecord); + int first_user_preset_index () const; + + bool has_editor () const; + + int set_state (XMLNode const &, int); + + AEffect * plugin () const { return _plugin; } + VSTFX * vstfx () const { return _vstfx; } + +private: + + void do_remove_preset (std::string name); + std::string do_save_preset (std::string name); + gchar* get_chunk (bool) const; + int set_chunk (gchar const *, bool); + XMLTree * presets_tree () const; + std::string presets_file () const; + void find_presets (); + bool load_user_preset (PresetRecord); + bool load_plugin_preset (PresetRecord); + void add_state (XMLNode *) const; + + VSTFXHandle* handle; + VSTFX* _vstfx; + AEffect* _plugin; + bool been_resumed; +}; + +class LXVSTPluginInfo : public PluginInfo +{ + public: + LXVSTPluginInfo (); + ~LXVSTPluginInfo () {} + + PluginPtr load (Session& session); +}; + +typedef boost::shared_ptr<LXVSTPluginInfo> LXVSTPluginInfoPtr; + +} // namespace ARDOUR + +#endif /* __ardour_lxvst_plugin_h__ */ diff --git a/libs/ardour/ardour/plugin_manager.h b/libs/ardour/ardour/plugin_manager.h index 9ba3d8324e..ae534837ce 100644 --- a/libs/ardour/ardour/plugin_manager.h +++ b/libs/ardour/ardour/plugin_manager.h @@ -43,6 +43,7 @@ class PluginManager : public boost::noncopyable { ~PluginManager (); ARDOUR::PluginInfoList &vst_plugin_info (); + ARDOUR::PluginInfoList &lxvst_plugin_info (); ARDOUR::PluginInfoList &ladspa_plugin_info (); ARDOUR::PluginInfoList &lv2_plugin_info (); ARDOUR::PluginInfoList &au_plugin_info (); @@ -51,6 +52,7 @@ class PluginManager : public boost::noncopyable { int add_ladspa_directory (std::string dirpath); int add_vst_directory (std::string dirpath); + int add_lxvst_directory (std::string dirpath); static PluginManager* the_manager() { return _manager; } @@ -95,6 +97,7 @@ class PluginManager : public boost::noncopyable { ARDOUR::PluginInfoList _empty_plugin_info; ARDOUR::PluginInfoList* _vst_plugin_info; + ARDOUR::PluginInfoList* _lxvst_plugin_info; ARDOUR::PluginInfoList* _ladspa_plugin_info; ARDOUR::PluginInfoList* _lv2_plugin_info; ARDOUR::PluginInfoList* _au_plugin_info; @@ -103,13 +106,16 @@ class PluginManager : public boost::noncopyable { std::string ladspa_path; std::string vst_path; + std::string lxvst_path; void ladspa_refresh (); void vst_refresh (); + void lxvst_refresh (); void add_lrdf_data (const std::string &path); void add_ladspa_presets (); void add_vst_presets (); + void add_lxvst_presets (); void add_presets (std::string domain); void au_refresh (); @@ -118,6 +124,9 @@ class PluginManager : public boost::noncopyable { int vst_discover_from_path (std::string path); int vst_discover (std::string path); + + int lxvst_discover_from_path (std::string path); + int lxvst_discover (std::string path); int ladspa_discover_from_path (std::string path); int ladspa_discover (std::string path); diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index 5693bac890..0ec31e3e1b 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -140,6 +140,7 @@ CONFIG_VARIABLE (bool, hiding_groups_deactivates_groups, "hiding-groups-deactiva CONFIG_VARIABLE (bool, verify_remove_last_capture, "verify-remove-last-capture", true) CONFIG_VARIABLE (bool, no_new_session_dialog, "no-new-session-dialog", false) CONFIG_VARIABLE (bool, use_vst, "use-vst", true) +CONFIG_VARIABLE (bool, use_lxvst, "use-lxvst", true) CONFIG_VARIABLE (bool, save_history, "save-history", true) CONFIG_VARIABLE (int32_t, saved_history_depth, "save-history-depth", 20) CONFIG_VARIABLE (int32_t, history_depth, "history-depth", 20) diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 68cf66bd25..2dbb2f08ac 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -741,6 +741,15 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi long value, void* ptr, float opt); + + /*Native linuxVST support*/ + + static long lxvst_callback (AEffect* effect, + long opcode, + long index, + long value, + void* ptr, + float opt); static PBD::Signal0<void> SendFeedback; diff --git a/libs/ardour/ardour/sndfile_helpers.h b/libs/ardour/ardour/sndfile_helpers.h index ed84820b8d..02f486a975 100644 --- a/libs/ardour/ardour/sndfile_helpers.h +++ b/libs/ardour/ardour/sndfile_helpers.h @@ -42,10 +42,9 @@ extern const char * const sndfile_endian_formats_strings[SNDFILE_ENDIAN_FORMATS+ extern int sndfile_endian_formats[SNDFILE_ENDIAN_FORMATS]; -int sndfile_bitdepth_format_from_string (std::string); -int sndfile_header_format_from_string (std::string); -int sndfile_endian_format_from_string (std::string); -std::string sndfile_file_ending_from_string (std::string); +int sndfile_bitdepth_format_by_index (int); +int sndfile_header_format_by_index (int); +int sndfile_endian_format_by_index (int); int sndfile_data_width (int format); diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index e21c588c62..9579c87b7b 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -449,7 +449,8 @@ namespace ARDOUR { AudioUnit, LADSPA, LV2, - VST + VST, + LXVST, }; enum RunContext { diff --git a/libs/ardour/ardour/vestige/aeffectx.h b/libs/ardour/ardour/vestige/aeffectx.h new file mode 100755 index 0000000000..dda128f45e --- /dev/null +++ b/libs/ardour/ardour/vestige/aeffectx.h @@ -0,0 +1,316 @@ +/* + * aeffectx.h - simple header to allow VeSTige compilation and eventually work + * + * Copyright (c) 2006 Javier Serrano Polo <jasp00/at/users.sourceforge.net> + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _AEFFECTX_H +#define _AEFFECTX_H + +#include <stdint.h> + +#define audioMasterAutomate 0 +#define audioMasterVersion 1 +#define audioMasterCurrentId 2 +#define audioMasterIdle 3 +#define audioMasterPinConnected 4 +// unsupported? 5 +#define audioMasterWantMidi 6 +#define audioMasterGetTime 7 +#define audioMasterProcessEvents 8 +#define audioMasterSetTime 9 +#define audioMasterTempoAt 10 +#define audioMasterGetNumAutomatableParameters 11 +#define audioMasterGetParameterQuantization 12 +#define audioMasterIOChanged 13 +#define audioMasterNeedIdle 14 +#define audioMasterSizeWindow 15 +#define audioMasterGetSampleRate 16 +#define audioMasterGetBlockSize 17 +#define audioMasterGetInputLatency 18 +#define audioMasterGetOutputLatency 19 +#define audioMasterGetPreviousPlug 20 +#define audioMasterGetNextPlug 21 +#define audioMasterWillReplaceOrAccumulate 22 +#define audioMasterGetCurrentProcessLevel 23 +#define audioMasterGetAutomationState 24 +#define audioMasterOfflineStart 25 +#define audioMasterOfflineRead 26 +#define audioMasterOfflineWrite 27 +#define audioMasterOfflineGetCurrentPass 28 +#define audioMasterOfflineGetCurrentMetaPass 29 +#define audioMasterSetOutputSampleRate 30 +// unsupported? 31 +#define audioMasterGetSpeakerArrangement 31 // deprecated in 2.4? +#define audioMasterGetVendorString 32 +#define audioMasterGetProductString 33 +#define audioMasterGetVendorVersion 34 +#define audioMasterVendorSpecific 35 +#define audioMasterSetIcon 36 +#define audioMasterCanDo 37 +#define audioMasterGetLanguage 38 +#define audioMasterOpenWindow 39 +#define audioMasterCloseWindow 40 +#define audioMasterGetDirectory 41 +#define audioMasterUpdateDisplay 42 +#define audioMasterBeginEdit 43 +#define audioMasterEndEdit 44 +#define audioMasterOpenFileSelector 45 +#define audioMasterCloseFileSelector 46// currently unused +#define audioMasterEditFile 47// currently unused +#define audioMasterGetChunkFile 48// currently unused +#define audioMasterGetInputSpeakerArrangement 49 // currently unused + +#define effFlagsHasEditor 1 +// very likely +#define effFlagsCanReplacing (1 << 4) +// currently unused +#define effFlagsIsSynth (1 << 8) + +#define effOpen 0 +//currently unused +#define effClose 1 +// currently unused +#define effSetProgram 2 +// currently unused +#define effGetProgram 3 +// currently unused +#define effGetProgramName 5 +#define effGetParamLabel 6 +// currently unused +#define effGetParamName 8 +// this is a guess +#define effSetSampleRate 10 +#define effSetBlockSize 11 +#define effMainsChanged 12 +#define effEditGetRect 13 +#define effEditOpen 14 +#define effEditClose 15 +#define effEditIdle 19 +#define effProcessEvents 25 +#define effGetEffectName 45 +// missing +#define effGetParameterProperties 47 +#define effGetVendorString 47 +#define effGetProductString 48 +#define effGetVendorVersion 49 +// currently unused +#define effCanDo 51 +// currently unused +#define effGetVstVersion 58 + +#ifdef WORDS_BIGENDIAN +// "VstP" +#define kEffectMagic 0x50747356 +#else +// "PtsV" +#define kEffectMagic 0x56737450 +#endif + +#define kVstLangEnglish 1 +#define kVstMidiType 1 +#define kVstTransportPlaying (1 << 1) + +/* validity flags for a VstTimeINfo structure this info comes from the web */ + +#define kVstNanosValid (1 << 8) +#define kVstPpqPosValid (1 << 9) +#define kVstTempoValid (1 << 10) +#define kVstBarsValid (1 << 11) +#define kVstCyclePosValid (1 << 12) +#define kVstTimeSigValid (1 << 13) +#define kVstSmpteValid (1 << 14) +#define kVstClockValid (1 << 15) + +#define kVstTransportChanged 1 + +typedef struct VstMidiEvent +{ + // 00 + int type; + // 04 + int byteSize; + // 08 + int deltaFrames; + // 0c? + int flags; + // 10? + int noteLength; + // 14? + int noteOffset; + // 18 + char midiData[4]; + // 1c? + char detune; + // 1d? + char noteOffVelocity; + // 1e? + char reserved1; + // 1f? + char reserved2; + +} VstMidiEvent; + + + + +typedef struct VstEvent +{ + char dump[sizeof( VstMidiEvent )]; + +} VstEvent ; + + + + +typedef struct VstEvents +{ + // 00 + int numEvents; + // 04 + int reserved; + // 08 + VstEvent * events[]; +} VstEvents; + +/* constants from http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=3740&sid=183f74631fee71a493316735e2b9f28b */ + +enum Vestige2StringConstants +{ + VestigeMaxNameLen = 64, + VestigeMaxLabelLen = 64, + VestigeMaxShortLabelLen = 8, + VestigeMaxCategLabelLen = 24, + VestigeMaxFileNameLen = 100 +}; + +/* this struct taken from http://asseca.com/vst-24-specs/efGetParameterProperties.html */ +struct VstParameterProperties +{ + float stepFloat; /* float step */ + float smallStepFloat; /* small float step */ + float largeStepFloat; /* large float step */ + char label[VestigeMaxLabelLen]; /* parameter label */ + int32_t flags; /* @see VstParameterFlags */ + int32_t minInteger; /* integer minimum */ + int32_t maxInteger; /* integer maximum */ + int32_t stepInteger; /* integer step */ + int32_t largeStepInteger; /* large integer step */ + char shortLabel[VestigeMaxShortLabelLen]; /* short label, recommended: 6 + delimiter */ + int16_t displayIndex; /* index where this parameter should be displayed (starting with 0) */ + int16_t category; /* 0: no category, else group index + 1 */ + int16_t numParametersInCategory; /* number of parameters in category */ + int16_t reserved; /* zero */ + char categoryLabel[VestigeMaxCategLabelLen]; /* category label, e.g. "Osc 1" */ + char future[16]; /* reserved for future use */ +}; + +/* this enum taken from http://asseca.com/vst-24-specs/efGetParameterProperties.html */ +enum VstParameterFlags +{ + kVstParameterIsSwitch = 1 << 0, /* parameter is a switch (on/off) */ + kVstParameterUsesIntegerMinMax = 1 << 1, /* minInteger, maxInteger valid */ + kVstParameterUsesFloatStep = 1 << 2, /* stepFloat, smallStepFloat, largeStepFloat valid */ + kVstParameterUsesIntStep = 1 << 3, /* stepInteger, largeStepInteger valid */ + kVstParameterSupportsDisplayIndex = 1 << 4, /* displayIndex valid */ + kVstParameterSupportsDisplayCategory = 1 << 5, /* category, etc. valid */ + kVstParameterCanRamp = 1 << 6 /* set if parameter value can ramp up/down */ +}; + +typedef struct AEffect +{ + // Never use c++!!! + // 00-03 + int magic; + // dispatcher 04-07 + int (* dispatcher)( struct AEffect * , int , int , int , void * , float ); + // process, quite sure 08-0b + void (* process)( struct AEffect * , float * * , float * * , int ); + // setParameter 0c-0f + void (* setParameter)( struct AEffect * , int , float ); + // getParameter 10-13 + float (* getParameter)( struct AEffect * , int ); + // programs 14-17 + int numPrograms; + // Params 18-1b + int numParams; + // Input 1c-1f + int numInputs; + // Output 20-23 + int numOutputs; + // flags 24-27 + int flags; + // Fill somewhere 28-2b + void * user; + // Zeroes 2c-2f 30-33 34-37 38-3b + char empty3[4 + 4 + 4 + 4]; + // 1.0f 3c-3f + float unkown_float; + // An object? pointer 40-43 + char empty4[4]; + // Zeroes 44-47 + char empty5[4]; + // Id 48-4b + char unused_id[4]; + // Don't know 4c-4f + char unknown1[4]; + // processReplacing 50-53 + void (* processReplacing)( struct AEffect * , float * * , float * * , int ); + + int uniqueID; + +} AEffect; + + + + +typedef struct VstTimeInfo +{ + /* info from online documentation of VST provided by Steinberg */ + + double samplePos; + double sampleRate; + double nanoSeconds; + double ppqPos; + double tempo; + double barStartPos; + double cycleStartPos; + double cycleEndPos; + double timeSigNumerator; + double timeSigDenominator; + long smpteOffset; + long smpteFrameRate; + long samplesToNextClock; + long flags; + +} VstTimeInfo; + + +typedef long int (* audioMasterCallback)( AEffect * , long int , long int , + long int , void * , float ); +// we don't use it, may be noise +#define VSTCALLBACK + + + + +#endif diff --git a/libs/ardour/ardour/vstfx.h b/libs/ardour/ardour/vstfx.h new file mode 100755 index 0000000000..e59998dd99 --- /dev/null +++ b/libs/ardour/ardour/vstfx.h @@ -0,0 +1,176 @@ +#ifndef __vstfx_h__ +#define __vstfx_h__ + +#include <setjmp.h> +#include <signal.h> +#include <pthread.h> +#include <stdio.h> + +/******************************************************************************************/ +/*VSTFX - an engine to manage native linux VST plugins - derived from FST for Windows VSTs*/ +/******************************************************************************************/ + +extern void (*vstfx_error_callback)(const char *msg); + +void vstfx_set_error_function (void (*func)(const char *)); + +void vstfx_error (const char *fmt, ...); + +/*We will use the vestige headers*/ + +#define VESTIGE_HEADER + +#include <ardour/vestige/aeffectx.h> + +typedef struct _VSTFX VSTFX; +typedef struct _VSTFXHandle VSTFXHandle; +typedef struct _VSTFXInfo VSTFXInfo; +typedef struct _VSTFXKey VSTFXKey; + + +/*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 struct 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. */ + + //struct AEffect* (*main_entry)(audioMasterCallback); + + main_entry_t main_entry; + + int plugincnt; +}; + +/*No key forwarding enabled in vstfx at the moment - maybe +not required*/ + + +struct _VSTFXKey +{ + /** virtual-key code, or 0 if this _VSTFXKey is a `character' key */ + int special; + /** `character' key, or 0 if this _VSTFXKey is a virtual-key */ + int character; +}; + + + +/*Structure used to describe the instance of VSTFX responsible for +a particular plugin instance. These are connected together in a +linked list*/ + +struct _VSTFX +{ + struct 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); + + VSTFXHandle* 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; + + VSTFXKey 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 void vstfx_exit (); + +extern VSTFXHandle* vstfx_load (const char*); +extern int vstfx_unload (VSTFXHandle*); + +extern VSTFX* vstfx_instantiate (VSTFXHandle*, audioMasterCallback amc, void* userptr); +extern void vstfx_close (VSTFX*); + +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 VSTFXInfo* vstfx_get_info (char *dllpathname); +extern void vstfx_free_info (VSTFXInfo *info); +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 ); + +/** Load a plugin state from a file.**/ + +extern int vstfx_load_state (VSTFX* vstfx, char * filename); + +/** Save a plugin state to a file.**/ + +extern int vstfx_save_state (VSTFX* vstfx, char * filename); + + +#endif /* __vstfx_h__ */ |