aboutsummaryrefslogtreecommitdiff
path: root/Vst/audioeffectx.h
blob: 435a63e38bcfbce64306c16df7f085fb7d69e0f7 (plain)
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
#ifndef __audioeffectx__
#define __audioeffectx__

//----------------------------------------------------------------------------------------------------------------------------
// VST Plug-Ins SDK
// version 2.0 extension
// (c)1999 Steinberg Soft+Hardware GmbH
//----------------------------------------------------------------------------------------------------------------------------

#ifndef __AudioEffect__
#include "AudioEffect.hpp"	// version 1.0 base class AudioEffect
#endif

#ifndef __aeffectx__
#include "aeffectx.h"		// version 2.0 'C' extensions and structures
#endif

//----------------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------------
// AudioEffectX extends AudioEffect with the new features. so you should derive
// your plug from AudioEffectX
//----------------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------------

class AudioEffectX : public AudioEffect
{
public:
	AudioEffectX (audioMasterCallback audioMaster, long numPrograms, long numParams);
	virtual ~AudioEffectX ();

	virtual long dispatcher (long opCode, long index, long value, void *ptr, float opt);

	// 'host' are methods which go from plug to host, and are usually not overridden
	// 'plug' are methods which you may override to implement the according functionality (to host)

//----------------------------------------------------------------------------------------------------------------------------
// events + time
//----------------------------------------------------------------------------------------------------------------------------

	// host
	virtual void wantEvents (long filter = 1);		// filter is currently ignored, midi channel data only (default)
	virtual VstTimeInfo* getTimeInfo (long filter);
										// returns const VstTimeInfo* (or 0 if not supported)
										// filter should contain a mask indicating which fields are requested
										// (see valid masks in aeffectx.h), as some items may require extensive
										// conversions 
	virtual long tempoAt (long pos);	// returns tempo (in bpm * 10000) at sample frame location <pos>
	bool sendVstEventsToHost (VstEvents* events);	// true:success

	// plug
	virtual long processEvents (VstEvents* events) {return 0;}	// wants no more...else return 1!
																// VstEvents and VstMidiEvents are declared in aeffectx.h

//----------------------------------------------------------------------------------------------------------------------------
// parameters and programs
//----------------------------------------------------------------------------------------------------------------------------

	// host
	virtual long getNumAutomatableParameters ();
	virtual long getParameterQuantization ();		// 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)
	// plug
	virtual bool canParameterBeAutomated (long index) { return true; }
	virtual bool string2parameter (long index, char* text) {return false;} 	// note: implies setParameter. text==0 is to be
																			// expected to check the capability (returns true).	
	virtual float getChannelParameter (long channel, long index) {return 0;}
	virtual long getNumCategories () {return 1L;}
	virtual bool getProgramNameIndexed (long category, long index, char* text) {return false;}
	virtual bool copyProgram (long destination) {return false;}

//----------------------------------------------------------------------------------------------------------------------------
// connections, configuration
//----------------------------------------------------------------------------------------------------------------------------

	// host
	virtual bool ioChanged ();				// tell host numInputs and/or numOutputs and/or numParameters has changed
	virtual bool needIdle ();				// plug needs idle calls (outside its editor window)
	virtual bool sizeWindow (long width, long height);
	virtual double updateSampleRate ();		// gets and returns sample rate from host (may issue setSampleRate() )
	virtual long updateBlockSize ();		// same for block size
	virtual long getInputLatency ();
	virtual long getOutputLatency ();
	virtual AEffect* getPreviousPlug (long input);	// input can be -1 in which case the first found is returned
	virtual AEffect* getNextPlug (long output);		// output can be -1 in which case the first found is returned

	// plug
	virtual void inputConnected (long index, bool state) {}		// input at <index> has been (dis-)connected,
	virtual void outputConnected (long index, bool state) {}	// same as input; state == true: connected
	virtual bool getInputProperties (long index, VstPinProperties* properties) {return false;}
	virtual bool getOutputProperties (long index, VstPinProperties* properties) {return false;}
	virtual VstPlugCategory getPlugCategory()
		{ if (cEffect.flags & effFlagsIsSynth) return kPlugCategSynth; return kPlugCategUnknown; }

//----------------------------------------------------------------------------------------------------------------------------
// realtime
//----------------------------------------------------------------------------------------------------------------------------

	// host
	virtual long willProcessReplacing ();	// returns 0: not implemented, 1: replacing, 2: accumulating
	virtual long getCurrentProcessLevel ();	// returns: 0: not supported,
											// 1: currently in user thread (gui)
											// 2: currently in audio thread or irq (where process is called)
											// 3: currently in 'sequencer' thread or irq (midi, timer etc)
											// 4: currently offline processing and thus in user thread
											// other: not defined, but probably pre-empting user thread.
	virtual long getAutomationState ();		// returns 0: not supported, 1: off, 2:read, 3:write, 4:read/write
	virtual void wantAsyncOperation (bool state = true);	// notify host that we want to operate asynchronously.
											// process() will return immedeately; host will poll getCurrentPosition
											// to see if data are available in time.
	virtual void hasExternalBuffer (bool state = true);		// external dsp, may have their own output buffe (32 bit float)
											// host then requests this via effGetDestinationBuffer

	// plug
	virtual long reportCurrentPosition () {return 0;}		// for external dsp, see wantAsyncOperation ()
	virtual float* reportDestinationBuffer () {return 0;}	// for external dsp (dma option)

//----------------------------------------------------------------------------------------------------------------------------
// offline
//----------------------------------------------------------------------------------------------------------------------------

	// host
	virtual bool offlineRead (VstOfflineTask* offline, VstOfflineOption option, bool readSource = true);
	virtual bool offlineWrite (VstOfflineTask* offline, VstOfflineOption option);
	virtual bool offlineStart (VstAudioFile* ptr, long numAudioFiles, long numNewAudioFiles);
	virtual long offlineGetCurrentPass ();
	virtual long offlineGetCurrentMetaPass ();

	// plug
	virtual bool offlineNotify (VstAudioFile* ptr, long numAudioFiles, bool start) { return false; }
	virtual bool offlinePrepare (VstOfflineTask* offline, long count) {return false;}
	virtual bool offlineRun (VstOfflineTask* offline, long count) {return false;}

	virtual long offlineGetNumPasses () {return 0;}
	virtual long offlineGetNumMetaPasses () {return 0;}

//----------------------------------------------------------------------------------------------------------------------------
// other
//----------------------------------------------------------------------------------------------------------------------------

	// host
	virtual void setOutputSamplerate (float samplerate);
	virtual bool getSpeakerArrangement (VstSpeakerArrangement* pluginInput, VstSpeakerArrangement* pluginOutput);
	virtual bool getHostVendorString (char* text);		// fills <text> with a string identifying the vendor (max 64 char)
	virtual bool getHostProductString (char* text);		// fills <text> with a string with product name (max 64 char)
	virtual long getHostVendorVersion ();				// returns vendor-specific version
	virtual long hostVendorSpecific (long lArg1, long lArg2, void* ptrArg, float floatArg);		// no definition
	virtual long canHostDo (char* text);				// see 'hostCanDos' in audioeffectx.cpp
														// returns 0: don't know (default), 1: yes, -1: no
	virtual void isSynth (bool state = true);			// will call wantEvents if true
	virtual void noTail (bool state = true);			// true: tells host we produce no output when silence comes in
														// enables host to omit process() when no data are present
														// on any one input.
	virtual long getHostLanguage ();					// returns VstHostLanguage
	virtual void* openWindow (VstWindow*);				// create new window
	virtual bool closeWindow (VstWindow*);				// close a newly created window
	virtual void* getDirectory ();						// get the plug's directory, FSSpec on mac, else char*
	virtual bool updateDisplay();						// something has changed, update 'multi-fx' display
														// returns true if supported

	// plug
	virtual bool processVariableIo (VstVariableIo* varIo) {return false;}
	virtual bool setSpeakerArrangement (VstSpeakerArrangement* pluginInput, VstSpeakerArrangement* pluginOutput) {return false;}
	virtual void setBlockSizeAndSampleRate (long blockSize, float sampleRate)
		{this->blockSize = blockSize; this->sampleRate = sampleRate;}
	virtual bool setBypass(bool onOff) {return false;}			// for 'soft-bypass; process() still called
	virtual bool getEffectName (char* name) {return false;}		// name max 32 char
	virtual bool getErrorText (char* text) {return false;}		// max 256 char
	virtual bool getVendorString (char* text) {return false;}	// fill text with a string identifying the vendor (max 64 char)
	virtual bool getProductString (char* text) {return false;}	// fill text with a string identifying the product name (max 64 char)					// fills <ptr> with a string with product name (max 64 char)
	virtual long getVendorVersion () {return 0;}				// return vendor-specific version
	virtual long vendorSpecific (long lArg, long lArg2, void* ptrArg, float floatArg) {return 0;}
														// no definition, vendor specific handling
	virtual long canDo (char* text) {return 0;}			// see 'plugCanDos' in audioeffectx.cpp. return values:
														// 0: don't know (default), 1: yes, -1: no
	virtual void* getIcon () {return 0;}				// not yet defined
	virtual bool setViewPosition (long x, long y) {return false;}
	virtual long getGetTailSize () {return 0; }
	virtual long fxIdle () {return 0;}
	virtual bool getParameterProperties (long index, VstParameterProperties* p) {return false;}
	virtual bool keysRequired () {return false;}		// version 1 plugs will return true
	virtual long getVstVersion () {return 2;}
};

#endif