This commit is contained in:
2024-08-07 09:16:27 -04:00
parent fdfadd5c7e
commit 5f971cf684
5200 changed files with 731717 additions and 0 deletions

71
vst/AEffEditor.hpp Normal file
View File

@@ -0,0 +1,71 @@
//-------------------------------------------------------------------------------------------------------
// VST Plug-Ins SDK
// Version 2.3 Extension
// <20> 2003, Steinberg Media Technologies, All Rights Reserved
//-------------------------------------------------------------------------------------------------------
#ifndef __AEffEditor__
#define __AEffEditor__
class AudioEffect;
//----------------------------------------------------------------------
struct ERect
{
short top;
short left;
short bottom;
short right;
};
#ifndef __aeffectx__
#include "aeffectx.h"
#endif
#define VST_2_1_EXTENSIONS 1
//----------------------------------------------------------------------
// class AEffEditor Declaration
//----------------------------------------------------------------------
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; }
#if VST_2_1_EXTENSIONS
virtual long onKeyDown (VstKeyCode &keyCode) { keyCode = keyCode; return -1; }
virtual long onKeyUp (VstKeyCode &keyCode) { keyCode = keyCode; return -1; }
virtual long setKnobMode (int val) { return 0; };
virtual bool onWheel (float distance) { return false; };
#endif
protected:
AEffEditor () {};
AudioEffect *effect;
void *systemWindow;
long updateFlag;
};
#endif // __AEffEditor__
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------

199
vst/AEffect.h Normal file
View File

@@ -0,0 +1,199 @@
//-------------------------------------------------------------------------------------------------------
// VST Plug-Ins SDK
// Version 1.0
// <20> 2003, Steinberg Media Technologies, All Rights Reserved
//-------------------------------------------------------------------------------------------------------
#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 CARBON
#if PRAGMA_STRUCT_ALIGN || __MWERKS__
#pragma options align=mac68k
#endif
#else
#if PRAGMA_ALIGN_SUPPORTED || __MWERKS__
#pragma options align=mac68k
#endif
#endif
#if defined __BORLANDC__
#pragma -a8
#elif defined(WIN32) || defined(__FLAT__) || defined CBUILDER
#pragma pack(push)
#pragma pack(8)
#define VSTCALLBACK __cdecl
#else
#define VSTCALLBACK
#endif
//-------------------------------------------------
// Misc. Definition
//-------------------------------------------------
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);
// Four Character Constant
#define CCONST(a, b, c, d) \
((((long)a) << 24) | (((long)b) << 16) | (((long)c) << 8) | (((long)d) << 0))
// Magic Number
#define kEffectMagic CCONST ('V', 's', 't', 'P')
//-------------------------------------------------
// AEffect Structure
//-------------------------------------------------
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; // number of Programs
long numParams; // all programs are assumed to have numParams parameters
long numInputs; // number of Audio Inputs
long numOutputs; // number of Audio Outputs
long flags; // see constants (Flags Bits)
long resvd1; // reserved for Host, must be 0 (Dont use it)
long resvd2; // reserved for Host, must be 0 (Dont use it)
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. (register it at Steinberg Web)
// this is used to identify an effect for save+load
long version; // (example 1100 for version 1.1.0.0)
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 value in Hz; for example 44100.0Hz)
effSetBlockSize, // in value (this is the maximun size of an audio block,
// pls check sampleframes in process call)
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 (MAC Only)
effEditMouse, // index: x, value: y (MAC Only)
effEditKey, // system keycode in value
effEditIdle, // no arguments. Be gentle!
effEditTop, // window has topped, no arguments
effEditSleep, // window goes to background
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 supported (for example 2200 for VST 2.2)
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 CARBON
#if PRAGMA_STRUCT_ALIGN || __MWERKS__
#pragma options align=reset
#endif
#else
#if PRAGMA_ALIGN_SUPPORTED || __MWERKS__
#pragma options align=reset
#elif defined(WIN32) || defined(__FLAT__)
#pragma pack(pop)
#elif defined __BORLANDC__
#pragma -a-
#endif
#endif
#endif // __AEffect__

393
vst/AudioEffect.cpp Normal file
View File

@@ -0,0 +1,393 @@
//-------------------------------------------------------------------------------------------------------
// VST Plug-Ins SDK
// Version 1.0
// <20> 2003 Steinberg Media Technologies, All Rights Reserved
//
// you should not have to edit this file
// use override methods instead
//-------------------------------------------------------------------------------------------------------
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#ifndef __AudioEffect__
#include "AudioEffect.hpp"
#endif
#ifndef __AEffEditor__
#include "AEffEditor.hpp"
#endif
//-------------------------------------------------------------------------------------------------------
long dispatchEffectClass (AEffect *e, long opCode, long index, long value, void *ptr, float opt)
{
AudioEffect *ae = (AudioEffect*)(e->object);
if (opCode == effClose)
{
ae->dispatcher (opCode, index, value, ptr, opt);
delete ae;
return 1;
}
return ae->dispatcher (opCode, index, value, ptr, opt);
}
//-------------------------------------------------------------------------------------------------------
float getParameterClass (AEffect *e, long index)
{
AudioEffect *ae = (AudioEffect*)(e->object);
return ae->getParameter (index);
}
//-------------------------------------------------------------------------------------------------------
void setParameterClass (AEffect *e, long index, float value)
{
AudioEffect *ae = (AudioEffect*)(e->object);
ae->setParameter (index, value);
}
//-------------------------------------------------------------------------------------------------------
void processClass (AEffect *e, float **inputs, float **outputs, long sampleFrames)
{
AudioEffect *ae = (AudioEffect*)(e->object);
ae->process (inputs, outputs, sampleFrames);
}
//-------------------------------------------------------------------------------------------------------
void processClassReplacing (AEffect *e, float **inputs, float **outputs, long sampleFrames)
{
AudioEffect *ae = (AudioEffect*)(e->object);
ae->processReplacing (inputs, outputs, sampleFrames);
}
//-------------------------------------------------------------------------------------------------------
// AudioEffect Implementation
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
AudioEffect::AudioEffect (AudioMasterCallback audioMaster, long numPrograms, long numParams)
{
this->audioMaster = audioMaster;
editor = 0;
this->numPrograms = numPrograms;
this->numParams = numParams;
curProgram = 0;
memset(&cEffect, 0, sizeof (cEffect));
cEffect.magic = kEffectMagic;
cEffect.dispatcher = dispatchEffectClass;
cEffect.process = processClass;
cEffect.setParameter = setParameterClass;
cEffect.getParameter = getParameterClass;
cEffect.numPrograms = numPrograms;
cEffect.numParams = numParams;
cEffect.numInputs = 1;
cEffect.numOutputs = 2;
cEffect.flags = 0;
cEffect.resvd1 = 0;
cEffect.resvd2 = 0;
cEffect.initialDelay = 0;
cEffect.realQualities = 0;
cEffect.offQualities = 0;
cEffect.ioRatio = 1.f;
cEffect.object = this;
cEffect.user = 0;
cEffect.uniqueID = CCONST ('N', 'o', 'E', 'f'); // you must set this!
cEffect.version = 1;
cEffect.processReplacing = processClassReplacing;
sampleRate = 44100.f;
blockSize = 1024L;
}
//-------------------------------------------------------------------------------------------------------
AudioEffect::~AudioEffect ()
{
if (editor)
delete editor;
}
//-------------------------------------------------------------------------------------------------------
long AudioEffect::dispatcher (long opCode, long index, long value, void *ptr, float opt)
{
long v = 0;
switch (opCode)
{
case effOpen: open (); break;
case effClose: close (); break;
case effSetProgram: if (value < numPrograms) setProgram (value); break;
case effGetProgram: v = getProgram (); break;
case effSetProgramName: setProgramName ((char *)ptr); break;
case effGetProgramName: getProgramName ((char *)ptr); break;
case effGetParamLabel: getParameterLabel (index, (char *)ptr); break;
case effGetParamDisplay: getParameterDisplay (index, (char *)ptr); break;
case effGetParamName: getParameterName (index, (char *)ptr); break;
case effSetSampleRate: setSampleRate (opt); break;
case effSetBlockSize: setBlockSize (value); break;
case effMainsChanged: if (!value) suspend (); else resume (); break;
case effGetVu: v = (long)(getVu () * 32767.); break;
// Editor
case effEditGetRect: if (editor) v = editor->getRect ((ERect **)ptr); break;
case effEditOpen: if (editor) v = editor->open (ptr); break;
case effEditClose: if (editor) editor->close (); break;
case effEditIdle: if (editor) editor->idle (); break;
#if MAC
case effEditDraw: if (editor) editor->draw ((ERect *)ptr); break;
case effEditMouse: if (editor) v = editor->mouse (index, value); break;
case effEditKey: if (editor) v = editor->key (value); break;
case effEditTop: if (editor) editor->top (); break;
case effEditSleep: if (editor) editor->sleep (); break;
#endif
case effIdentify: v = CCONST ('N', 'v', 'E', 'f'); break;
case effGetChunk: v = getChunk ((void**)ptr, index ? true : false); break;
case effSetChunk: v = setChunk (ptr, value, index ? true : false); break;
}
return v;
}
//-------------------------------------------------------------------------------------------------------
long AudioEffect::getMasterVersion ()
{
long version = 1;
if (audioMaster)
{
version = audioMaster (&cEffect, audioMasterVersion, 0, 0, 0, 0);
if (!version) // old
version = 1;
}
return version;
}
//-------------------------------------------------------------------------------------------------------
long AudioEffect::getCurrentUniqueId ()
{
long id = 0;
if (audioMaster)
id = audioMaster (&cEffect, audioMasterCurrentId, 0, 0, 0, 0);
return id;
}
//-------------------------------------------------------------------------------------------------------
void AudioEffect::masterIdle ()
{
if (audioMaster)
audioMaster (&cEffect, audioMasterIdle, 0, 0, 0, 0);
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffect::isInputConnected (long input)
{
long ret = 0;
if (audioMaster)
ret = audioMaster (&cEffect, audioMasterPinConnected, input, 0, 0, 0);
return ret ? false : true; // return value is 0 for true
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffect::isOutputConnected (long output)
{
long ret = 0;
if (audioMaster)
ret = audioMaster (&cEffect, audioMasterPinConnected, output, 1, 0, 0);
return ret ? false : true; // return value is 0 for true
}
//-------------------------------------------------------------------------------------------------------
void AudioEffect::setParameterAutomated (long index, float value)
{
setParameter (index, value);
if (audioMaster)
audioMaster (&cEffect, audioMasterAutomate, index, 0, 0, value); // value is in opt
}
//-------------------------------------------------------------------------------------------------------
// Flags
//-------------------------------------------------------------------------------------------------------
void AudioEffect::hasVu (bool state)
{
if (state)
cEffect.flags |= effFlagsHasVu;
else
cEffect.flags &= ~effFlagsHasVu;
}
//-------------------------------------------------------------------------------------------------------
void AudioEffect::hasClip (bool state)
{
if (state)
cEffect.flags |= effFlagsHasClip;
else
cEffect.flags &= ~effFlagsHasClip;
}
//-------------------------------------------------------------------------------------------------------
void AudioEffect::canMono (bool state)
{
if (state)
cEffect.flags |= effFlagsCanMono;
else
cEffect.flags &= ~effFlagsCanMono;
}
//-------------------------------------------------------------------------------------------------------
void AudioEffect::canProcessReplacing (bool state)
{
if (state)
cEffect.flags |= effFlagsCanReplacing;
else
cEffect.flags &= ~effFlagsCanReplacing;
}
//-------------------------------------------------------------------------------------------------------
void AudioEffect::programsAreChunks (bool state)
{
if (state)
cEffect.flags |= effFlagsProgramChunks;
else
cEffect.flags &= ~effFlagsProgramChunks;
}
//-------------------------------------------------------------------------------------------------------
void AudioEffect::setRealtimeQualities (long qualities)
{
cEffect.realQualities = qualities;
}
//-------------------------------------------------------------------------------------------------------
void AudioEffect::setOfflineQualities (long qualities)
{
cEffect.offQualities = qualities;
}
//-------------------------------------------------------------------------------------------------------
void AudioEffect::setInitialDelay (long delay)
{
cEffect.initialDelay = delay;
}
//-------------------------------------------------------------------------------------------------------
// Strings Conversion
//-------------------------------------------------------------------------------------------------------
void AudioEffect::dB2string (float value, char *text)
{
if (value <= 0)
#if MAC
strcpy (text, "-<2D>");
#else
strcpy (text, "-oo");
#endif
else
float2string ((float)(20. * log10 (value)), text);
}
//-------------------------------------------------------------------------------------------------------
void AudioEffect::Hz2string (float samples, char *text)
{
float sampleRate = getSampleRate ();
if (!samples)
float2string (0, text);
else
float2string (sampleRate / samples, text);
}
//-------------------------------------------------------------------------------------------------------
void AudioEffect::ms2string (float samples, char *text)
{
float2string ((float)(samples * 1000. / getSampleRate ()), text);
}
//-------------------------------------------------------------------------------------------------------
void AudioEffect::float2string (float value, char *text)
{
long c = 0, neg = 0;
char string[32];
char *s;
double v, integ, i10, mantissa, m10, ten = 10.;
v = (double)value;
if (v < 0)
{
neg = 1;
value = -value;
v = -v;
c++;
if (v > 9999999.)
{
strcpy (string, "Huge!");
return;
}
}
else if( v > 99999999.)
{
strcpy (string, "Huge!");
return;
}
s = string + 31;
*s-- = 0;
*s-- = '.';
c++;
integ = floor (v);
i10 = fmod (integ, ten);
*s-- = (char)((long)i10 + '0');
integ /= ten;
c++;
while (integ >= 1. && c < 8)
{
i10 = fmod (integ, ten);
*s-- = (char)((long)i10 + '0');
integ /= ten;
c++;
}
if (neg)
*s-- = '-';
strcpy (text, s + 1);
if (c >= 8)
return;
s = string + 31;
*s-- = 0;
mantissa = fmod (v, 1.);
mantissa *= pow (ten, (double)(8 - c));
while (c < 8)
{
if (mantissa <= 0)
*s-- = '0';
else
{
m10 = fmod (mantissa, ten);
*s-- = (char)((long)m10 + '0');
mantissa /= 10.;
}
c++;
}
strcat (text, s + 1);
}
//-------------------------------------------------------------------------------------------------------
void AudioEffect::long2string (long value, char *text)
{
char string[32];
if (value >= 100000000)
{
strcpy (text, "Huge!");
return;
}
sprintf (string, "%7d", (int)value);
string[8] = 0;
strcpy (text, (char *)string);
}
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------

131
vst/AudioEffect.hpp Normal file
View File

@@ -0,0 +1,131 @@
//-------------------------------------------------------------------------------------------------------
// VST Plug-Ins SDK
// Version 1.0
// <20> 2003, Steinberg Media Technologies, All Rights Reserved
//-------------------------------------------------------------------------------------------------------
#ifndef __AudioEffect__
#define __AudioEffect__
#ifndef __AEffect__
#include "AEffect.h" // "c" interface
#endif
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; } // Returns the AEffect Structure
void setEditor (AEffEditor *editor)
{ this->editor = editor;
if (editor) cEffect.flags |= effFlagsHasEditor;
else cEffect.flags &= ~effFlagsHasEditor; } // Should be called if you want to define your own editor
//---Called from audio master (Host -> Plug)---------------
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); // Opcodes dispatcher
virtual void open () {} // Called when Plugin is initialized
virtual void close () {} // Called when Plugin will be released
//---Program----------------------------
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; } // example: "dB"
virtual void getParameterDisplay (long index, char *text) { index = index; *text = 0; } // example: "6.01"
virtual void getParameterName (long index, char *text) { index = index; *text = 0; } // example: "Volume"
virtual float getVu () { return 0; }
virtual long getChunk (void** data, bool isPreset = false) { return 0; } // Returns the Size in bytes of the chunk (Plugin allocates the data array)
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 () {} // Called when Plugin is switched to Off
virtual void resume () {} // Called when Plugin is switched to On
//---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); // Tells that the processReplacing () could be used
virtual void programsAreChunks (bool state = true);
virtual void setRealtimeQualities (long qualities);
virtual void setOfflineQualities (long qualities);
virtual void setInitialDelay (long delay); // Uses to report the Plugin's latency (Group 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 // __AudioEffect__
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------

798
vst/AudioEffectX.cpp Normal file
View File

@@ -0,0 +1,798 @@
//-------------------------------------------------------------------------------------------------------
// VST Plug-Ins SDK
// Version 2.3 Extension
// <20> 2003 Steinberg Media Technologies, All Rights Reserved
//
// you should not have to edit this file
// use override methods instead, as suggested in the class declaration (audioeffectx.h)
//-------------------------------------------------------------------------------------------------------
#ifndef __audioeffectx__
#include "AudioEffectX.hpp"
#endif
#ifndef __AEffEditor__
#include "AEffEditor.hpp"
#endif
//---------------------------------------------------------------------------------------------
// 'canDo' strings. note other 'canDos' can be evaluated by calling the according
// function, for instance if getSampleRate returns 0, you
// will certainly want to assume that this selector is not supported.
//---------------------------------------------------------------------------------------------
const char* hostCanDos [] =
{
"sendVstEvents",
"sendVstMidiEvent",
"sendVstTimeInfo",
"receiveVstEvents",
"receiveVstMidiEvent",
"receiveVstTimeInfo",
"reportConnectionChanges",
"acceptIOChanges",
"sizeWindow",
"asyncProcessing",
"offline",
"supplyIdle",
"supportShell", // old waveshell handling, dont use it anymore.
"openFileSelector"
#if VST_2_2_EXTENSIONS
,
"editFile",
"closeFileSelector"
#endif // VST_2_2_EXTENSIONS
#if VST_2_3_EXTENSIONS
,
"startStopProcess", // if supported by the Host, it will call startProcess and stopProcess
"shellCategory" // 'shell' handling via uniqueID. If supported by the Host and
// the Plugin has the category kPlugCategShell the host will call
// getNextShellPlugin () to extract the name of each included plugin.
#endif // VST_2_3_EXTENSIONS
};
const char* plugCanDos [] =
{
"sendVstEvents",
"sendVstMidiEvent",
"sendVstTimeInfo",
"receiveVstEvents",
"receiveVstMidiEvent",
"receiveVstTimeInfo",
"offline",
"plugAsChannelInsert",
"plugAsSend",
"mixDryWet",
"noRealTime",
"multipass",
"metapass",
"1in1out",
"1in2out",
"2in1out",
"2in2out",
"2in4out",
"4in2out",
"4in4out",
"4in8out", // 4:2 matrix to surround bus
"8in4out", // surround bus to 4:2 matrix
"8in8out"
#if VST_2_1_EXTENSIONS
,
"midiProgramNames",
"conformsToWindowRules" // mac: doesn't mess with grafport. general: may want
// to call sizeWindow (). if you want to use sizeWindow (),
// you must return true (1) in canDo ("conformsToWindowRules")
#endif // VST_2_1_EXTENSIONS
#if VST_2_3_EXTENSIONS
,
"bypass"
#endif // VST_2_3_EXTENSIONS
};
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
// AudioEffectX extends AudioEffect with the new features. so you should derive
// your plug from AudioEffectX
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
// VstEvents + VstTimeInfo
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
AudioEffectX::AudioEffectX (AudioMasterCallback audioMaster, long numPrograms, long numParams)
: AudioEffect (audioMaster, numPrograms, numParams)
{
}
//-------------------------------------------------------------------------------------------------------
AudioEffectX::~AudioEffectX ()
{
}
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::dispatcher (long opCode, long index, long value, void *ptr, float opt)
{
long v = 0;
switch(opCode)
{
// VstEvents
case effProcessEvents:
v = processEvents ((VstEvents*)ptr);
break;
// parameters and programs
case effCanBeAutomated:
v = canParameterBeAutomated (index) ? 1 : 0;
break;
case effString2Parameter:
v = string2parameter (index, (char*)ptr) ? 1 : 0;
break;
case effGetNumProgramCategories:
v = getNumCategories ();
break;
case effGetProgramNameIndexed:
v = getProgramNameIndexed (value, index, (char*)ptr) ? 1 : 0;
break;
case effCopyProgram:
v = copyProgram (index) ? 1 : 0;
break;
// connections, configuration
case effConnectInput:
inputConnected (index, value ? true : false);
v = 1;
break;
case effConnectOutput:
outputConnected (index, value ? true : false);
v = 1;
break;
case effGetInputProperties:
v = getInputProperties (index, (VstPinProperties*)ptr) ? 1 : 0;
break;
case effGetOutputProperties:
v = getOutputProperties (index, (VstPinProperties*)ptr) ? 1 : 0;
break;
case effGetPlugCategory:
v = (long)getPlugCategory ();
break;
// realtime
case effGetCurrentPosition:
v = reportCurrentPosition ();
break;
case effGetDestinationBuffer:
v = (long)reportDestinationBuffer ();
break;
// offline
case effOfflineNotify:
v = offlineNotify ((VstAudioFile*)ptr, value, index != 0);
break;
case effOfflinePrepare:
v = offlinePrepare ((VstOfflineTask*)ptr, value);
break;
case effOfflineRun:
v = offlineRun ((VstOfflineTask*)ptr, value);
break;
// other
case effSetSpeakerArrangement:
v = setSpeakerArrangement ((VstSpeakerArrangement*)value, (VstSpeakerArrangement*)ptr) ? 1 : 0;
break;
case effProcessVarIo:
v = processVariableIo ((VstVariableIo*)ptr) ? 1 : 0;
break;
case effSetBlockSizeAndSampleRate:
setBlockSizeAndSampleRate (value, opt);
v = 1;
break;
case effSetBypass:
v = setBypass (value ? true : false) ? 1 : 0;
break;
case effGetEffectName:
v = getEffectName ((char *)ptr) ? 1 : 0;
break;
case effGetErrorText:
v = getErrorText ((char *)ptr) ? 1 : 0;
break;
case effGetVendorString:
v = getVendorString ((char *)ptr) ? 1 : 0;
break;
case effGetProductString:
v = getProductString ((char *)ptr) ? 1 : 0;
break;
case effGetVendorVersion:
v = getVendorVersion ();
break;
case effVendorSpecific:
v = vendorSpecific (index, value, ptr, opt);
break;
case effCanDo:
v = canDo ((char*)ptr);
break;
case effGetIcon:
v = (long)getIcon ();
break;
case effSetViewPosition:
v = setViewPosition (index, value) ? 1 : 0;
break;
case effGetTailSize:
v = getGetTailSize ();
break;
case effIdle:
v = fxIdle ();
break;
case effGetParameterProperties:
v = getParameterProperties (index, (VstParameterProperties*)ptr) ? 1 : 0;
break;
case effKeysRequired:
v = (keysRequired () ? 0 : 1); // reversed to keep v1 compatibility
break;
case effGetVstVersion:
v = getVstVersion ();
break;
#if VST_2_1_EXTENSIONS
case effEditKeyDown:
if (editor)
{
VstKeyCode keyCode = {index, (unsigned char)value, (unsigned char)opt};
v = editor->onKeyDown (keyCode);
}
break;
case effEditKeyUp:
if (editor)
{
VstKeyCode keyCode = {index, (unsigned char)value, (unsigned char)opt};
v = editor->onKeyUp (keyCode);
}
break;
case effSetEditKnobMode:
if (editor)
v = editor->setKnobMode (value);
break;
case effGetMidiProgramName:
v = getMidiProgramName (index, (MidiProgramName*)ptr);
break;
case effGetCurrentMidiProgram:
v = getCurrentMidiProgram (index, (MidiProgramName*)ptr);
break;
case effGetMidiProgramCategory:
v = getMidiProgramCategory (index, (MidiProgramCategory*)ptr);
break;
case effHasMidiProgramsChanged:
v = hasMidiProgramsChanged (index) ? 1 : 0;
break;
case effGetMidiKeyName:
v = getMidiKeyName (index, (MidiKeyName*)ptr) ? 1 : 0;
break;
case effBeginSetProgram:
v = beginSetProgram () ? 1 : 0;
break;
case effEndSetProgram:
v = endSetProgram () ? 1 : 0;
break;
#endif // VST_2_1_EXTENSIONS
#if VST_2_3_EXTENSIONS
case effGetSpeakerArrangement:
v = getSpeakerArrangement ((VstSpeakerArrangement**)value, (VstSpeakerArrangement**)ptr) ? 1 : 0;
break;
case effSetTotalSampleToProcess:
v = setTotalSampleToProcess (value);
break;
case effShellGetNextPlugin:
v = getNextShellPlugin ((char*)ptr);
break;
case effStartProcess:
v = startProcess ();
break;
case effStopProcess:
v = stopProcess ();
break;
case effSetPanLaw:
v = setPanLaw (value, opt) ? 1 : 0;
break;
case effBeginLoadBank:
v = beginLoadBank ((VstPatchChunkInfo*)ptr);
break;
case effBeginLoadProgram:
v = beginLoadProgram ((VstPatchChunkInfo*)ptr);
break;
#endif // VST_2_3_EXTENSIONS
// version 1.0 or unknown
default:
v = AudioEffect::dispatcher (opCode, index, value, ptr, opt);
}
return v;
}
//-------------------------------------------------------------------------------------------------------
void AudioEffectX::wantEvents (long filter)
{
if (audioMaster)
audioMaster (&cEffect, audioMasterWantMidi, 0, filter, 0, 0);
}
//-------------------------------------------------------------------------------------------------------
VstTimeInfo* AudioEffectX::getTimeInfo (long filter)
{
if (audioMaster)
return (VstTimeInfo*) audioMaster (&cEffect, audioMasterGetTime, 0, filter, 0, 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::tempoAt (long pos)
{
if (audioMaster)
return audioMaster (&cEffect, audioMasterTempoAt, 0, pos, 0, 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::sendVstEventsToHost (VstEvents* events)
{
if (audioMaster)
return audioMaster (&cEffect, audioMasterProcessEvents, 0, 0, events, 0) == 1;
return 0;
}
//-------------------------------------------------------------------------------------------------------
// Parameters
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::getNumAutomatableParameters ()
{
if (audioMaster)
return audioMaster (&cEffect, audioMasterGetNumAutomatableParameters, 0, 0, 0, 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::getParameterQuantization ()
{
if (audioMaster)
return audioMaster (&cEffect, audioMasterGetParameterQuantization, 0, 0, 0, 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
// Configuration
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::ioChanged ()
{
if (audioMaster)
return (audioMaster (&cEffect, audioMasterIOChanged, 0, 0, 0, 0) != 0);
return false;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::needIdle ()
{
if (audioMaster)
return (audioMaster (&cEffect, audioMasterNeedIdle, 0, 0, 0, 0) != 0);
return false;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::sizeWindow (long width, long height)
{
if (audioMaster)
return (audioMaster (&cEffect, audioMasterSizeWindow, width, height, 0, 0) != 0);
return false;
}
//-------------------------------------------------------------------------------------------------------
double AudioEffectX::updateSampleRate ()
{
if (audioMaster)
{
long res = audioMaster (&cEffect, audioMasterGetSampleRate, 0, 0, 0, 0);
if (res > 0)
sampleRate = (float)res;
}
return sampleRate;
}
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::updateBlockSize ()
{
if (audioMaster)
{
long res = audioMaster (&cEffect, audioMasterGetBlockSize, 0, 0, 0, 0);
if (res > 0)
blockSize = res;
}
return blockSize;
}
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::getInputLatency ()
{
if (audioMaster)
return audioMaster (&cEffect, audioMasterGetInputLatency, 0, 0, 0, 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::getOutputLatency ()
{
if (audioMaster)
return audioMaster (&cEffect, audioMasterGetOutputLatency, 0, 0, 0, 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
AEffect* AudioEffectX::getPreviousPlug (long input)
{
if (audioMaster)
return (AEffect*) audioMaster (&cEffect, audioMasterGetPreviousPlug, 0, 0, 0, 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
AEffect* AudioEffectX::getNextPlug (long output)
{
if (audioMaster)
return (AEffect*) audioMaster (&cEffect, audioMasterGetNextPlug, 0, 0, 0, 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
// Configuration
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::willProcessReplacing ()
{
if (audioMaster)
return audioMaster (&cEffect, audioMasterWillReplaceOrAccumulate, 0, 0, 0, 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::getCurrentProcessLevel ()
{
if (audioMaster)
return audioMaster (&cEffect, audioMasterGetCurrentProcessLevel, 0, 0, 0, 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::getAutomationState ()
{
if (audioMaster)
return audioMaster (&cEffect, audioMasterGetAutomationState, 0, 0, 0, 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
void AudioEffectX::wantAsyncOperation (bool state)
{
if (state)
cEffect.flags |= effFlagsExtIsAsync;
else
cEffect.flags &= ~effFlagsExtIsAsync;
}
//-------------------------------------------------------------------------------------------------------
void AudioEffectX::hasExternalBuffer (bool state)
{
if (state)
cEffect.flags |= effFlagsExtHasBuffer;
else
cEffect.flags &= ~effFlagsExtHasBuffer;
}
//-------------------------------------------------------------------------------------------------------
// Offline
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::offlineRead (VstOfflineTask* offline, VstOfflineOption option, bool readSource)
{
if (audioMaster)
return (audioMaster (&cEffect, audioMasterOfflineRead, readSource, option, offline, 0) != 0);
return false;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::offlineWrite (VstOfflineTask* offline, VstOfflineOption option)
{
if (audioMaster)
return (audioMaster (&cEffect, audioMasterOfflineWrite, 0, option, offline, 0) != 0);
return false;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::offlineStart (VstAudioFile* audioFiles, long numAudioFiles, long numNewAudioFiles)
{
if (audioMaster)
return (audioMaster (&cEffect, audioMasterOfflineStart, numNewAudioFiles, numAudioFiles, audioFiles, 0) != 0);
return false;
}
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::offlineGetCurrentPass ()
{
if (audioMaster)
return (audioMaster (&cEffect, audioMasterOfflineGetCurrentPass, 0, 0, 0, 0) != 0);
return false;
}
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::offlineGetCurrentMetaPass ()
{
if (audioMaster)
return (audioMaster (&cEffect, audioMasterOfflineGetCurrentMetaPass, 0, 0, 0, 0) != 0);
return false;
}
//-------------------------------------------------------------------------------------------------------
// Other
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
void AudioEffectX::setOutputSamplerate (float sampleRate)
{
if (audioMaster)
audioMaster (&cEffect, audioMasterSetOutputSampleRate, 0, 0, 0, sampleRate);
}
//-------------------------------------------------------------------------------------------------------
VstSpeakerArrangement* AudioEffectX::getInputSpeakerArrangement ()
{
if (audioMaster)
return (VstSpeakerArrangement*)audioMaster (&cEffect, audioMasterGetInputSpeakerArrangement, 0, 0, 0, 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
VstSpeakerArrangement* AudioEffectX::getOutputSpeakerArrangement ()
{
if (audioMaster)
return (VstSpeakerArrangement*)audioMaster (&cEffect, audioMasterGetOutputSpeakerArrangement, 0, 0, 0, 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::getHostVendorString (char* text)
{
if (audioMaster)
return (audioMaster (&cEffect, audioMasterGetVendorString, 0, 0, text, 0) != 0);
return false;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::getHostProductString (char* text)
{
if (audioMaster)
return (audioMaster (&cEffect, audioMasterGetProductString, 0, 0, text, 0) != 0);
return false;
}
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::getHostVendorVersion ()
{
if (audioMaster)
return audioMaster (&cEffect, audioMasterGetVendorVersion, 0, 0, 0, 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::hostVendorSpecific (long lArg1, long lArg2, void* ptrArg, float floatArg)
{
if (audioMaster)
return audioMaster (&cEffect, audioMasterVendorSpecific, lArg1, lArg2, ptrArg, floatArg);
return 0;
}
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::canHostDo (char* text)
{
if (audioMaster)
return (audioMaster (&cEffect, audioMasterCanDo, 0, 0, text, 0) != 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
void AudioEffectX::isSynth (bool state)
{
if (state)
cEffect.flags |= effFlagsIsSynth;
else
cEffect.flags &= ~effFlagsIsSynth;
}
//-------------------------------------------------------------------------------------------------------
void AudioEffectX::noTail (bool state)
{
if (state)
cEffect.flags |= effFlagsNoSoundInStop;
else
cEffect.flags &= ~effFlagsNoSoundInStop;
}
//-------------------------------------------------------------------------------------------------------
long AudioEffectX::getHostLanguage ()
{
if (audioMaster)
return audioMaster (&cEffect, audioMasterGetLanguage, 0, 0, 0, 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
void* AudioEffectX::openWindow (VstWindow* window)
{
if (audioMaster)
return (void*)audioMaster (&cEffect, audioMasterOpenWindow, 0, 0, window, 0);
return 0;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::closeWindow (VstWindow* window)
{
if (audioMaster)
return (audioMaster (&cEffect, audioMasterCloseWindow, 0, 0, window, 0) != 0);
return false;
}
//-------------------------------------------------------------------------------------------------------
void* AudioEffectX::getDirectory ()
{
if (audioMaster)
return (void*)(audioMaster (&cEffect, audioMasterGetDirectory, 0, 0, 0, 0));
return 0;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::updateDisplay ()
{
if (audioMaster)
return (audioMaster (&cEffect, audioMasterUpdateDisplay, 0, 0, 0, 0)) ? true : false;
return 0;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::beginEdit (long index)
{
if (audioMaster)
return (audioMaster (&cEffect, audioMasterBeginEdit, index, 0, 0, 0)) ? true : false;
return 0;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::endEdit (long index)
{
if (audioMaster)
return (audioMaster (&cEffect, audioMasterEndEdit, index, 0, 0, 0)) ? true : false;
return 0;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::openFileSelector (VstFileSelect* ptr)
{
if (audioMaster && ptr)
return (audioMaster (&cEffect, audioMasterOpenFileSelector, 0, 0, ptr, 0)) ? true : false;
return 0;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::closeFileSelector (VstFileSelect* ptr)
{
if (audioMaster && ptr)
return (audioMaster (&cEffect, audioMasterCloseFileSelector, 0, 0, ptr, 0)) ? true : false;
return 0;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::getChunkFile (void* nativePath)
{
if (audioMaster && nativePath)
return (audioMaster (&cEffect, audioMasterGetChunkFile, 0, 0, nativePath, 0)) ? true : false;
return 0;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::allocateArrangement (VstSpeakerArrangement** arrangement, long nbChannels)
{
if (*arrangement)
{
char *ptr = (char*)(*arrangement);
delete []ptr;
}
long size = sizeof (long) + sizeof (long) + (nbChannels) * sizeof (VstSpeakerProperties);
char *ptr = new char [size];
if (!ptr)
return false;
memset (ptr, 0, size);
*arrangement = (VstSpeakerArrangement*)ptr;
(*arrangement)->numChannels = nbChannels;
return true;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::deallocateArrangement (VstSpeakerArrangement** arrangement)
{
if (*arrangement)
{
char *ptr = (char*)(*arrangement);
delete []ptr;
*arrangement = 0;
}
return true;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::copySpeaker (VstSpeakerProperties* to, VstSpeakerProperties* from)
{
// We assume here that "to" exists yet, ie this function won't
// allocate memory for the speaker (this will prevent from having
// a difference between an Arrangement's number of channels and
// its actual speakers...)
if ((from == NULL) || (to == NULL))
return false;
strcpy (to->name, from->name);
to->type = from->type;
to->azimuth = from->azimuth;
to->elevation = from->elevation;
to->radius = from->radius;
to->reserved = from->reserved;
memcpy (to->future, from->future, 28);
return true;
}
//-------------------------------------------------------------------------------------------------------
bool AudioEffectX::matchArrangement (VstSpeakerArrangement** to, VstSpeakerArrangement* from)
{
if (from == NULL)
return false;
if ((!deallocateArrangement (to)) || (!allocateArrangement (to, from->numChannels)))
return false;
(*to)->type = from->type;
for (int i = 0; i < (*to)->numChannels; i++)
{
if (!copySpeaker (&((*to)->speakers[i]), &(from->speakers[i])))
return false;
}
return true;
}
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------

295
vst/AudioEffectX.hpp Normal file
View File

@@ -0,0 +1,295 @@
//-------------------------------------------------------------------------------------------------------
// VST Plug-Ins SDK
// Version 2.3 Extension
// <20> 2003, Steinberg Media Technologies, All Rights Reserved
//-------------------------------------------------------------------------------------------------------
#ifndef __audioeffectx__
#define __audioeffectx__
#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
#define VST_2_1_EXTENSIONS 1 // Version 2.1 extensions
#define VST_2_2_EXTENSIONS 1 // Version 2.2 extensions
#define VST_2_3_EXTENSIONS 1 // Version 2.3 extensions
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
// AudioEffectX extends AudioEffect with new features. So you should derive
// your Plugin from AudioEffectX
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
class AudioEffectX : public AudioEffect
{
public:
// Constructor
AudioEffectX (AudioMasterCallback audioMaster, long numPrograms, long numParams);
// Destructor
virtual ~AudioEffectX ();
// Dispatcher
virtual long dispatcher (long opCode, long index, long value, void *ptr, float opt);
virtual AEffEditor* getEditor () { return editor; } // Returns the attached editor
// 'Plug -> Host' are methods which go from Plugin to Host, and are usually not overridden
// 'Host -> Plug' are methods which you may override to implement the according functionality (to Host)
//-------------------------------------------------------------------------------------------------------
// Events + Time
//-------------------------------------------------------------------------------------------------------
// Plug -> 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); // Returns true when success
// Host -> Plug
virtual long processEvents (VstEvents* events) { return 0; }// 0 means 'wants no more'...else returns 1!
// VstEvents and VstMidiEvents are declared in aeffectx.h
//-------------------------------------------------------------------------------------------------------
// Parameters and Programs
//-------------------------------------------------------------------------------------------------------
// Plug -> Host
virtual long getNumAutomatableParameters (); // Returns the number of automatable Parameters (should be <= than numParams)
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)
// Host -> 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.f; }
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
//-------------------------------------------------------------------------------------------------------
// Plug -> Host
virtual bool ioChanged (); // Tell Host numInputs and/or numOutputs and/or initialDelay and/or numParameters has changed
virtual bool needIdle (); // Plugin needs idle calls (outside its editor window), will call fxIdle ()
virtual bool sizeWindow (long width, long height);
virtual double updateSampleRate (); // Returns sample rate from Host (may issue setSampleRate() )
virtual long updateBlockSize (); // Same for block size
virtual long getInputLatency (); // Returns input Latency
virtual long getOutputLatency (); // Returns output Latency
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
// Host -> 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; } // See aeffects.h for Category
//-------------------------------------------------------------------------------------------------------
// Realtime
//-------------------------------------------------------------------------------------------------------
// Plug -> 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 immediately; Host will poll getCurrentPosition
// to see if data are available in time.
virtual void hasExternalBuffer (bool state = true); // For external DSP, may have their own output buffer (32 bit float)
// Host then requests this via effGetDestinationBuffer
// Host -> Plug
virtual long reportCurrentPosition () { return 0; } // For external DSP, see wantAsyncOperation ()
virtual float* reportDestinationBuffer () { return 0; } // For external DSP (dma option)
//-------------------------------------------------------------------------------------------------------
// Offline
//-------------------------------------------------------------------------------------------------------
// Plug -> 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 ();
// Host -> 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
//-------------------------------------------------------------------------------------------------------
// Plug -> Host
virtual void setOutputSamplerate (float samplerate);
virtual VstSpeakerArrangement* getInputSpeakerArrangement ();
virtual VstSpeakerArrangement* getOutputSpeakerArrangement ();
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 specific 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 (see aeffectx.h)
virtual void* openWindow (VstWindow*); // Create new window
virtual bool closeWindow (VstWindow*); // Close a newly created window
virtual void* getDirectory (); // Get the Plugin's directory, FSSpec on MAC, else char*
virtual bool updateDisplay (); // Something has changed, update display like program list, parameter list
// returns true if supported
// Host -> Plug
virtual bool processVariableIo (VstVariableIo* varIo) { return false; } // If called with varIo == NULL, returning true indicates that this call is supported by the Plugin
virtual bool setSpeakerArrangement (VstSpeakerArrangement* pluginInput, VstSpeakerArrangement* pluginOutput) { return false; }
virtual bool getSpeakerArrangement (VstSpeakerArrangement** pluginInput, VstSpeakerArrangement** pluginOutput) { *pluginInput = 0; *pluginOutput = 0; 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; } // Text 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
// returns 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; } // Called when NeedIdle () was called
virtual bool getParameterProperties (long index, VstParameterProperties* p) { return false; }
virtual bool keysRequired () { return false; } // Version 1 Plugins will return true
#if VST_2_3_EXTENSIONS
virtual long getVstVersion () { return 2300; } // Returns the current VST Version
#elif VST_2_2_EXTENSIONS
virtual long getVstVersion () { return 2200; }
#elif VST_2_1_EXTENSIONS
virtual long getVstVersion () { return 2100; }
#else
virtual long getVstVersion () { return 2; }
#endif
//---------------------------------------------------------
#if VST_2_1_EXTENSIONS
//-------------------------------------------------------------------------------------------------------
// Midi Program Names, are always defined per channel, valid channels are 0 - 15
//-------------------------------------------------------------------------------------------------------
// Host -> Plug
virtual long getMidiProgramName (long channel, MidiProgramName* midiProgramName) { return 0; }
// Struct will be filled with information for 'thisProgramIndex'.
// returns number of used programIndexes.
// If 0 is returned, no MidiProgramNames supported.
virtual long getCurrentMidiProgram (long channel, MidiProgramName* currentProgram) { return -1; }
// Struct will be filled with information for the current program.
// Returns the programIndex of the current program. -1 means not supported.
virtual long getMidiProgramCategory (long channel, MidiProgramCategory* category) { return 0; }
// Struct will be filled with information for 'thisCategoryIndex'.
// returns number of used categoryIndexes.
// if 0 is returned, no MidiProgramCategories supported/used.
virtual bool hasMidiProgramsChanged (long channel) { return false; }
// Returns true if the MidiProgramNames, MidiKeyNames or
// MidiControllerNames had changed on this channel.
virtual bool getMidiKeyName (long channel, MidiKeyName* keyName) { return false; }
// Struct will be filled with information for 'thisProgramIndex' and 'thisKeyNumber'
// if keyName is "" the standard name of the key will be displayed.
// if false is returned, no MidiKeyNames defined for 'thisProgramIndex'.
virtual bool beginSetProgram () { return false; } // Called before a program is loaded
virtual bool endSetProgram () { return false; } // Called after...
// Plug -> Host
virtual bool beginEdit (long index); // To be called before a setParameterAutomated with mouse move (one per Mouse Down)
virtual bool endEdit (long index); // To be called after a setParameterAutomated (on Mouse Up)
virtual bool openFileSelector (VstFileSelect *ptr); // Open a Host File selector (see aeffectx.h for VstFileSelect definition)
#endif // VST_2_1_EXTENSIONS
//---------------------------------------------------------
#if VST_2_2_EXTENSIONS
bool closeFileSelector (VstFileSelect *ptr); // Close the Host File selector which was opened by openFileSelector
bool getChunkFile (void* nativePath); // Returns in platform format the path of the current chunk (could be called in setChunk ()) (FSSpec on MAC else char*)
#endif // VST_2_2_EXTENSIONS
//---------------------------------------------------------
#if VST_2_3_EXTENSIONS
// Host -> Plug
virtual long setTotalSampleToProcess (long value) { return value; } // Called in offline (non RealTime) Process before process is called, indicates how many sample will be processed
virtual long getNextShellPlugin (char* name) { return 0; }
// Tthis opcode is only called, if Plugin is of type kPlugCategShell.
// should return the next plugin's uniqueID.
// name points to a char buffer of size 64, which is to be filled
// with the name of the plugin including the terminating zero.
virtual long startProcess () { return 0; } // Called one time before the start of process call
virtual long stopProcess () { return 0; } // Called after the stop of process call
virtual bool setPanLaw (long type, float val) { return false; } // Set the Panning Law used by the Host
virtual long beginLoadBank (VstPatchChunkInfo* ptr) { return 0; }
// Called before a Bank is loaded.
// returns -1 if the Bank cannot be loaded, returns 1 if it can be loaded else 0 (for compatibility)
virtual long beginLoadProgram (VstPatchChunkInfo* ptr) { return 0; }
// Called before a Program is loaded. (called before beginSetProgram)
// returns -1 if the Program cannot be loaded, returns 1 if it can be loaded else 0 (for compatibility)
// Tools
virtual bool allocateArrangement (VstSpeakerArrangement** arrangement, long nbChannels);
// Allocate memory for a VstSpeakerArrangement containing the given
// number of channels
virtual bool deallocateArrangement (VstSpeakerArrangement** arrangement);
// Delete/free memory for a speaker arrangement
virtual bool copySpeaker (VstSpeakerProperties* to, VstSpeakerProperties* from);
// Feed the "to" speaker properties with the same values than "from"'s ones.
// It is assumed here that "to" exists yet, ie this function won't
// allocate memory for the speaker (this will prevent from having
// a difference between an Arrangement's number of channels and
// its actual speakers...)
virtual bool matchArrangement (VstSpeakerArrangement** to, VstSpeakerArrangement* from);
// "to" is deleted, then created and initialized with the same values as "from" ones ("from" must exist).
#endif // VST_2_3_EXTENSIONS
};
#endif //__audioeffectx__
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------

BIN
vst/Debug/AudioEffect.obj Normal file

Binary file not shown.

BIN
vst/Debug/AudioEffectX.obj Normal file

Binary file not shown.

BIN
vst/Debug/Gain.dll Normal file

Binary file not shown.

BIN
vst/Debug/Gain.exp Normal file

Binary file not shown.

BIN
vst/Debug/Gain.ilk Normal file

Binary file not shown.

BIN
vst/Debug/Gain.lib Normal file

Binary file not shown.

BIN
vst/Debug/Gain.obj Normal file

Binary file not shown.

BIN
vst/Debug/Gain.pch Normal file

Binary file not shown.

BIN
vst/Debug/Gain.pdb Normal file

Binary file not shown.

BIN
vst/Debug/GainEdit.dll Normal file

Binary file not shown.

BIN
vst/Debug/GainEdit.exp Normal file

Binary file not shown.

BIN
vst/Debug/GainEdit.ilk Normal file

Binary file not shown.

BIN
vst/Debug/GainEdit.lib Normal file

Binary file not shown.

BIN
vst/Debug/GainEdit.obj Normal file

Binary file not shown.

BIN
vst/Debug/GainEdit.pch Normal file

Binary file not shown.

BIN
vst/Debug/GainEdit.pdb Normal file

Binary file not shown.

Binary file not shown.

BIN
vst/Debug/gain.res Normal file

Binary file not shown.

Binary file not shown.

BIN
vst/Debug/gain_main.obj Normal file

Binary file not shown.

BIN
vst/Debug/vc60.idb Normal file

Binary file not shown.

BIN
vst/Debug/vc60.pdb Normal file

Binary file not shown.

94
vst/Gain.cpp Normal file
View File

@@ -0,0 +1,94 @@
#include <common/StringBuffer.hpp>
#include <vst/Gain.hpp>
Gain::Gain(AudioMasterCallback audioMaster)
: AudioEffectX(audioMaster,NumPrograms,NumParams)
{
mNameValuePairs[GainControl].setNameValue("Gain","db",1);
setNumInputs(2);
setNumOutputs(2);
setUniqueID('Gain');
canMono();
canProcessReplacing();
::strcpy(mProgramName,"Default");
}
Gain::~Gain()
{
}
void Gain::setProgramName(char *name)
{
::strcpy(mProgramName,name);
}
void Gain::getProgramName(char *name)
{
::strcpy(name,mProgramName);
}
void Gain::setParameter(long index,float value)
{
mNameValuePairs[index].setValue(value);
}
float Gain::getParameter(long index)
{
return mNameValuePairs[index].getValue();
}
void Gain::getParameterName(long index,char *label)
{
::strcpy(label,mNameValuePairs[index].getName().str());
}
void Gain::getParameterDisplay(long index,char *text)
{
float2string(mNameValuePairs[index].getValue(),text);
}
void Gain::getParameterLabel(long index,char *label)
{
::strcpy(label,mNameValuePairs[index].getLabel());
}
void Gain::process(float **inputs,float **outputs,long sampleFrames)
{
applyGain(inputs,outputs,sampleFrames);
}
void Gain::processReplacing(float **inputs,float **outputs,long sampleFrames)
{
applyGain(inputs,outputs,sampleFrames);
}
void Gain::applyGain(float **inputs,float **outputs,long sampleFrames)
{
float gain=mNameValuePairs[GainControl].getValue();
float *in1 = inputs[0];
float *in2 = inputs[1];
float *out1 = outputs[0];
float *out2 = outputs[1];
while(--sampleFrames >= 0)
{
(*out1++) += (*in1++) * gain; // accumulating
(*out2++) += (*in2++) * gain;
}
}
void Gain::createDisplay(float value,char *text)
{
StringBuffer stringBuffer;
String strRep;
if(value<0)value=0;
int count=(int)(value*20.00);
if(count<0)count=0;
for(int index=0;index<count;index++)stringBuffer.append("|");
strRep=stringBuffer.toString();
if(strRep.isNull()||!strRep.length())strRep=" ";
strcpy(text,stringBuffer.toString().str());
}

2
vst/Gain.def Normal file
View File

@@ -0,0 +1,2 @@
EXPORTS main=_main

121
vst/Gain.dsp Normal file
View File

@@ -0,0 +1,121 @@
# Microsoft Developer Studio Project File - Name="Gain" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=Gain - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Gain.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Gain.mak" CFG="Gain - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Gain - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "Gain - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "Gain - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAIN_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAIN_EXPORTS" /D "STRICT" /D "__FLAT__" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
!ELSEIF "$(CFG)" == "Gain - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAIN_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAIN_EXPORTS" /D "__FLAT__" /D "STRICT" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "Gain - Win32 Release"
# Name "Gain - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\AudioEffect.cpp
# End Source File
# Begin Source File
SOURCE=.\AudioEffectX.cpp
# End Source File
# Begin Source File
SOURCE=.\Gain.cpp
# End Source File
# Begin Source File
SOURCE=.\gain_main.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\Gain.hpp
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

44
vst/Gain.dsw Normal file
View File

@@ -0,0 +1,44 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Gain"=.\Gain.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name common
End Project Dependency
}}}
###############################################################################
Project: "common"=..\common\common.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

34
vst/Gain.hpp Normal file
View File

@@ -0,0 +1,34 @@
#ifndef _VST_GAIN_HPP_
#define _VST_GAIN_HPP_
#ifndef __AudioEffect__
#include <vst/AudioEffectX.hpp>
#endif
#ifndef _VST_NAMEVALUE_HPP_
#include <vst/NameValuePair.hpp>
#endif
class Gain : public AudioEffectX
{
public:
Gain(AudioMasterCallback audioMaster);
~Gain();
protected:
virtual void setProgramName(char *name);
virtual void getProgramName(char *name);
virtual void setParameter(long index,float value);
virtual float getParameter(long index);
virtual void getParameterName(long index,char *label);
virtual void getParameterDisplay(long index,char *text);
virtual void getParameterLabel(long index,char *label);
virtual void process(float **inputs,float **outputs,long sampleFrames);
virtual void processReplacing(float **inputs,float **outputs,long sampleFrames);
private:
enum {NumPrograms=1,NumParams=1};
enum {GainControl=0};
void createDisplay(float value,char *text);
void applyGain(float **inputs,float **outputs,long sampleFrames);
NameValuePair mNameValuePairs[NumParams];
char mProgramName[10];
};
#endif

BIN
vst/Gain.ncb Normal file

Binary file not shown.

BIN
vst/Gain.opt Normal file

Binary file not shown.

44
vst/Gain.plg Normal file
View File

@@ -0,0 +1,44 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: Gain - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\sean\LOCALS~1\Temp\RSP35F.tmp" with contents
[
/nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAIN_EXPORTS" /D "__FLAT__" /D "STRICT" /Fp"Debug/Gain.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
"E:\work\vst\AudioEffect.cpp"
"E:\work\vst\AudioEffectX.cpp"
"E:\work\vst\Gain.cpp"
"E:\work\vst\gain_main.cpp"
]
Creating command line "cl.exe @C:\DOCUME~1\sean\LOCALS~1\Temp\RSP35F.tmp"
Creating temporary file "C:\DOCUME~1\sean\LOCALS~1\Temp\RSP360.tmp" with contents
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"Debug/Gain.pdb" /debug /machine:I386 /out:"Debug/Gain.dll" /implib:"Debug/Gain.lib" /pdbtype:sept
.\Debug\AudioEffect.obj
.\Debug\AudioEffectX.obj
.\Debug\Gain.obj
.\Debug\gain_main.obj
\work\exe\mscommon.lib
]
Creating command line "link.exe @C:\DOCUME~1\sean\LOCALS~1\Temp\RSP360.tmp"
<h3>Output Window</h3>
Compiling...
AudioEffect.cpp
AudioEffectX.cpp
Gain.cpp
gain_main.cpp
Linking...
LINK : LNK6004: Debug/Gain.dll not found or not built by the last incremental link; performing full link
Creating library Debug/Gain.lib and object Debug/Gain.exp
<h3>Results</h3>
Gain.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

140
vst/GainEdit.cpp Normal file
View File

@@ -0,0 +1,140 @@
#include <common/StringBuffer.hpp>
#include <common/window.hpp>
#include <common/purehdc.hpp>
#include <vst/GainEdit.hpp>
char GainEditor::szClassName[]={"GainControl"};
int GainEditor::smUseCount=0;
GainEditor::GainEditor(AudioEffect *effect)
: AEffEditor(effect), mWheelController(::GetModuleHandle("GainEdit"))
{
mResBitmap=::new ResBitmap("MAIN",::GetModuleHandle("GainEdit"));
mResBitmap.disposition(PointerDisposition::Delete);
mRect.left=0;
mRect.top=0;
mRect.right=mResBitmap->width()-1;
mRect.bottom=mResBitmap->height()-1;
mPaintHandler.setCallback(this,&GainEditor::paintHandler);
mCreateHandler.setCallback(this,&GainEditor::createHandler);
mGainWindow.insertHandler(VectorHandler::PaintHandler,&mPaintHandler);
mGainWindow.insertHandler(VectorHandler::CreateHandler,&mCreateHandler);
effect->setEditor(this);
}
GainEditor::~GainEditor()
{
mGainWindow.removeHandler(VectorHandler::PaintHandler,&mPaintHandler);
mGainWindow.removeHandler(VectorHandler::CreateHandler,&mCreateHandler);
mGainWindow.destroy();
}
long GainEditor::getRect(ERect **eRect)
{
*eRect=&mRect;
return true;
}
long GainEditor::open(void *ptr)
{
smUseCount++;
mpSystemWindow=(HWND)ptr;
registerClass();
createWindow();
return true;
}
void GainEditor::close()
{
mGainWindow.destroy();
smUseCount--;
if(0==smUseCount)::UnregisterClass(szClassName,mGainWindow.processInstance());
}
void GainEditor::idle()
{
AEffEditor::idle();
}
void GainEditor::update(void)
{
//SendMessage (delayFader, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) effect->getParameter (kDelay)
//SendMessage (feedbackFader, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) effect->getParameter(kFeedBack));
//SendMessage (volumeFader, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) effect->getParameter (kOut));
}
void GainEditor::setValue(void* fader, int value)
{
message("setValue");
//if (fader == delayFader)
//effect->setParameterAutomated (kDelay, (float)value / 100.f);
//else if (fader == feedbackFader)
//effect->setParameterAutomated (kFeedBack, (float)value / 100.f);
//else if (fader == volumeFader)
//effect->setParameterAutomated (kOut, (float)value / 100.f);
}
void GainEditor::registerClass()
{
WNDCLASS wndClass;
if(::GetClassInfo(mGainWindow.processInstance(),szClassName,(WNDCLASS FAR*)&wndClass))return;
wndClass.style =CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS|CS_OWNDC;
wndClass.lpfnWndProc =(WNDPROC)GUIWindow::WndProc;
wndClass.cbClsExtra =0;
wndClass.cbWndExtra =sizeof(GainEditor*);
wndClass.hInstance =mGainWindow.processInstance();
wndClass.hIcon =0;
wndClass.hCursor =0;
wndClass.hbrBackground =(HBRUSH)::GetSysColorBrush(COLOR_BTNFACE);
wndClass.lpszMenuName =0;
wndClass.lpszClassName =szClassName;
::RegisterClass(&wndClass);
}
void GainEditor::createWindow()
{
mGainWindow.createWindow(0,szClassName,"Window",WS_CHILD|WS_VISIBLE,Rect(0,0,mResBitmap->width(),mResBitmap->height()),mpSystemWindow,0,mGainWindow.processInstance(),&mGainWindow);
mGainWindow.show(SW_SHOW);
mGainWindow.update();
}
CallbackData::ReturnType GainEditor::createHandler(CallbackData &someCallbackData)
{
PureDevice pureDevice(mGainWindow);
mDIBitmap=::new DIB24();
mDIBitmap.disposition(PointerDisposition::Delete);
mDIBitmap->create(mResBitmap->width(),mResBitmap->height(),pureDevice);
mDIBitmap->copyBits(*mResBitmap);
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType GainEditor::paintHandler(CallbackData &someCallbackData)
{
PureDevice pureDevice(mGainWindow);
// mResBitmap->getPalette().usePalette(pureDevice,true);
mDIBitmap->bitBlt(pureDevice,Rect(0,0,mGainWindow.width(),mGainWindow.height()),Point());
mWheelController.drawImage(pureDevice,Point(0,0),0);
// mResBitmap->getPalette().usePalette(pureDevice,false);
return (CallbackData::ReturnType)FALSE;
}
void GainEditor::message(String message)
{
::MessageBox(0,"GainEditor",message.str(),MB_OK);
}
// ******************************************************************************************************************
GainEdit::GainEdit(AudioMasterCallback audioMaster)
: Gain(audioMaster)
{
setUniqueID('GNed');
editor=new GainEditor(this);
// if(!editor)oome=true;
}
GainEdit::~GainEdit()
{
}

130
vst/GainEdit.dsp Normal file
View File

@@ -0,0 +1,130 @@
# Microsoft Developer Studio Project File - Name="GainEdit" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=GainEdit - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "GainEdit.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "GainEdit.mak" CFG="GainEdit - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "GainEdit - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "GainEdit - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "GainEdit - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "GainEdit___Win32_Release"
# PROP BASE Intermediate_Dir "GainEdit___Win32_Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "GainEdit___Win32_Release"
# PROP Intermediate_Dir "GainEdit___Win32_Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAINEDIT_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAINEDIT_EXPORTS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
!ELSEIF "$(CFG)" == "GainEdit - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "GainEdit___Win32_Debug"
# PROP BASE Intermediate_Dir "GainEdit___Win32_Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAINEDIT_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAINEDIT_EXPORTS" /D "STRICT" /D "__FLAT__" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "GainEdit - Win32 Release"
# Name "GainEdit - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\AudioEffect.cpp
# End Source File
# Begin Source File
SOURCE=.\AudioEffectX.cpp
# End Source File
# Begin Source File
SOURCE=.\Gain.cpp
# End Source File
# Begin Source File
SOURCE=.\gain.rc
# End Source File
# Begin Source File
SOURCE=.\gain_edit_main.cpp
# End Source File
# Begin Source File
SOURCE=.\GainEdit.cpp
# End Source File
# Begin Source File
SOURCE=.\WheelController.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

89
vst/GainEdit.dsw Normal file
View File

@@ -0,0 +1,89 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "GainEdit"=.\GainEdit.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name common
End Project Dependency
Begin Project Dependency
Project_Dep_Name bsptree
End Project Dependency
Begin Project Dependency
Project_Dep_Name jpgimg
End Project Dependency
Begin Project Dependency
Project_Dep_Name imagelst
End Project Dependency
}}}
###############################################################################
Project: "bsptree"=..\bsptree\bsptree.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "common"=..\common\common.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "imagelst"=..\imagelst\imagelst.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "jpgimg"=..\jpgimg\jpgimg.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

68
vst/GainEdit.hpp Normal file
View File

@@ -0,0 +1,68 @@
#ifndef _VST_GAINEDIT_HPP_
#define _VST_GAINEDIT_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_WINDOW_HPP_
#include <common/window.hpp>
#endif
#ifndef _JPGIMG_DIB24_HPP_
#include <jpgimg/dib24.hpp>
#endif
#ifndef _COMMON_RESBITMAP_HPP_
#include <common/resbmp.hpp>
#endif
#ifndef _COMMON_SMARTPOINTER_HPP_
#include <common/pointer.hpp>
#endif
#ifndef __AEffEditor__
#include <vst/AEffEditor.hpp>
#endif
#ifndef _VST_GAIN_HPP_
#include <vst/Gain.hpp>
#endif
#ifndef _VST_WHEELCONTROLLER_HPP_
#include <vst/WheelController.hpp>
#endif
class GainEdit : public Gain
{
public:
GainEdit(AudioMasterCallback audioMaster);
virtual ~GainEdit();
private:
};
class GainEditor : public AEffEditor
{
public:
GainEditor(AudioEffect *effect);
virtual ~GainEditor();
protected:
virtual long getRect(ERect **erect);
virtual long open(void *ptr);
virtual void close(void);
virtual void idle(void);
virtual void update(void);
virtual void setValue(void *fader,int value);
private:
enum{GainEditorWidth=320,GainEditorHeight=200};
CallbackData::ReturnType paintHandler(CallbackData &someCallbackData);
CallbackData::ReturnType createHandler(CallbackData &someCallbackData);
void registerClass(void);
void createWindow(void);
void message(String message);
Callback<GainEditor> mPaintHandler;
Callback<GainEditor> mCreateHandler;
SmartPointer<PureDevice> mPureDevice;
SmartPointer<ResBitmap> mResBitmap;
SmartPointer<DIB24> mDIBitmap;
WheelController mWheelController;
HWND mpSystemWindow;
Window mGainWindow;
ERect mRect;
static char szClassName[];
static int smUseCount;
};
#endif

BIN
vst/GainEdit.ncb Normal file

Binary file not shown.

BIN
vst/GainEdit.opt Normal file

Binary file not shown.

48
vst/GainEdit.plg Normal file
View File

@@ -0,0 +1,48 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: GainEdit - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\sean\LOCALS~1\Temp\RSP366.tmp" with contents
[
/nologo /MTd /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAINEDIT_EXPORTS" /D "STRICT" /D "__FLAT__" /Fp"Debug/GainEdit.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
"E:\work\vst\gain_edit_main.cpp"
"E:\work\vst\GainEdit.cpp"
"E:\work\vst\WheelController.cpp"
]
Creating command line "cl.exe @C:\DOCUME~1\sean\LOCALS~1\Temp\RSP366.tmp"
Creating temporary file "C:\DOCUME~1\sean\LOCALS~1\Temp\RSP367.tmp" with contents
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib /nologo /dll /incremental:yes /pdb:"Debug/GainEdit.pdb" /debug /machine:I386 /out:"Debug/GainEdit.dll" /implib:"Debug/GainEdit.lib" /pdbtype:sept
.\Debug\AudioEffect.obj
.\Debug\AudioEffectX.obj
.\Debug\Gain.obj
.\Debug\gain_edit_main.obj
.\Debug\GainEdit.obj
.\Debug\WheelController.obj
.\Debug\gain.res
\work\exe\mscommon.lib
\work\exe\msbsp.lib
\work\exe\jpgimg.lib
\work\exe\imagelst.lib
]
Creating command line "link.exe @C:\DOCUME~1\sean\LOCALS~1\Temp\RSP367.tmp"
<h3>Output Window</h3>
Compiling...
gain_edit_main.cpp
GainEdit.cpp
WheelController.cpp
Linking...
LINK : LNK6004: Debug/GainEdit.dll not found or not built by the last incremental link; performing full link
Creating library Debug/GainEdit.lib and object Debug/GainEdit.exp
<h3>Results</h3>
GainEdit.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

BIN
vst/Grid.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
vst/MenuBack.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

259
vst/MenuBack.pal Normal file
View File

@@ -0,0 +1,259 @@
JASC-PAL
0100
256
13 13 10
24 10 10
16 16 24
16 27 21
33 13 5
28 16 16
27 22 14
33 33 16
8 33 41
16 33 41
24 24 24
24 30 30
24 33 41
33 16 24
33 24 24
33 24 33
41 21 8
37 33 20
41 20 24
41 33 24
54 17 11
57 31 6
49 33 16
57 33 20
33 33 33
33 33 41
41 24 33
41 24 41
41 33 33
41 33 41
49 24 33
60 30 30
24 42 33
20 41 48
41 41 24
33 49 41
16 43 60
24 54 63
41 33 49
33 52 58
49 41 16
49 41 24
41 49 33
49 41 33
43 41 43
43 41 55
41 55 55
41 68 63
60 45 16
57 53 28
57 41 33
62 55 33
49 41 41
61 33 41
61 41 41
53 55 41
66 49 41
49 41 49
53 43 54
66 43 51
57 57 46
57 49 60
54 64 55
66 65 51
28 52 81
45 54 80
49 61 74
49 57 94
35 71 84
32 71 99
49 66 90
41 84 92
61 51 76
63 66 71
56 73 73
60 68 87
59 84 76
51 80 90
49 74 99
62 83 90
40 67 108
49 74 119
57 69 107
49 82 99
33 82 107
41 82 111
51 84 101
49 82 119
66 63 101
66 74 107
66 74 123
66 82 99
57 90 99
57 82 107
66 82 107
61 82 123
33 90 107
41 94 111
49 90 107
49 90 115
49 99 107
49 99 115
49 107 115
57 90 107
66 99 82
61 99 94
66 90 99
66 99 99
57 99 107
57 107 107
66 90 107
66 99 107
57 90 115
57 99 115
47 90 126
57 90 136
41 99 123
47 103 130
49 115 132
57 99 123
66 90 115
66 90 123
66 90 132
57 107 115
57 115 115
66 99 115
57 107 123
57 108 134
83 36 24
87 51 37
74 57 37
98 57 31
74 66 37
74 60 51
84 60 44
108 63 36
78 66 53
82 66 57
78 75 48
82 86 57
91 70 46
90 83 51
101 77 41
123 87 39
80 55 71
79 68 74
77 80 76
87 82 70
81 72 89
79 76 106
78 96 100
78 93 118
102 70 60
97 90 62
98 79 75
96 86 98
111 83 61
109 86 90
118 90 82
136 87 74
70 110 102
70 111 115
84 113 102
80 117 115
66 99 123
66 107 123
66 115 123
86 111 117
66 99 132
74 99 132
74 107 123
86 103 123
66 107 132
66 115 132
66 123 132
82 118 124
115 109 69
112 111 84
103 112 96
119 111 90
101 105 115
102 122 115
118 108 107
115 123 113
131 112 63
148 117 65
127 117 90
151 125 86
127 114 109
142 117 105
131 131 114
159 146 113
69 103 141
74 107 148
82 103 140
78 115 132
66 115 140
70 123 136
74 115 140
71 119 148
90 99 132
82 123 132
82 117 146
82 123 148
97 107 137
97 116 145
90 123 144
104 123 137
78 132 140
86 134 142
79 130 156
90 132 148
99 132 132
103 123 148
99 132 144
94 141 142
90 132 156
90 140 156
99 123 156
95 130 167
88 144 160
99 148 156
93 142 165
97 147 176
115 128 140
113 140 150
107 127 165
119 127 156
116 148 144
115 144 156
107 140 165
119 148 156
111 133 173
120 137 173
111 148 165
107 144 181
107 156 165
112 159 167
111 149 183
112 161 187
135 135 135
134 141 154
132 156 152
133 158 165
132 146 179
130 157 181
131 169 176
131 171 192
154 150 151
155 172 170
179 173 156
191 195 172
165 185 201
179 208 214
216 205 192
217 219 219

BIN
vst/MenuBack2.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
vst/MiddleWheel.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

80
vst/NameValuePair.hpp Normal file
View File

@@ -0,0 +1,80 @@
#ifndef _VST_NAMEVALUE_HPP_
#define _VST_NAMEVALUE_HPP_
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
class NameValuePair
{
public:
NameValuePair();
NameValuePair(const String &name,const String &label,float value);
void setNameValue(const String &name,const String &label,float value);
const String &getName(void)const;
void setName(const String &name);
const String &getLabel(void)const;
void setLabel(const String &label);
float getValue(void)const;
void setValue(float value);
private:
String mName;
String mLabel;
float mValue;
};
inline
NameValuePair::NameValuePair()
: mValue(0)
{
}
inline
NameValuePair::NameValuePair(const String &name,const String &label,float value)
: mName(name), mValue(value), mLabel(label)
{
}
inline
void NameValuePair::setNameValue(const String &name,const String &label,float value)
{
mName=name;
mLabel=label;
mValue=value;
}
inline
const String &NameValuePair::getName(void)const
{
return mName;
}
inline
void NameValuePair::setName(const String &name)
{
mName=name;
}
inline
const String &NameValuePair::getLabel(void)const
{
return mLabel;
}
inline
void NameValuePair::setLabel(const String &label)
{
mLabel=label;
}
inline
float NameValuePair::getValue(void)const
{
return mValue;
}
inline
void NameValuePair::setValue(float value)
{
mValue=value;
}
#endif

BIN
vst/PlugBox.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
vst/PlugBox2.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
vst/Release/Gain.dll Normal file

Binary file not shown.

BIN
vst/Release/Gain.exp Normal file

Binary file not shown.

BIN
vst/Release/Gain.lib Normal file

Binary file not shown.

BIN
vst/Release/vc60.idb Normal file

Binary file not shown.

13
vst/WheelController.cpp Normal file
View File

@@ -0,0 +1,13 @@
#include <vst/WheelController.hpp>
#include <common/string.hpp>
WheelController::WheelController(HINSTANCE hProcessInstance)
//: ImageList(hProcessInstance,"WHEEL",25,RGBColor(223,223,223),1)
: ImageList(hProcessInstance,"MIDDLEWHEEL",25,RGBColor(),1)
{
}
WheelController::~WheelController()
{
}

14
vst/WheelController.hpp Normal file
View File

@@ -0,0 +1,14 @@
#ifndef _VST_WHEELCONTROLLER_HPP_
#define _VST_WHEELCONTROLLER_HPP_
#ifndef _IMAGELIST_IMAGELIST_HPP_
#include <imagelst/imagelst.hpp>
#endif
class WheelController : public ImageList
{
public:
WheelController(HINSTANCE hProcessInstance);
virtual ~WheelController();
private:
};
#endif

BIN
vst/Wheel_25.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

1004
vst/aeffectx.h Normal file

File diff suppressed because it is too large Load Diff

BIN
vst/button.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

BIN
vst/button2.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

49
vst/decay.hpp.saf Normal file
View File

@@ -0,0 +1,49 @@
#ifndef _VST_DECAY_HPP_
#define _VST_DECAY_HPP_
class Decay
{
public:
Decay(int samples,float factor=.0016);
virtual ~Decay();
float operator[](int sample);
private:
void createDecay(void);
int mSamples;
float mSeed;
float *mDecays;
};
inline
Decay::Decay(int samples,float factor)
: mSamples(samples), mSeed(factor), mDecays(0)
{
createDecay();
}
inline
Decay::~Decay()
{
if(!mDecays)return;
::delete[] mDecays;
mDecays=0;
}
inline
float Decay::operator[](int sample)
{
return mDecays[sample];
}
inline
void Decay::createDecay()
{
if(mDecays)::delete[] mDecays;
mDecays=new float[mSamples];
for(int index=0;index<mSamples;index++)
{
if(!index)mDecays[index]=(float)(1.00-mSeed);
else mDecays[index]=(float)((1.00-mSeed)*mDecays[index-1]);
}
}
#endif

File diff suppressed because it is too large Load Diff

BIN
vst/gain.aps Normal file

Binary file not shown.

4
vst/gain.rc Normal file
View File

@@ -0,0 +1,4 @@
PLUGBOX BITMAP MOVEABLE PURE "PLUGBOX.BMP"
MAIN BITMAP MOVEABLE PURE "MENUBACK.BMP"
WHEEL BITMAP MOVEABLE PURE "WHEEL_25.BMP"
MIDDLEWHEEL BITMAP MOVEABLE PURE "MIDDLEWHEEL.BMP"

13
vst/gain_edit_main.cpp Normal file
View File

@@ -0,0 +1,13 @@
#include <vst/AudioEffectX.hpp>
#include <vst/GainEdit.hpp>
__declspec(dllexport) AEffect * main(AudioMasterCallback audioMaster);
AEffect *main(AudioMasterCallback audioMaster)
{
if(!audioMaster(0,audioMasterVersion,0,0,0,0))return 0;
GainEdit *effect;
effect = new GainEdit(audioMaster);
if (!effect)return 0;
return effect->getAeffect();
}

13
vst/gain_main.cpp Normal file
View File

@@ -0,0 +1,13 @@
#include <vst/AudioEffectX.hpp>
#include <vst/Gain.hpp>
__declspec(dllexport) AEffect * main(AudioMasterCallback audioMaster);
AEffect *main(AudioMasterCallback audioMaster)
{
if (!audioMaster (0, audioMasterVersion, 0, 0, 0, 0))return 0;
Gain *effect;
effect = new Gain (audioMaster);
if (!effect)return 0;
return effect->getAeffect();
}

109
vst/vstfxstore.h Normal file
View File

@@ -0,0 +1,109 @@
//-------------------------------------------------------------------------------------------------------
// VST Plug-Ins SDK
// Version 2.3 Extension
// <20> 2003, Steinberg Media Technologies, All Rights Reserved
//
// Different structures for persistent data for VST Plugins:
// - Preset (or Program) without Chunk (->fxPreset)
// - Preset (or Program) with Chunk (->fxChunkPreset)
// - Bank without Chunk (->fxBank)
// - Bank with Chunk (->fxChunkBank)
//-------------------------------------------------------------------------------------------------------
#ifndef __vstfxstore__
#define __vstfxstore__
//---some defines
#define cMagic 'CcnK'
#define presetMagic 'FxCk'
#define bankMagic 'FxBk'
#define chunkPresetMagic 'FPCh'
#define chunkBankMagic 'FBCh'
// for old compatibility (renaming)
#define chunkGlobalMagic 'FxCh' // not used
#define fMagic presetMagic
#define fxProgram fxPreset
#define fxChunkSet fxChunkPreset
#define fxSet fxBank
//--------------------------------------------------------------------
// For Preset (Program) (.fxp) without chunk (magic = 'FxCk')
//--------------------------------------------------------------------
struct fxPreset
{
long chunkMagic; // 'CcnK'
long byteSize; // of this chunk, excl. magic + byteSize
long fxMagic; // 'FxCk'
long version;
long fxID; // FX unique ID
long fxVersion;
long numParams;
char prgName[28];
float params[1]; // variable no. of Parameters
};
//--------------------------------------------------------------------
// For Preset (Program) (.fxp) with chunk (magic = 'FPCh')
//--------------------------------------------------------------------
struct fxChunkPreset
{
long chunkMagic; // 'CcnK'
long byteSize; // of this chunk, excl. magic + byteSize
long fxMagic; // 'FPCh'
long version;
long fxID; // FX unique ID
long fxVersion;
long numPrograms;
char prgName[28];
long chunkSize;
char chunk[8]; // variable
};
//--------------------------------------------------------------------
// For Bank (.fxb) without chunk (magic = 'FxBk')
//--------------------------------------------------------------------
struct fxBank
{
long chunkMagic; // 'CcnK'
long byteSize; // of this chunk, excl. magic + byteSize
long fxMagic; // 'FxBk'
long version;
long fxID; // FX unique ID
long fxVersion;
long numPrograms;
char future[128];
fxPreset programs[1]; // variable no. of Presets (Programs)
};
//--------------------------------------------------------------------
// For Bank (.fxb) with chunk (magic = 'FBCh')
//--------------------------------------------------------------------
struct fxChunkBank
{
long chunkMagic; // 'CcnK'
long byteSize; // of this chunk, excl. magic + byteSize
long fxMagic; // 'FBCh'
long version;
long fxID; // FX unique ID
long fxVersion;
long numPrograms;
char future[128];
long chunkSize;
char chunk[8]; // variable
};
#endif