Use same aeffectx.h for windows and linux VSTs.
[ardour.git] / libs / fst / fst.h
1 #ifndef __fst_fst_h__
2 #define __fst_fst_h__
3
4 #include <setjmp.h>
5 #include <signal.h>
6 #include <pthread.h>
7
8 #include "ardour/vst_types.h"
9 #include "ardour/vestige/aeffectx.h"
10
11 /**
12  * Display FST error message.
13  *
14  * Set via fst_set_error_function(), otherwise a FST-provided
15  * default will print @a msg (plus a newline) to stderr.
16  *
17  * @param msg error message text (no newline at end).
18  */
19 extern void (*fst_error_callback)(const char *msg);
20
21 /**
22  * Set the @ref fst_error_callback for error message display.
23  *
24  * The FST library provides two built-in callbacks for this purpose:
25  * default_fst_error_callback() and silent_fst_error_callback().
26  */
27 void fst_set_error_function (void (*func)(const char *));
28
29 void  fst_error (const char *fmt, ...);
30
31 typedef struct _FST FST;
32 typedef struct _FSTHandle FSTHandle;
33 typedef struct _FSTInfo FSTInfo;
34
35 struct _FSTInfo 
36 {
37     char *name;
38     char *creator;
39     int UniqueID;
40     char *Category;
41     
42     int numInputs;
43     int numOutputs;
44     int numParams;
45
46     int wantMidi;
47     int wantEvents;
48     int hasEditor;
49     int canProcessReplacing; // what do we need this for ?
50
51     // i think we should save the parameter Info Stuff soon.
52     // struct VstParameterInfo *infos;
53     char **ParamNames;
54     char **ParamLabels;
55 };
56
57 typedef AEffect * (*main_entry_t)(audioMasterCallback);
58
59 struct _FSTHandle
60 {
61     void*    dll;
62     char*    name;
63     char*    nameptr; /* ptr returned from strdup() etc. */
64     //struct AEffect* (*main_entry)(audioMasterCallback);
65     main_entry_t main_entry;
66
67     int plugincnt;
68 };
69
70 struct _FST 
71 {
72     AEffect*    plugin;
73     void*       window; /* win32 HWND */
74     int         xid; /* X11 XWindow */
75     FSTHandle*  handle;
76     int         width;
77     int         height;
78     int         wantIdle;
79     int         destroy;
80     int         vst_version;
81     int         has_editor;
82
83     int         program_set_without_editor;
84     int         want_program;
85     int         want_chunk;
86     unsigned char *wanted_chunk;
87     int         wanted_chunk_size;
88     int         current_program;
89     float      *want_params;
90     float      *set_params;
91         
92     VSTKey      pending_keys[16];
93     int         n_pending_keys;
94
95     int         dispatcher_wantcall;
96     int         dispatcher_opcode;
97     int         dispatcher_index;
98     int         dispatcher_val;
99     void *      dispatcher_ptr;
100     float       dispatcher_opt;
101     int         dispatcher_retval;
102
103     struct _FST* next;
104     pthread_mutex_t lock;
105     pthread_cond_t  window_status_change;
106     pthread_cond_t  plugin_dispatcher_called;
107     int             been_activated;
108 };
109
110 #ifdef __cplusplus
111 extern "C" {
112 #endif
113
114 extern int        fst_init (void* possible_hmodule);
115 extern void       fst_exit ();
116
117 extern FSTHandle* fst_load (const char*);
118 extern int        fst_unload (FSTHandle*);
119
120 extern FST*       fst_instantiate (FSTHandle*, audioMasterCallback amc, void* userptr);
121 extern void       fst_close (FST*);
122
123 extern int fst_create_editor (FST* fst);
124 extern int  fst_run_editor (FST*);
125 extern void  fst_destroy_editor (FST*);
126 extern int  fst_get_XID (FST*);
127 extern void fst_move_window_into_view (FST*);
128
129 extern FSTInfo *fst_get_info (char *dllpathname);
130 extern void fst_free_info (FSTInfo *info);
131 extern void fst_event_loop_remove_plugin (FST* fst);
132 extern int fst_call_dispatcher(FST *fst, int opcode, int index, int val, void *ptr, float opt );
133
134 /**
135  * Load a plugin state from a file.
136  */
137 extern int fst_load_state (FST * fst, char * filename);
138
139 /**
140  * Save a plugin state to a file.
141  */
142 extern int fst_save_state (FST * fst, char * filename);
143
144 extern int wine_pthread_create (pthread_t* thread_id, const pthread_attr_t* attr, void *(*function)(void*), void* arg);
145
146
147 #ifdef __cplusplus
148 }
149 #endif
150
151 #endif /* __fst_fst_h__ */