aboutsummaryrefslogtreecommitdiff
path: root/Vst
diff options
context:
space:
mode:
Diffstat (limited to 'Vst')
-rw-r--r--Vst/AEffEditor.h44
-rw-r--r--Vst/AEffect.h172
-rw-r--r--Vst/AEffectx.h534
-rw-r--r--Vst/AudioEffect.hpp109
-rw-r--r--Vst/audioeffectx.h185
5 files changed, 1044 insertions, 0 deletions
diff --git a/Vst/AEffEditor.h b/Vst/AEffEditor.h
new file mode 100644
index 0000000..16d5fa1
--- /dev/null
+++ b/Vst/AEffEditor.h
@@ -0,0 +1,44 @@
+#ifndef __AEffEditor__
+#define __AEffEditor__
+
+class AudioEffect;
+
+struct ERect
+{
+ short top;
+ short left;
+ short bottom;
+ short right;
+};
+
+class AEffEditor
+{
+public:
+ AEffEditor (AudioEffect *effect) {this->effect = effect; updateFlag = 0; }
+ virtual ~AEffEditor() {}
+
+ virtual long getRect(ERect **rect) {*rect = 0; return 0;}
+ virtual long open(void *ptr) {systemWindow = ptr; return 0;}
+ virtual void close() {}
+ virtual void idle() { if(updateFlag) {updateFlag = 0; update();} }
+
+#if MAC
+ virtual void draw(ERect *rect) {rect = rect;}
+ virtual long mouse(long x, long y) {x = x; y = y; return 0;}
+ virtual long key(long keyCode) {keyCode = keyCode; return 0;}
+ virtual void top() {}
+ virtual void sleep() {}
+#endif
+ virtual void update() {}
+ virtual void postUpdate() {updateFlag = 1;}
+
+protected:
+ AEffEditor () {};
+
+ AudioEffect *effect;
+ void *systemWindow;
+ long updateFlag;
+};
+
+#endif
+
diff --git a/Vst/AEffect.h b/Vst/AEffect.h
new file mode 100644
index 0000000..c6c9557
--- /dev/null
+++ b/Vst/AEffect.h
@@ -0,0 +1,172 @@
+#ifndef __AEffect__
+#define __AEffect__
+
+/*
+ to create an Audio Effect for power pc's, create a
+ code resource
+ file type: 'aPcs'
+ resource type: 'aEff'
+ ppc header: none (raw pef)
+
+ for windows, it's a .dll
+
+ the only symbol searched for is:
+ AEffect *main(float (*audioMaster)(AEffect *effect, long opcode, long index,
+ long value, void *ptr, float opt));
+*/
+
+#if PRAGMA_ALIGN_SUPPORTED || __MWERKS__
+ #pragma options align=mac68k
+#elif defined CBUILDER
+ #pragma -a8
+#elif defined(WIN32) || defined(__FLAT__)
+ #pragma pack(push)
+ #pragma pack(8)
+#endif
+
+#if defined(WIN32) || defined(__FLAT__) || defined CBUILDER
+ #define VSTCALLBACK __cdecl
+#else
+ #define VSTCALLBACK
+#endif
+
+//---------------------------------------------------------------------------------------------
+// misc def's
+//---------------------------------------------------------------------------------------------
+
+typedef struct AEffect AEffect;
+typedef long (VSTCALLBACK *audioMasterCallback)(AEffect *effect, long opcode, long index,
+ long value, void *ptr, float opt);
+
+// prototype for plug-in main
+// AEffect *main(audioMasterCallback audioMaster);
+
+#ifdef CBUILDER
+ #define kEffectMagic 'PtsV'
+#else
+ #define kEffectMagic 'VstP'
+#endif
+
+//---------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------
+
+struct AEffect
+{
+ long magic; // must be kEffectMagic ('VstP')
+ long (VSTCALLBACK *dispatcher)(AEffect *effect, long opCode, long index, long value,
+ void *ptr, float opt);
+ void (VSTCALLBACK *process)(AEffect *effect, float **inputs, float **outputs, long sampleframes);
+ void (VSTCALLBACK *setParameter)(AEffect *effect, long index, float parameter);
+ float (VSTCALLBACK *getParameter)(AEffect *effect, long index);
+
+ long numPrograms;
+ long numParams; // all programs are assumed to have numParams parameters
+ long numInputs; //
+ long numOutputs; //
+ long flags; // see constants
+ long resvd1; // reserved, must be 0
+ long resvd2; // reserved, must be 0
+ long initialDelay; // for algorithms which need input in the first place
+ long realQualities; // number of realtime qualities (0: realtime)
+ long offQualities; // number of offline qualities (0: realtime only)
+ float ioRatio; // input samplerate to output samplerate ratio, not used yet
+ void *object; // for class access (see AudioEffect.hpp), MUST be 0 else!
+ void *user; // user access
+ long uniqueID; // pls choose 4 character as unique as possible.
+ // this is used to identify an effect for save+load
+ long version; //
+ void (VSTCALLBACK *processReplacing)(AEffect *effect, float **inputs, float **outputs, long sampleframes);
+ char future[60]; // pls zero
+};
+
+
+//---------------------------------------------------------------------------------------------
+// flags bits
+//---------------------------------------------------------------------------------------------
+
+#define effFlagsHasEditor 1 // if set, is expected to react to editor messages
+#define effFlagsHasClip 2 // return > 1. in getVu() if clipped
+#define effFlagsHasVu 4 // return vu value in getVu(); > 1. means clipped
+#define effFlagsCanMono 8 // if numInputs == 2, makes sense to be used for mono in
+#define effFlagsCanReplacing 16 // supports in place output (processReplacing() exsists)
+#define effFlagsProgramChunks 32 // program data are handled in formatless chunks
+
+//---------------------------------------------------------------------------------------------
+// dispatcher opCodes
+//---------------------------------------------------------------------------------------------
+
+enum
+{
+ effOpen = 0, // initialise
+ effClose, // exit, release all memory and other resources!
+
+ effSetProgram, // program no in <value>
+ effGetProgram, // return current program no.
+ effSetProgramName, // user changed program name (max 24 char + 0) to as passed in string
+ effGetProgramName, // stuff program name (max 24 char + 0) into string
+
+ effGetParamLabel, // stuff parameter <index> label (max 8 char + 0) into string
+ // (examples: sec, dB, type)
+ effGetParamDisplay, // stuff parameter <index> textual representation into string
+ // (examples: 0.5, -3, PLATE)
+ effGetParamName, // stuff parameter <index> label (max 8 char + 0) into string
+ // (examples: Time, Gain, RoomType)
+ effGetVu, // called if (flags & (effFlagsHasClip | effFlagsHasVu))
+
+ // system
+
+ effSetSampleRate, // in opt (float)
+ effSetBlockSize, // in value
+ effMainsChanged, // the user has switched the 'power on' button to
+ // value (0 off, else on). This only switches audio
+ // processing; you should flush delay buffers etc.
+ // editor
+
+ effEditGetRect, // stuff rect (top, left, bottom, right) into ptr
+ effEditOpen, // system dependant Window pointer in ptr
+ effEditClose, // no arguments
+ effEditDraw, // draw method, ptr points to rect
+ effEditMouse, // index: x, value: y
+ effEditKey, // system keycode in value
+ effEditIdle, // no arguments. Be gentle!
+ effEditTop, // window has topped, no arguments
+ effEditSleep, // window goes to background
+
+ // new
+
+ effIdentify, // returns 'NvEf'
+ effGetChunk, // host requests pointer to chunk into (void**)ptr, byteSize returned
+ effSetChunk, // plug-in receives saved chunk, byteSize passed
+
+ effNumOpcodes
+};
+
+//---------------------------------------------------------------------------------------------
+// audioMaster opCodes
+//---------------------------------------------------------------------------------------------
+
+enum
+{
+ audioMasterAutomate = 0, // index, value, returns 0
+ audioMasterVersion, // vst version, currently 2 (0 for older)
+ audioMasterCurrentId, // returns the unique id of a plug that's currently
+ // loading
+ audioMasterIdle, // call application idle routine (this will
+ // call effEditIdle for all open editors too)
+ audioMasterPinConnected // inquire if an input or output is beeing connected;
+ // index enumerates input or output counting from zero,
+ // value is 0 for input and != 0 otherwise. note: the
+ // return value is 0 for <true> such that older versions
+ // will always return true.
+
+};
+
+#if PRAGMA_ALIGN_SUPPORTED || __MWERKS__
+ #pragma options align=reset
+#elif defined(WIN32) || defined(__FLAT__)
+ #pragma pack(pop)
+#elif defined CBUILDER
+ #pragma -a-
+#endif
+
+#endif // __AEffect__
diff --git a/Vst/AEffectx.h b/Vst/AEffectx.h
new file mode 100644
index 0000000..7dfefbd
--- /dev/null
+++ b/Vst/AEffectx.h
@@ -0,0 +1,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
+
diff --git a/Vst/AudioEffect.hpp b/Vst/AudioEffect.hpp
new file mode 100644
index 0000000..08eb6d1
--- /dev/null
+++ b/Vst/AudioEffect.hpp
@@ -0,0 +1,109 @@
+#ifndef __AudioEffect__
+#define __AudioEffect__
+
+#include "AEffect.h" // "c" interface
+#include <string.h>
+
+class AEffEditor;
+class AudioEffect;
+
+// Needs to be defined by the audio effect and is
+// called to create the audio effect object instance.
+AudioEffect* createEffectInstance (audioMasterCallback audioMaster);
+
+long dispatchEffectClass(AEffect *e,
+ long opCode, long index, long value, void *ptr, float opt);
+float getParameterClass(long index);
+void setParameterClass(long index, float value);
+void processClass(AEffect *e, float **inputs, float **outputs, long sampleFrames);
+void processClassReplacing(AEffect *e, float **inputs, float **outputs, long sampleFrames);
+
+class AudioEffect
+{
+friend class AEffEditor;
+friend long dispatchEffectClass(AEffect *e, long opCode, long index, long value, void *ptr, float opt);
+friend float getParameterClass(AEffect *e, long index);
+friend void setParameterClass(AEffect *e, long index, float value);
+friend void processClass(AEffect *e, float **inputs, float **outputs, long sampleFrames);
+friend void processClassReplacing(AEffect *e, float **inputs, float **outputs, long sampleFrames);
+
+public:
+ AudioEffect(audioMasterCallback audioMaster, long numPrograms, long numParams);
+ virtual ~AudioEffect();
+
+ virtual void setParameter(long index, float value) {index = index; value = value;}
+ virtual float getParameter(long index) {index = index; return 0;}
+ virtual void setParameterAutomated(long index, float value);
+
+ AEffect *getAeffect() {return &cEffect;}
+ void setEditor(AEffEditor *editor)
+ { this->editor = editor;
+ if(editor) cEffect.flags |= effFlagsHasEditor;
+ else cEffect.flags &= ~effFlagsHasEditor;}
+
+ // called from audio master
+ virtual void process(float **inputs, float **outputs, long sampleFrames) = 0;
+ virtual void processReplacing(float **inputs, float **outputs, long sampleFrames)
+ {inputs = inputs; outputs = outputs; sampleFrames = sampleFrames;}
+ virtual long dispatcher(long opCode, long index, long value, void *ptr, float opt);
+ virtual void open() {}
+ virtual void close() {}
+ virtual long getProgram() {return curProgram;}
+ virtual void setProgram(long program) {curProgram = program;} // don't forget to set curProgram
+ virtual void setProgramName(char *name) {*name = 0;} // all following refer to curProgram
+ virtual void getProgramName(char *name) {*name = 0;}
+ virtual void getParameterLabel(long index, char *label) {index = index; *label = 0;}
+ virtual void getParameterDisplay(long index, char *text) {index = index; *text = 0;}
+ virtual void getParameterName(long index, char *text) {index = index; *text = 0;}
+ virtual float getVu() {return 0;}
+ virtual long getChunk(void** data, bool isPreset = false) {return 0;} // returns byteSize
+ virtual long setChunk(void* data, long byteSize, bool isPreset = false) {return 0;}
+ virtual void setSampleRate(float sampleRate) {this->sampleRate = sampleRate;}
+ virtual void setBlockSize(long blockSize) {this->blockSize = blockSize;}
+ virtual void suspend() {}
+ virtual void resume() {}
+
+ // setup
+ virtual void setUniqueID(long iD) {cEffect.uniqueID = iD;} // must call this!
+ virtual void setNumInputs(long inputs) {cEffect.numInputs = inputs;}
+ virtual void setNumOutputs(long outputs) {cEffect.numOutputs = outputs;}
+ virtual void hasVu(bool state = true);
+ virtual void hasClip(bool state = true);
+ virtual void canMono(bool state = true);
+ virtual void canProcessReplacing(bool state = true);
+ virtual void programsAreChunks(bool state = true);
+ virtual void setRealtimeQualities(long qualities);
+ virtual void setOfflineQualities(long qualities);
+ virtual void setInitialDelay(long delay);
+
+ // inquiry
+ virtual float getSampleRate() {return sampleRate;}
+ virtual long getBlockSize() {return blockSize;}
+
+ // host communication
+ virtual long getMasterVersion();
+ virtual long getCurrentUniqueId();
+ virtual void masterIdle();
+ virtual bool isInputConnected(long input);
+ virtual bool isOutputConnected(long output);
+
+ // tools
+ virtual void dB2string(float value, char *text);
+ virtual void Hz2string(float samples, char *text);
+ virtual void ms2string(float samples, char *text);
+ virtual void float2string(float value, char *string);
+ virtual void long2string(long value, char *text);
+
+protected:
+ // members
+ float sampleRate;
+ AEffEditor *editor;
+ audioMasterCallback audioMaster;
+ long numPrograms;
+ long numParams;
+ long curProgram;
+ long blockSize;
+ AEffect cEffect;
+};
+
+#endif
diff --git a/Vst/audioeffectx.h b/Vst/audioeffectx.h
new file mode 100644
index 0000000..435a63e
--- /dev/null
+++ b/Vst/audioeffectx.h
@@ -0,0 +1,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