FST code from 2.X branch
[ardour.git] / libs / fst / vestige / aeffectx.h
1 /*
2  * aeffectx.h - simple header to allow VeSTige compilation and eventually work
3  *
4  * Copyright (c) 2006 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
5  * 
6  * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public
19  * License along with this program (see COPYING); if not, write to the
20  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301 USA.
22  *
23  */
24
25
26 #ifndef _AEFFECTX_H
27 #define _AEFFECTX_H
28
29 #include <stdint.h>
30
31 #define audioMasterAutomate 0
32 #define audioMasterVersion 1
33 #define audioMasterCurrentId 2
34 #define audioMasterIdle 3
35 #define audioMasterPinConnected 4
36 // unsupported? 5
37 #define audioMasterWantMidi 6
38 #define audioMasterGetTime 7
39 #define audioMasterProcessEvents 8
40 #define audioMasterSetTime 9
41 #define audioMasterTempoAt 10
42 #define audioMasterGetNumAutomatableParameters 11
43 #define audioMasterGetParameterQuantization 12
44 #define audioMasterIOChanged 13
45 #define audioMasterNeedIdle 14
46 #define audioMasterSizeWindow 15
47 #define audioMasterGetSampleRate 16
48 #define audioMasterGetBlockSize 17
49 #define audioMasterGetInputLatency 18
50 #define audioMasterGetOutputLatency 19
51 #define audioMasterGetPreviousPlug 20
52 #define audioMasterGetNextPlug 21
53 #define audioMasterWillReplaceOrAccumulate 22
54 #define audioMasterGetCurrentProcessLevel 23
55 #define audioMasterGetAutomationState 24
56 #define audioMasterOfflineStart 25
57 #define audioMasterOfflineRead 26
58 #define audioMasterOfflineWrite 27
59 #define audioMasterOfflineGetCurrentPass 28
60 #define audioMasterOfflineGetCurrentMetaPass 29
61 #define audioMasterSetOutputSampleRate 30
62 // unsupported? 31
63 #define audioMasterGetSpeakerArrangement 31 // deprecated in 2.4?
64 #define audioMasterGetVendorString 32
65 #define audioMasterGetProductString 33
66 #define audioMasterGetVendorVersion 34
67 #define audioMasterVendorSpecific 35
68 #define audioMasterSetIcon 36
69 #define audioMasterCanDo 37
70 #define audioMasterGetLanguage 38
71 #define audioMasterOpenWindow 39
72 #define audioMasterCloseWindow 40
73 #define audioMasterGetDirectory 41
74 #define audioMasterUpdateDisplay 42
75 #define audioMasterBeginEdit 43
76 #define audioMasterEndEdit 44
77 #define audioMasterOpenFileSelector 45
78 #define audioMasterCloseFileSelector 46// currently unused
79 #define audioMasterEditFile 47// currently unused
80 #define audioMasterGetChunkFile 48// currently unused
81 #define audioMasterGetInputSpeakerArrangement 49 // currently unused
82
83 #define effFlagsHasEditor 1
84 // very likely
85 #define effFlagsCanReplacing (1 << 4)
86 // currently unused
87 #define effFlagsIsSynth (1 << 8)
88
89 #define effOpen 0
90 //currently unused
91 #define effClose 1
92 // currently unused
93 #define effSetProgram 2
94 // currently unused
95 #define effGetProgram 3
96 // currently unused
97 #define effGetProgramName 5
98 #define effGetParamLabel 6
99 // currently unused
100 #define effGetParamName 8
101 // this is a guess
102 #define effSetSampleRate 10
103 #define effSetBlockSize 11
104 #define effMainsChanged 12
105 #define effEditGetRect 13
106 #define effEditOpen 14
107 #define effEditClose 15
108 #define effEditIdle 19
109 #define effProcessEvents 25
110 #define effGetEffectName 45
111 // missing
112 #define effGetParameterProperties 47
113 #define effGetVendorString 47
114 #define effGetProductString 48
115 #define effGetVendorVersion 49
116 // currently unused
117 #define effCanDo 51
118 // currently unused
119 #define effGetVstVersion 58
120
121 #ifdef WORDS_BIGENDIAN
122 // "VstP"
123 #define kEffectMagic 0x50747356
124 #else
125 // "PtsV"
126 #define kEffectMagic 0x56737450
127 #endif
128
129 #define kVstLangEnglish 1
130 #define kVstMidiType 1
131 #define kVstTransportPlaying (1 << 1)
132
133 /* validity flags for a VstTimeINfo structure this info comes from the web */
134
135 #define kVstNanosValid (1 << 8)
136 #define kVstPpqPosValid (1 << 9)
137 #define kVstTempoValid (1 << 10)
138 #define kVstBarsValid (1 << 11)
139 #define kVstCyclePosValid (1 << 12)
140 #define kVstTimeSigValid (1 << 13)
141 #define kVstSmpteValid (1 << 14)
142 #define kVstClockValid (1 << 15)
143
144 #define kVstTransportChanged 1
145
146 typedef struct VstMidiEvent
147 {
148         // 00
149         int type;
150         // 04
151         int byteSize;
152         // 08
153         int deltaFrames;
154         // 0c?
155         int flags;
156         // 10?
157         int noteLength;
158         // 14?
159         int noteOffset;
160         // 18
161         char midiData[4];
162         // 1c?
163         char detune;
164         // 1d?
165         char noteOffVelocity;
166         // 1e?
167         char reserved1;
168         // 1f?
169         char reserved2;
170
171 } VstMidiEvent;
172
173
174
175
176 typedef struct VstEvent
177 {
178         char dump[sizeof( VstMidiEvent )];
179
180 } VstEvent ;
181
182
183
184
185 typedef struct VstEvents
186 {
187         // 00
188         int numEvents;
189         // 04
190         int reserved;
191         // 08
192         VstEvent * events[];
193 } VstEvents;
194
195 /* constants from http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=3740&sid=183f74631fee71a493316735e2b9f28b */
196
197 enum Vestige2StringConstants
198 {
199         VestigeMaxNameLen       = 64,
200         VestigeMaxLabelLen      = 64,
201         VestigeMaxShortLabelLen = 8,
202         VestigeMaxCategLabelLen = 24,
203         VestigeMaxFileNameLen   = 100
204 }; 
205
206 /* this struct taken from http://asseca.com/vst-24-specs/efGetParameterProperties.html */
207 struct VstParameterProperties
208 {
209     float stepFloat;              /* float step */
210     float smallStepFloat;         /* small float step */
211     float largeStepFloat;         /* large float step */
212     char label[VestigeMaxLabelLen];  /* parameter label */
213     int32_t flags;               /* @see VstParameterFlags */
214     int32_t minInteger;          /* integer minimum */
215     int32_t maxInteger;          /* integer maximum */
216     int32_t stepInteger;         /* integer step */
217     int32_t largeStepInteger;    /* large integer step */
218     char shortLabel[VestigeMaxShortLabelLen]; /* short label, recommended: 6 + delimiter */
219     int16_t displayIndex;        /* index where this parameter should be displayed (starting with 0) */
220     int16_t category;            /* 0: no category, else group index + 1 */
221     int16_t numParametersInCategory; /* number of parameters in category */
222     int16_t reserved;            /* zero */
223     char categoryLabel[VestigeMaxCategLabelLen]; /* category label, e.g. "Osc 1"  */
224     char future[16];              /* reserved for future use */
225 };
226
227 /* this enum taken from http://asseca.com/vst-24-specs/efGetParameterProperties.html */
228 enum VstParameterFlags
229 {
230         kVstParameterIsSwitch                = 1 << 0,  /* parameter is a switch (on/off) */
231         kVstParameterUsesIntegerMinMax       = 1 << 1,  /* minInteger, maxInteger valid */
232         kVstParameterUsesFloatStep           = 1 << 2,  /* stepFloat, smallStepFloat, largeStepFloat valid */
233         kVstParameterUsesIntStep             = 1 << 3,  /* stepInteger, largeStepInteger valid */
234         kVstParameterSupportsDisplayIndex    = 1 << 4,  /* displayIndex valid */
235         kVstParameterSupportsDisplayCategory = 1 << 5,  /* category, etc. valid */
236         kVstParameterCanRamp                 = 1 << 6   /* set if parameter value can ramp up/down */
237 };
238
239 typedef struct AEffect
240 {
241         // Never use c++!!!
242         // 00-03
243         int magic;
244         // dispatcher 04-07
245         int (* dispatcher)( struct AEffect * , int , int , int , void * , float );
246         // process, quite sure 08-0b
247         void (* process)( struct AEffect * , float * * , float * * , int );
248         // setParameter 0c-0f
249         void (* setParameter)( struct AEffect * , int , float );
250         // getParameter 10-13
251         float (* getParameter)( struct AEffect * , int );
252         // programs 14-17
253         int numPrograms;
254         // Params 18-1b
255         int numParams;
256         // Input 1c-1f
257         int numInputs;
258         // Output 20-23
259         int numOutputs;
260         // flags 24-27
261         int flags;
262         // Fill somewhere 28-2b
263         void * user;
264         // Zeroes 2c-2f 30-33 34-37 38-3b
265         char empty3[4 + 4 + 4 + 4];
266         // 1.0f 3c-3f
267         float unkown_float;
268         // An object? pointer 40-43
269         char empty4[4];
270         // Zeroes 44-47
271         char empty5[4];
272         // Id 48-4b
273         char unused_id[4];
274         // Don't know 4c-4f
275         char unknown1[4];
276         // processReplacing 50-53
277         void (* processReplacing)( struct AEffect * , float * * , float * * , int );
278
279  int uniqueID;
280
281 } AEffect;
282
283
284
285
286 typedef struct VstTimeInfo
287 {
288     /* info from online documentation of VST provided by Steinberg */
289
290     double samplePos;
291     double sampleRate;
292     double nanoSeconds;
293     double ppqPos;
294     double tempo;
295     double barStartPos;
296     double cycleStartPos;
297     double cycleEndPos;
298     double timeSigNumerator;
299     double timeSigDenominator;
300     long   smpteOffset;
301     long   smpteFrameRate;
302     long   samplesToNextClock;
303     long   flags;
304
305 } VstTimeInfo;
306
307
308 typedef long int (* audioMasterCallback)( AEffect * , long int , long int ,
309                                                 long int , void * , float );
310 // we don't use it, may be noise
311 #define VSTCALLBACK
312
313
314
315
316 #endif