1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
|
#ifndef __aeffectx__
#define __aeffectx__
#ifndef __AEffect__
#include "AEffect.h"
#endif
//-------------------------------------------------------------------------------------------------------
// VST Plug-Ins SDK
// version 2.0 extension
// (c)1999 Steinberg Soft+Hardware GmbH
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
// VstEvent
//-------------------------------------------------------------------------------------------------------
typedef struct VstEvent VstEvent;
typedef struct VstMidiEvent VstMidiEvent;
typedef struct VstEvents VstEvents;
struct VstEvent // a generic timestamped event
{
long type; // see enum below
long byteSize; // of this event, excl. type and byteSize
long deltaFrames; // sample frames related to the current block start sample position
long flags; // generic flags, none defined yet (0)
char data[16]; // size may vary but is usually 16
};
enum // VstEvent types
{
kVstMidiType = 1, // midi event, can be cast as VstMidiEvent (see below)
kVstAudioType, // audio
kVstVideoType, // video
kVstParameterType, // parameter
kVstTriggerType // trigger
// ...etc
};
struct VstMidiEvent // to be casted from a VstEvent
{
long type; // kVstMidiType
long byteSize; // 24
long deltaFrames; // sample frames related to the current block start sample position
long flags; // none defined yet
long noteLength; // (in sample frames) of entire note, if available, else 0
long noteOffset; // offset into note from note start if available, else 0
char midiData[4]; // 1 thru 3 midi bytes; midiData[3] is reserved (zero)
char detune; // -64 to +63 cents; for scales other than 'well-tempered' ('microtuning')
char noteOffVelocity;
char reserved1; // zero
char reserved2; // zero
};
struct VstEvents // a block of events for the current audio block
{
long numEvents;
long reserved; // zero
VstEvent* events[2]; // variable
};
//-------------------------------------------------------------------------------------------------------
// VstTimeInfo
//-------------------------------------------------------------------------------------------------------
typedef struct VstTimeInfo VstTimeInfo;
// VstTimeInfo as requested via audioMasterGetTime (getTimeInfo())
// refers to the current time slice. note the new slice is
// already started when processEvents() is called
struct VstTimeInfo
{
double samplePos; // current location
double sampleRate;
double nanoSeconds; // system time
double ppqPos; // 1 ppq
double tempo; // in bpm
double barStartPos; // last bar start, in 1 ppq
double cycleStartPos; // 1 ppq
double cycleEndPos; // 1 ppq
long timeSigNumerator; // time signature
long timeSigDenominator;
long smpteOffset;
long smpteFrameRate; // 0:24, 1:25, 2:29.97, 3:30, 4:29.97 df, 5:30 df
long samplesToNextClock; // midi clock resolution (24 ppq), can be negative
long flags; // see below
};
enum
{
kVstTransportChanged = 1,
kVstTransportPlaying = 1 << 1,
kVstTransportCycleActive = 1 << 2,
kVstAutomationWriting = 1 << 6,
kVstAutomationReading = 1 << 7,
// flags which indicate which of the fields in this VstTimeInfo
// are valid; samplePos and sampleRate are always valid
kVstNanosValid = 1 << 8,
kVstPpqPosValid = 1 << 9,
kVstTempoValid = 1 << 10,
kVstBarsValid = 1 << 11,
kVstCyclePosValid = 1 << 12, // start and end
kVstTimeSigValid = 1 << 13,
kVstSmpteValid = 1 << 14,
kVstClockValid = 1 << 15
};
//-------------------------------------------------------------------------------------------------------
// VarIo
//-------------------------------------------------------------------------------------------------------
typedef struct VstVariableIo VstVariableIo;
struct VstVariableIo
{
float **inputs;
float **outputs;
long numSamplesInput;
long numSamplesOutput;
long *numSamplesInputProcessed;
long *numSamplesOutputProcessed;
};
//---------------------------------------------------------------------------------------------
// new audioMaster opCodes
//---------------------------------------------------------------------------------------------
enum
{
// VstEvents + VstTimeInfo
audioMasterWantMidi = audioMasterPinConnected + 2, // <value> is a filter which is currently ignored
audioMasterGetTime, // returns const VstTimeInfo* (or 0 if not supported)
// <value> should contain a mask indicating which fields are required
// (see valid masks above), as some items may require extensive
// conversions
audioMasterProcessEvents, // VstEvents* in <ptr>
audioMasterSetTime, // VstTimenfo* in <ptr>, filter in <value>, not supported
audioMasterTempoAt, // returns tempo (in bpm * 10000) at sample frame location passed in <value>
// parameters
audioMasterGetNumAutomatableParameters,
audioMasterGetParameterQuantization, // returns the integer value for +1.0 representation,
// or 1 if full single float precision is maintained
// in automation. parameter index in <value> (-1: all, any)
// connections, configuration
audioMasterIOChanged, // numInputs and/or numOutputs has changed
audioMasterNeedIdle, // plug needs idle calls (outside its editor window)
audioMasterSizeWindow, // index: width, value: height
audioMasterGetSampleRate,
audioMasterGetBlockSize,
audioMasterGetInputLatency,
audioMasterGetOutputLatency,
audioMasterGetPreviousPlug, // input pin in <value> (-1: first to come), returns cEffect*
audioMasterGetNextPlug, // output pin in <value> (-1: first to come), returns cEffect*
// realtime info
audioMasterWillReplaceOrAccumulate, // returns: 0: not supported, 1: replace, 2: accumulate
audioMasterGetCurrentProcessLevel, // returns: 0: not supported,
// 1: currently in user thread (gui)
// 2: currently in audio thread (where process is called)
// 3: currently in 'sequencer' thread (midi, timer etc)
// 4: currently offline processing and thus in user thread
// other: not defined, but probably pre-empting user thread.
audioMasterGetAutomationState, // returns 0: not supported, 1: off, 2:read, 3:write, 4:read/write
// offline
audioMasterOfflineStart,
audioMasterOfflineRead, // ptr points to offline structure, see below. return 0: error, 1 ok
audioMasterOfflineWrite, // same as read
audioMasterOfflineGetCurrentPass,
audioMasterOfflineGetCurrentMetaPass,
// other
audioMasterSetOutputSampleRate, // for variable i/o, sample rate in <opt>
audioMasterGetSpeakerArrangement, // (long)input in <value>, output in <ptr>
audioMasterGetVendorString, // fills <ptr> with a string identifying the vendor (max 64 char)
audioMasterGetProductString, // fills <ptr> with a string with product name (max 64 char)
audioMasterGetVendorVersion, // returns vendor-specific version
audioMasterVendorSpecific, // no definition, vendor specific handling
audioMasterSetIcon, // void* in <ptr>, format not defined yet
audioMasterCanDo, // string in ptr, see below
audioMasterGetLanguage, // see enum
audioMasterOpenWindow, // returns platform specific ptr
audioMasterCloseWindow, // close window, platform specific handle in <ptr>
audioMasterGetDirectory, // get plug directory, FSSpec on MAC, else char*
audioMasterUpdateDisplay // something has changed, update 'multi-fx' display
};
enum VstHostLanguage
{
kVstLangEnglish = 1,
kVstLangGerman,
kVstLangFrench,
kVstLangItalian,
kVstLangSpanish,
kVstLangJapanese
};
//---------------------------------------------------------------------------------------------
// dispatcher opCodes
//---------------------------------------------------------------------------------------------
enum
{
// VstEvents
effProcessEvents = effSetChunk + 1, // VstEvents* in <ptr>
// parameters and programs
effCanBeAutomated, // parameter index in <index>
effString2Parameter, // parameter index in <index>, string in <ptr>
effGetNumProgramCategories, // no arguments. this is for dividing programs into groups (like GM)
effGetProgramNameIndexed, // get program name of category <value>, program <index> into <ptr>.
// category (that is, <value>) may be -1, in which case program indices
// are enumerated linearily (as usual); otherwise, each category starts
// over with index 0.
effCopyProgram, // copy current program to destination <index>
// note: implies setParameter
// connections, configuration
effConnectInput, // input at <index> has been (dis-)connected;
// <value> == 0: disconnected, else connected
effConnectOutput, // same as input
effGetInputProperties, // <index>, VstPinProperties* in ptr, return != 0 => true
effGetOutputProperties, // dto
effGetPlugCategory, // no parameter, return value is category
// realtime
effGetCurrentPosition, // for external dsp, see flag bits below
effGetDestinationBuffer, // for external dsp, see flag bits below. returns float*
// offline
effOfflineNotify, // ptr = VstAudioFile array, value = count, index = start flag
effOfflinePrepare, // ptr = VstOfflineTask array, value = count
effOfflineRun, // dto
// other
effProcessVarIo, // VstVariableIo* in <ptr>
effSetSpeakerArrangement, // VstSpeakerArrangement* pluginInput in <value>
// VstSpeakerArrangement* pluginOutput in <ptr>
effSetBlockSizeAndSampleRate, // block size in <value>, sampleRate in <opt>
effSetBypass, // onOff in <value> (0 = off)
effGetEffectName, // char* name (max 32 bytes) in <ptr>
effGetErrorText, // char* text (max 256 bytes) in <ptr>
effGetVendorString, // fills <ptr> with a string identifying the vendor (max 64 char)
effGetProductString, // fills <ptr> with a string with product name (max 64 char)
effGetVendorVersion, // returns vendor-specific version
effVendorSpecific, // no definition, vendor specific handling
effCanDo, // <ptr>
effGetTailSize, // returns tail size; 0 is default (return 1 for 'no tail')
effIdle, // idle call in response to audioMasterneedIdle. must
// return 1 to keep idle calls beeing issued
// gui
effGetIcon, // void* in <ptr>, not yet defined
effSetViewPosition, // set view position (in window) to x <index> y <value>
// and...
effGetParameterProperties, // of param <index>, VstParameterProperties* in <ptr>
effKeysRequired, // returns 0: needs keys (default for 1.0 plugs), 1: don't need
effGetVstVersion, // returns 2; older versions return 0
effNumV2Opcodes
// note that effNumOpcodes doesn't apply anymore
};
typedef struct VstParameterProperties VstParameterProperties;
typedef struct VstPinProperties VstPinProperties;
struct VstParameterProperties
{
float stepFloat;
float smallStepFloat;
float largeStepFloat;
char label[64];
long flags;
long minInteger;
long maxInteger;
long stepInteger;
long largeStepInteger;
char shortLabel[8]; // recommended: 6 + delimiter
char future[48];
};
// parameter properties flags
enum
{
kVstParameterIsSwitch = 1 << 0,
kVstParameterUsesIntegerMinMax = 1 << 1,
kVstParameterUsesFloatStep = 1 << 2,
kVstParameterUsesIntStep = 1 << 3
};
struct VstPinProperties
{
char label[64];
long flags;
long reserved;
char shortLabel[8]; // recommended: 6 + delimiter
char future[48];
};
// pin properties flags
enum
{
kVstPinIsActive = 1 << 0,
kVstPinIsStereo = 1 << 1
};
// category
enum VstPlugCategory
{
kPlugCategUnknown = 0,
kPlugCategEffect,
kPlugCategSynth,
kPlugCategAnalysis,
kPlugCategMastering,
kPlugCategSpacializer, // 'panners'
kPlugCategRoomFx, // delays and reverbs
kPlugSurroundFx // dedicated surround processor
};
//---------------------------------------------------------------------------------------------
// flags bits
//---------------------------------------------------------------------------------------------
enum
{
effFlagsIsSynth = 1 << 8, // host may assign mixer channels for its outputs
effFlagsNoSoundInStop = 1 << 9, // does not produce sound when input is all silence
effFlagsExtIsAsync = 1 << 10, // for external dsp; plug returns immedeately from process()
// host polls plug position (current block) via effGetCurrentPosition
effFlagsExtHasBuffer = 1 << 11 // external dsp, may have their own output buffe (32 bit float)
// host then requests this via effGetDestinationBuffer
};
//---------------------------------------------------------------------------------------------
// surround setup
//---------------------------------------------------------------------------------------------
typedef struct VstSpeakerProperties VstSpeakerProperties;
typedef struct VstSpeakerArrangement VstSpeakerArrangement;
struct VstSpeakerProperties
{ // units: range: except:
float azimuth; // rad -PI...PI 10.f for LFE channel
float elevation; // rad -PI/2...PI/2 10.f for LFE channel
float radius; // meter 0.f for LFE channel
float reserved; // 0.
char name[64]; // for new setups, new names should be given (L/R/C... won't do)
char future[32];
};
// note: the origin for azimuth is right (as by math conventions dealing with radians);
// the elevation origin is also right, visualizing a rotation of a circle across the
// -pi/pi axis of the horizontal circle. thus, an elevation of -pi/2 corresponds
// to bottom, and a speaker standing on the left, and 'beaming' upwards would have
// an azimuth of -pi, and an elevation of pi/2.
// for user interface representation, grads are more likely to be used, and the
// origins will obviously 'shift' accordingly.
struct VstSpeakerArrangement
{
float lfeGain; // LFE channel gain is adjusted [dB] higher than other channels
long numChannels; // number of channels in this speaker arrangement
VstSpeakerProperties speakers[8]; // variable
};
//---------------------------------------------------------------------------------------------
// offline
//---------------------------------------------------------------------------------------------
typedef struct VstOfflineTask VstOfflineTask;
typedef struct VstAudioFile VstAudioFile;
typedef struct VstAudioFileMarker VstAudioFileMarker;
struct VstOfflineTask
{
char processName[96]; // set by plug
// audio access
double readPosition; // set by plug/host
double writePosition; // set by plug/host
long readCount; // set by plug/host
long writeCount; // set by plug
long sizeInputBuffer; // set by host
long sizeOutputBuffer; // set by host
void* inputBuffer; // set by host
void* outputBuffer; // set by host
double positionToProcessFrom; // set by host
double numFramesToProcess; // set by host
double maxFramesToWrite; // set by plug
// other data access
void* extraBuffer; // set by plug
long value; // set by host or plug
long index; // set by host or plug
// file attributes
double numFramesInSourceFile; // set by host
double sourceSampleRate; // set by host or plug
double destinationSampleRate; // set by host or plug
long numSourceChannels; // set by host or plug
long numDestinationChannels; // set by host or plug
long sourceFormat; // set by host
long destinationFormat; // set by plug
char outputText[512]; // set by plug or host
// progress notification
double progress; // set by plug
long progressMode; // reserved for future
char progressText[100]; // set by plug
long flags; // set by host and plug; see VstOfflineTaskFlags
long returnValue; // reserved for future
void* hostOwned; // set by host
void* plugOwned; // set by plug
char future[1024];
};
enum VstOfflineTaskFlags
{
// set by host
kVstOfflineUnvalidParameter = 1 << 0,
kVstOfflineNewFile = 1 << 1,
// set by plug
kVstOfflinePlugError = 1 << 10,
kVstOfflineInterleavedAudio = 1 << 11,
kVstOfflineTempOutputFile = 1 << 12,
kVstOfflineFloatOutputFile = 1 << 13,
kVstOfflineRandomWrite = 1 << 14,
kVstOfflineStretch = 1 << 15,
kVstOfflineNoThread = 1 << 16
};
// option passed to offlineRead/offlineWrite
enum VstOfflineOption
{
kVstOfflineAudio, // reading/writing audio samples
kVstOfflinePeaks, // reading graphic representation
kVstOfflineParameter, // reading/writing parameters
kVstOfflineMarker, // reading/writing marker
kVstOfflineCursor, // reading/moving edit cursor
kVstOfflineSelection, // reading/changing selection
kVstOfflineQueryFiles // to request the host to call asynchronously offlineNotify
};
// structure passed to offlineNotify and offlineStart
struct VstAudioFile
{
long flags; // see enum VstAudioFileFlags
void* hostOwned; // any data private to host
void* plugOwned; // any data private to plugin
char name[100]; // file title
long uniqueId; // uniquely identify a file during a session
double sampleRate; // file sample rate
long numChannels; // number of channels (1 for mono, 2 for stereo...)
double numFrames; // number of frames in the audio file
long format; // reserved for future
double editCursorPosition; // -1 if no such cursor
double selectionStart; // frame index of first selected frame, or -1
double selectionSize; // number of frames in selection, or 0
long selectedChannelsMask; // 1 bit per channel
long numMarkers; // number of markers in the file
long timeRulerUnit; // see doc for possible values
double timeRulerOffset; // offset in time ruler (positive or negative)
double tempo; // as bpm
long timeSigNumerator; // time signature numerator
long timeSigDenominator; // time signature denominator
long ticksPerBlackNote; // resolution
long smpteFrameRate; // smpte rate (set as in VstTimeInfo)
char future[64];
};
enum VstAudioFileFlags
{
// set by host (in call offlineNotify)
kVstOfflineReadOnly = 1 << 0,
kVstOfflineNoRateConversion = 1 << 1,
kVstOfflineNoChannelChange = 1 << 2,
// Set by plug (in function offlineStart)
kVstOfflineCanProcessSelection = 1 << 10,
kVstOfflineNoCrossfade = 1 << 11,
kVstOfflineWantRead = 1 << 12,
kVstOfflineWantWrite = 1 << 13,
kVstOfflineWantWriteMarker = 1 << 14,
kVstOfflineWantMoveCursor = 1 << 15,
kVstOfflineWantSelect = 1 << 16
};
struct VstAudioFileMarker
{
double position;
char name[32];
long type;
long id;
long reserved;
};
//---------------------------------------------------------------------------------------------
// others
//---------------------------------------------------------------------------------------------
// structure passed to openWindow and closeWindow
struct VstWindow
{
char title[128]; // title
short xPos; // position and size
short yPos;
short width;
short height;
long style; // 0: with title, 1: without title
void *parent; // parent of this window
void *userHandle; // reserved
void *winHandle; // reserved
char future[104];
};
#endif
|