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