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