add copyright comments
[ardour.git] / libs / ardour / ardour / 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 #include <stdint.h>
25 #ifndef _AEFFECTX_H
26 #define _AEFFECTX_H
27
28 #define CCONST(a, b, c, d)( ( ( (int) a ) << 24 ) |             \
29                                 ( ( (int) b ) << 16 ) |         \
30                                 ( ( (int) c ) << 8 ) |          \
31                                 ( ( (int) d ) << 0 ) )
32
33 #define audioMasterAutomate 0
34 #define audioMasterVersion 1
35 #define audioMasterCurrentId 2
36 #define audioMasterIdle 3
37 #define audioMasterPinConnected 4
38 // unsupported? 5
39 #define audioMasterWantMidi 6
40 #define audioMasterGetTime 7
41 #define audioMasterProcessEvents 8
42 #define audioMasterSetTime 9
43 #define audioMasterTempoAt 10
44 #define audioMasterGetNumAutomatableParameters 11
45 #define audioMasterGetParameterQuantization 12
46 #define audioMasterIOChanged 13
47 #define audioMasterNeedIdle 14
48 #define audioMasterSizeWindow 15
49 #define audioMasterGetSampleRate 16
50 #define audioMasterGetBlockSize 17
51 #define audioMasterGetInputLatency 18
52 #define audioMasterGetOutputLatency 19
53 #define audioMasterGetPreviousPlug 20
54 #define audioMasterGetNextPlug 21
55 #define audioMasterWillReplaceOrAccumulate 22
56 #define audioMasterGetCurrentProcessLevel 23
57 #define audioMasterGetAutomationState 24
58 #define audioMasterOfflineStart 25
59 #define audioMasterOfflineRead 26
60 #define audioMasterOfflineWrite 27
61 #define audioMasterOfflineGetCurrentPass 28
62 #define audioMasterOfflineGetCurrentMetaPass 29
63 #define audioMasterSetOutputSampleRate 30
64 // unsupported? 31
65 #define audioMasterGetSpeakerArrangement 31 // deprecated in 2.4?
66 #define audioMasterGetVendorString 32
67 #define audioMasterGetProductString 33
68 #define audioMasterGetVendorVersion 34
69 #define audioMasterVendorSpecific 35
70 #define audioMasterSetIcon 36
71 #define audioMasterCanDo 37
72 #define audioMasterGetLanguage 38
73 #define audioMasterOpenWindow 39
74 #define audioMasterCloseWindow 40
75 #define audioMasterGetDirectory 41
76 #define audioMasterUpdateDisplay 42
77 #define audioMasterBeginEdit 43
78 #define audioMasterEndEdit 44
79 #define audioMasterOpenFileSelector 45
80 #define audioMasterCloseFileSelector 46 // currently unused
81 #define audioMasterEditFile 47 // currently unused
82 #define audioMasterGetChunkFile 48 // currently unused
83 #define audioMasterGetInputSpeakerArrangement 49 // currently unused
84
85 #define effFlagsHasEditor 1
86 #define effFlagsCanReplacing (1 << 4) // very likely
87 #define effFlagsIsSynth (1 << 8) // currently unused
88
89 #define effOpen 0
90 #define effClose 1 // currently unused
91 #define effSetProgram 2 // currently unused
92 #define effGetProgram 3 // currently unused
93 #define effGetProgramName 5 // currently unused
94 #define effGetParamName 8 // currently unused
95 #define effSetSampleRate 10
96 #define effSetBlockSize 11
97 #define effMainsChanged 12
98 #define effEditGetRect 13
99 #define effEditOpen 14
100 #define effEditClose 15
101 #define effEditIdle 19
102 #define effEditTop 20
103 #define effProcessEvents 25
104 #define effGetEffectName 45
105 #define effGetVendorString 47
106 #define effGetProductString 48
107 #define effGetVendorVersion 49
108 #define effCanDo 51 // currently unused
109 /* from http://asseca.com/vst-24-specs/efGetParameterProperties.html */
110 #define effGetParameterProperties 56
111 #define effGetVstVersion 58 // currently unused
112
113 #define kEffectMagic (CCONST( 'V', 's', 't', 'P' ))
114 #define kVstLangEnglish 1
115 #define kVstMidiType 1
116 #define kVstTempoValid (1 << 10)
117 #define kVstTransportPlaying (1 << 1)
118
119
120 struct RemoteVstPlugin;
121
122 #define kVstNanosValid (1 << 8)
123 #define kVstPpqPosValid (1 << 9)
124 #define kVstTempoValid (1 << 10)
125 #define kVstBarsValid (1 << 11)
126 #define kVstCyclePosValid (1 << 12)
127 #define kVstTimeSigValid (1 << 13)
128 #define kVstSmpteValid (1 << 14)
129 #define kVstClockValid (1 << 15)
130
131 struct _VstMidiEvent
132 {
133         // 00
134         int type;
135         // 04
136         int byteSize;
137         // 08
138         int deltaFrames;
139         // 0c?
140         int flags;
141         // 10?
142         int noteLength;
143         // 14?
144         int noteOffset;
145         // 18
146         char midiData[4];
147         // 1c?
148         char detune;
149         // 1d?
150         char noteOffVelocity;
151         // 1e?
152         char reserved1;
153         // 1f?
154         char reserved2;
155 };
156
157 typedef struct _VstMidiEvent VstMidiEvent;
158
159
160 struct _VstEvent
161 {
162         char dump[sizeof (VstMidiEvent)];
163
164 };
165
166 typedef struct _VstEvent VstEvent;
167
168 struct _VstEvents
169 {
170         // 00
171         int numEvents;
172         // 04
173         void *reserved;
174         // 08
175         VstEvent * events[];
176 };
177
178 typedef struct _VstEvents VstEvents;
179
180 /* this struct taken from http://asseca.com/vst-24-specs/efGetParameterProperties.html */
181 struct _VstParameterProperties
182 {
183         float stepFloat;
184         float smallStepFloat;
185         float largeStepFloat;
186         char label[64];
187         int32_t flags;
188         int32_t minInteger;
189         int32_t maxInteger;
190         int32_t stepInteger;
191         int32_t largeStepInteger;
192         char shortLabel[8];
193 };
194
195 typedef struct _VstParameterProperties VstParameterProperties;
196
197 /* this enum taken from http://asseca.com/vst-24-specs/efGetParameterProperties.html */
198 enum VstParameterFlags
199 {
200         kVstParameterIsSwitch                = 1 << 0,  /* parameter is a switch (on/off) */
201         kVstParameterUsesIntegerMinMax       = 1 << 1,  /* minInteger, maxInteger valid */
202         kVstParameterUsesFloatStep           = 1 << 2,  /* stepFloat, smallStepFloat, largeStepFloat valid */
203         kVstParameterUsesIntStep             = 1 << 3,  /* stepInteger, largeStepInteger valid */
204         kVstParameterSupportsDisplayIndex    = 1 << 4,  /* displayIndex valid */
205         kVstParameterSupportsDisplayCategory = 1 << 5,  /* category, etc. valid */
206         kVstParameterCanRamp                 = 1 << 6   /* set if parameter value can ramp up/down */
207 };
208
209 struct _AEffect
210 {
211         // Never use virtual functions!!!
212         // 00-03
213         int magic;
214         // dispatcher 04-07
215         intptr_t (* dispatcher) (struct _AEffect *, int, int, intptr_t, void *, float);
216         // process, quite sure 08-0b
217         void (* process) (struct _AEffect *, float **, float **, int);
218         // setParameter 0c-0f
219         void (* setParameter) (struct _AEffect *, int, float);
220         // getParameter 10-13
221         float (* getParameter) (struct _AEffect *, int);
222         // programs 14-17
223         int numPrograms;
224         // Params 18-1b
225         int numParams;
226         // Input 1c-1f
227         int numInputs;
228         // Output 20-23
229         int numOutputs;
230         // flags 24-27
231         int flags;
232         // Fill somewhere 28-2b
233         void *ptr1;
234         void *ptr2;
235         // Zeroes 2c-2f 30-33 34-37 38-3b
236         char empty3[4 + 4 + 4];
237         // 1.0f 3c-3f
238         float unkown_float;
239         // An object? pointer 40-43
240         void *ptr3;
241         // Zeroes 44-47
242         void *user;
243         // Id 48-4b
244         int32_t uniqueID;
245         // Don't know 4c-4f
246         char unknown1[4];
247         // processReplacing 50-53
248         void (* processReplacing) (struct _AEffect *, float **, float **, int);
249 };
250
251 typedef struct _AEffect AEffect;
252
253 struct _VstTimeInfo
254 {
255         // 00
256         double samplePos;
257         // 08
258         double sampleRate;
259         // unconfirmed 10 18
260         char empty1[8 + 8];
261         // 20?
262         double tempo;
263         // unconfirmed 28 30 38
264         char empty2[8 + 8 + 8];
265         // 40?
266         int timeSigNumerator;
267         // 44?
268         int timeSigDenominator;
269         // unconfirmed 48 4c 50
270         char empty3[4 + 4 + 4];
271         // 54
272         int flags;
273 };
274
275 typedef struct _VstTimeInfo VstTimeInfo;
276
277 typedef intptr_t (* audioMasterCallback) (AEffect *, int32_t, int32_t, intptr_t, void *, float);
278
279 #endif