From 97587996ee9db30ce00190bdcedd8210490b99f5 Mon Sep 17 00:00:00 2001 From: pepper Date: Sat, 31 Jan 2015 21:41:28 -0800 Subject: backup vst 2.4 --- public.sdk/samples/vst2.x/adelay/adelay.cpp | 216 ++++++++++ public.sdk/samples/vst2.x/adelay/adelay.h | 93 +++++ public.sdk/samples/vst2.x/adelay/adelaymain.cpp | 22 + .../vst2.x/adelay/editor/resources/bmp00128.bmp | Bin 0 -> 116154 bytes .../vst2.x/adelay/editor/resources/bmp00129.bmp | Bin 0 -> 2634 bytes .../vst2.x/adelay/editor/resources/bmp00130.bmp | Bin 0 -> 294 bytes .../adelay/editor/resources/surrounddelay.rc | 10 + .../samples/vst2.x/adelay/editor/sdeditor.cpp | 235 +++++++++++ public.sdk/samples/vst2.x/adelay/editor/sdeditor.h | 51 +++ public.sdk/samples/vst2.x/adelay/surrounddelay.cpp | 172 ++++++++ public.sdk/samples/vst2.x/adelay/surrounddelay.h | 54 +++ public.sdk/samples/vst2.x/adelay/win/adelay.vcproj | 400 +++++++++++++++++++ .../samples/vst2.x/adelay/win/surrounddelay.vcproj | 444 +++++++++++++++++++++ 13 files changed, 1697 insertions(+) create mode 100644 public.sdk/samples/vst2.x/adelay/adelay.cpp create mode 100644 public.sdk/samples/vst2.x/adelay/adelay.h create mode 100644 public.sdk/samples/vst2.x/adelay/adelaymain.cpp create mode 100644 public.sdk/samples/vst2.x/adelay/editor/resources/bmp00128.bmp create mode 100644 public.sdk/samples/vst2.x/adelay/editor/resources/bmp00129.bmp create mode 100644 public.sdk/samples/vst2.x/adelay/editor/resources/bmp00130.bmp create mode 100644 public.sdk/samples/vst2.x/adelay/editor/resources/surrounddelay.rc create mode 100644 public.sdk/samples/vst2.x/adelay/editor/sdeditor.cpp create mode 100644 public.sdk/samples/vst2.x/adelay/editor/sdeditor.h create mode 100644 public.sdk/samples/vst2.x/adelay/surrounddelay.cpp create mode 100644 public.sdk/samples/vst2.x/adelay/surrounddelay.h create mode 100644 public.sdk/samples/vst2.x/adelay/win/adelay.vcproj create mode 100644 public.sdk/samples/vst2.x/adelay/win/surrounddelay.vcproj (limited to 'public.sdk/samples/vst2.x/adelay') diff --git a/public.sdk/samples/vst2.x/adelay/adelay.cpp b/public.sdk/samples/vst2.x/adelay/adelay.cpp new file mode 100644 index 0000000..3e16bad --- /dev/null +++ b/public.sdk/samples/vst2.x/adelay/adelay.cpp @@ -0,0 +1,216 @@ +//------------------------------------------------------------------------------------------------------- +// VST Plug-Ins SDK +// Version 2.4 $Date: 2006/11/13 09:08:27 $ +// +// Category : VST 2.x SDK Samples +// Filename : adelay.cpp +// Created by : Steinberg Media Technologies +// Description : Simple Delay plugin (Mono->Stereo) +// +// © 2006, Steinberg Media Technologies, All Rights Reserved +//------------------------------------------------------------------------------------------------------- + +#include +#include + +#ifndef __adelay__ +#include "adelay.h" +#endif + +//----------------------------------------------------------------------------- +ADelayProgram::ADelayProgram () +{ + // default Program Values + fDelay = 0.5; + fFeedBack = 0.5; + fOut = 0.75; + + strcpy (name, "Init"); +} + +//----------------------------------------------------------------------------- +ADelay::ADelay (audioMasterCallback audioMaster) + : AudioEffectX (audioMaster, kNumPrograms, kNumParams) +{ + // init + size = 44100; + cursor = 0; + delay = 0; + buffer = new float[size]; + + programs = new ADelayProgram[numPrograms]; + fDelay = fFeedBack = fOut = 0; + + if (programs) + setProgram (0); + + setNumInputs (1); // mono input + setNumOutputs (2); // stereo output + + setUniqueID ('ADly'); // this should be unique, use the Steinberg web page for plugin Id registration + + resume (); // flush buffer +} + +//------------------------------------------------------------------------ +ADelay::~ADelay () +{ + if (buffer) + delete[] buffer; + if (programs) + delete[] programs; +} + +//------------------------------------------------------------------------ +void ADelay::setProgram (VstInt32 program) +{ + ADelayProgram* ap = &programs[program]; + + curProgram = program; + setParameter (kDelay, ap->fDelay); + setParameter (kFeedBack, ap->fFeedBack); + setParameter (kOut, ap->fOut); +} + +//------------------------------------------------------------------------ +void ADelay::setDelay (float fdelay) +{ + fDelay = fdelay; + programs[curProgram].fDelay = fdelay; + cursor = 0; + delay = (long)(fdelay * (float)(size - 1)); +} + +//------------------------------------------------------------------------ +void ADelay::setProgramName (char *name) +{ + strcpy (programs[curProgram].name, name); +} + +//------------------------------------------------------------------------ +void ADelay::getProgramName (char *name) +{ + if (!strcmp (programs[curProgram].name, "Init")) + sprintf (name, "%s %d", programs[curProgram].name, curProgram + 1); + else + strcpy (name, programs[curProgram].name); +} + +//----------------------------------------------------------------------------------------- +bool ADelay::getProgramNameIndexed (VstInt32 category, VstInt32 index, char* text) +{ + if (index < kNumPrograms) + { + strcpy (text, programs[index].name); + return true; + } + return false; +} + +//------------------------------------------------------------------------ +void ADelay::resume () +{ + memset (buffer, 0, size * sizeof (float)); + AudioEffectX::resume (); +} + +//------------------------------------------------------------------------ +void ADelay::setParameter (VstInt32 index, float value) +{ + ADelayProgram* ap = &programs[curProgram]; + + switch (index) + { + case kDelay : setDelay (value); break; + case kFeedBack : fFeedBack = ap->fFeedBack = value; break; + case kOut : fOut = ap->fOut = value; break; + } +} + +//------------------------------------------------------------------------ +float ADelay::getParameter (VstInt32 index) +{ + float v = 0; + + switch (index) + { + case kDelay : v = fDelay; break; + case kFeedBack : v = fFeedBack; break; + case kOut : v = fOut; break; + } + return v; +} + +//------------------------------------------------------------------------ +void ADelay::getParameterName (VstInt32 index, char *label) +{ + switch (index) + { + case kDelay : strcpy (label, "Delay"); break; + case kFeedBack : strcpy (label, "FeedBack"); break; + case kOut : strcpy (label, "Volume"); break; + } +} + +//------------------------------------------------------------------------ +void ADelay::getParameterDisplay (VstInt32 index, char *text) +{ + switch (index) + { + case kDelay : int2string (delay, text, kVstMaxParamStrLen); break; + case kFeedBack : float2string (fFeedBack, text, kVstMaxParamStrLen); break; + case kOut : dB2string (fOut, text, kVstMaxParamStrLen); break; + } +} + +//------------------------------------------------------------------------ +void ADelay::getParameterLabel (VstInt32 index, char *label) +{ + switch (index) + { + case kDelay : strcpy (label, "samples"); break; + case kFeedBack : strcpy (label, "amount"); break; + case kOut : strcpy (label, "dB"); break; + } +} + +//------------------------------------------------------------------------ +bool ADelay::getEffectName (char* name) +{ + strcpy (name, "Delay"); + return true; +} + +//------------------------------------------------------------------------ +bool ADelay::getProductString (char* text) +{ + strcpy (text, "Delay"); + return true; +} + +//------------------------------------------------------------------------ +bool ADelay::getVendorString (char* text) +{ + strcpy (text, "Steinberg Media Technologies"); + return true; +} + +//--------------------------------------------------------------------------- +void ADelay::processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames) +{ + float* in = inputs[0]; + float* out1 = outputs[0]; + float* out2 = outputs[1]; + + while (--sampleFrames >= 0) + { + float x = *in++; + float y = buffer[cursor]; + buffer[cursor++] = x + y * fFeedBack; + if (cursor >= delay) + cursor = 0; + *out1++ = y; + if (out2) + *out2++ = y; + } +} diff --git a/public.sdk/samples/vst2.x/adelay/adelay.h b/public.sdk/samples/vst2.x/adelay/adelay.h new file mode 100644 index 0000000..1b21c96 --- /dev/null +++ b/public.sdk/samples/vst2.x/adelay/adelay.h @@ -0,0 +1,93 @@ +//------------------------------------------------------------------------------------------------------- +// VST Plug-Ins SDK +// Version 2.4 $Date: 2006/11/13 09:08:27 $ +// +// Category : VST 2.x SDK Samples +// Filename : adelay.h +// Created by : Steinberg Media Technologies +// Description : Simple Delay plugin (Mono->Stereo) +// +// © 2006, Steinberg Media Technologies, All Rights Reserved +//------------------------------------------------------------------------------------------------------- + +#ifndef __adelay__ +#define __adelay__ + +#include "public.sdk/source/vst2.x/audioeffectx.h" + +enum +{ + // Global + kNumPrograms = 16, + + // Parameters Tags + kDelay = 0, + kFeedBack, + kOut, + + kNumParams +}; + +class ADelay; + +//------------------------------------------------------------------------ +class ADelayProgram +{ +friend class ADelay; +public: + ADelayProgram (); + ~ADelayProgram () {} + +private: + float fDelay; + float fFeedBack; + float fOut; + char name[24]; +}; + +//------------------------------------------------------------------------ +class ADelay : public AudioEffectX +{ +public: + ADelay (audioMasterCallback audioMaster); + ~ADelay (); + + //---from AudioEffect----------------------- + virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames); + + virtual void setProgram (VstInt32 program); + virtual void setProgramName (char* name); + virtual void getProgramName (char* name); + virtual bool getProgramNameIndexed (VstInt32 category, VstInt32 index, char* text); + + virtual void setParameter (VstInt32 index, float value); + virtual float getParameter (VstInt32 index); + virtual void getParameterLabel (VstInt32 index, char* label); + virtual void getParameterDisplay (VstInt32 index, char* text); + virtual void getParameterName (VstInt32 index, char* text); + + virtual void resume (); + + virtual bool getEffectName (char* name); + virtual bool getVendorString (char* text); + virtual bool getProductString (char* text); + virtual VstInt32 getVendorVersion () { return 1000; } + + virtual VstPlugCategory getPlugCategory () { return kPlugCategEffect; } + +protected: + void setDelay (float delay); + + ADelayProgram* programs; + + float* buffer; + float fDelay; + float fFeedBack; + float fOut; + + long delay; + long size; + long cursor; +}; + +#endif diff --git a/public.sdk/samples/vst2.x/adelay/adelaymain.cpp b/public.sdk/samples/vst2.x/adelay/adelaymain.cpp new file mode 100644 index 0000000..ea9895e --- /dev/null +++ b/public.sdk/samples/vst2.x/adelay/adelaymain.cpp @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------------------------------- +// VST Plug-Ins SDK +// Version 2.4 $Date: 2006/11/13 09:08:27 $ +// +// Category : VST 2.x SDK Samples +// Filename : adelaymain.cpp +// Created by : Steinberg Media Technologies +// Description : Simple Delay plugin (Mono->Stereo) +// +// © 2006, Steinberg Media Technologies, All Rights Reserved +//------------------------------------------------------------------------------------------------------- + +#ifndef __adelay__ +#include "adelay.h" +#endif + +//------------------------------------------------------------------------------------------------------- +AudioEffect* createEffectInstance (audioMasterCallback audioMaster) +{ + return new ADelay (audioMaster); +} + diff --git a/public.sdk/samples/vst2.x/adelay/editor/resources/bmp00128.bmp b/public.sdk/samples/vst2.x/adelay/editor/resources/bmp00128.bmp new file mode 100644 index 0000000..1e3b523 Binary files /dev/null and b/public.sdk/samples/vst2.x/adelay/editor/resources/bmp00128.bmp differ diff --git a/public.sdk/samples/vst2.x/adelay/editor/resources/bmp00129.bmp b/public.sdk/samples/vst2.x/adelay/editor/resources/bmp00129.bmp new file mode 100644 index 0000000..275e4aa Binary files /dev/null and b/public.sdk/samples/vst2.x/adelay/editor/resources/bmp00129.bmp differ diff --git a/public.sdk/samples/vst2.x/adelay/editor/resources/bmp00130.bmp b/public.sdk/samples/vst2.x/adelay/editor/resources/bmp00130.bmp new file mode 100644 index 0000000..e272640 Binary files /dev/null and b/public.sdk/samples/vst2.x/adelay/editor/resources/bmp00130.bmp differ diff --git a/public.sdk/samples/vst2.x/adelay/editor/resources/surrounddelay.rc b/public.sdk/samples/vst2.x/adelay/editor/resources/surrounddelay.rc new file mode 100644 index 0000000..52ef47d --- /dev/null +++ b/public.sdk/samples/vst2.x/adelay/editor/resources/surrounddelay.rc @@ -0,0 +1,10 @@ +#define APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +128 BITMAP DISCARDABLE "bmp00128.bmp" +129 BITMAP DISCARDABLE "bmp00129.bmp" +130 BITMAP DISCARDABLE "bmp00130.bmp" diff --git a/public.sdk/samples/vst2.x/adelay/editor/sdeditor.cpp b/public.sdk/samples/vst2.x/adelay/editor/sdeditor.cpp new file mode 100644 index 0000000..ac5ebfc --- /dev/null +++ b/public.sdk/samples/vst2.x/adelay/editor/sdeditor.cpp @@ -0,0 +1,235 @@ +//------------------------------------------------------------------------------------------------------- +// VST Plug-Ins SDK +// Version 2.4 $Date: 2006/11/13 09:08:28 $ +// +// Category : VST 2.x SDK Samples +// Filename : sdeditor.cpp +// Created by : Steinberg Media Technologies +// Description : Simple Surround Delay plugin with Editor using VSTGUI +// +// © 2006, Steinberg Media Technologies, All Rights Reserved +//------------------------------------------------------------------------------------------------------- + +#ifndef __sdeditor__ +#include "sdeditor.h" +#endif + +#ifndef __adelay__ +#include "../adelay.h" +#endif + +#include + +//----------------------------------------------------------------------------- +// resource id's +enum { + // bitmaps + kBackgroundId = 128, + kFaderBodyId, + kFaderHandleId, + + // positions + kFaderX = 18, + kFaderY = 10, + + kFaderInc = 18, + + kDisplayX = 10, + kDisplayY = 184, + kDisplayXWidth = 30, + kDisplayHeight = 14 +}; + +//----------------------------------------------------------------------------- +// prototype string convert float -> percent +void percentStringConvert (float value, char* string); +void percentStringConvert (float value, char* string) +{ + sprintf (string, "%d%%", (int)(100 * value + 0.5f)); +} + + +//----------------------------------------------------------------------------- +// SDEditor class implementation +//----------------------------------------------------------------------------- +SDEditor::SDEditor (AudioEffect *effect) + : AEffGUIEditor (effect) +{ + delayFader = 0; + feedbackFader = 0; + volumeFader = 0; + delayDisplay = 0; + feedbackDisplay = 0; + volumeDisplay = 0; + + // load the background bitmap + // we don't need to load all bitmaps, this could be done when open is called + hBackground = new CBitmap (kBackgroundId); + + // init the size of the plugin + rect.left = 0; + rect.top = 0; + rect.right = (short)hBackground->getWidth (); + rect.bottom = (short)hBackground->getHeight (); +} + +//----------------------------------------------------------------------------- +SDEditor::~SDEditor () +{ + // free the background bitmap + if (hBackground) + hBackground->forget (); + hBackground = 0; +} + +//----------------------------------------------------------------------------- +bool SDEditor::open (void *ptr) +{ + // !!! always call this !!! + AEffGUIEditor::open (ptr); + + //--load some bitmaps + CBitmap* hFaderBody = new CBitmap (kFaderBodyId); + CBitmap* hFaderHandle = new CBitmap (kFaderHandleId); + + //--init background frame----------------------------------------------- + // We use a local CFrame object so that calls to setParameter won't call into objects which may not exist yet. + // If all GUI objects are created we assign our class member to this one. See bottom of this method. + CRect size (0, 0, hBackground->getWidth (), hBackground->getHeight ()); + CFrame* lFrame = new CFrame (size, ptr, this); + lFrame->setBackground (hBackground); + + //--init the faders------------------------------------------------ + int minPos = kFaderY; + int maxPos = kFaderY + hFaderBody->getHeight () - hFaderHandle->getHeight () - 1; + CPoint point (0, 0); + CPoint offset (1, 0); + + // Delay + size (kFaderX, kFaderY, + kFaderX + hFaderBody->getWidth (), kFaderY + hFaderBody->getHeight ()); + delayFader = new CVerticalSlider (size, this, kDelay, minPos, maxPos, hFaderHandle, hFaderBody, point); + delayFader->setOffsetHandle (offset); + delayFader->setValue (effect->getParameter (kDelay)); + lFrame->addView (delayFader); + + // FeedBack + size.offset (kFaderInc + hFaderBody->getWidth (), 0); + feedbackFader = new CVerticalSlider (size, this, kFeedBack, minPos, maxPos, hFaderHandle, hFaderBody, point); + feedbackFader->setOffsetHandle (offset); + feedbackFader->setValue (effect->getParameter (kFeedBack)); + lFrame->addView (feedbackFader); + + // Volume + size.offset (kFaderInc + hFaderBody->getWidth (), 0); + volumeFader = new CVerticalSlider (size, this, kOut, minPos, maxPos, hFaderHandle, hFaderBody, point); + volumeFader->setOffsetHandle (offset); + volumeFader->setValue (effect->getParameter (kOut)); + volumeFader->setDefaultValue (0.75f); + lFrame->addView (volumeFader); + + //--init the display------------------------------------------------ + // Delay + size (kDisplayX, kDisplayY, + kDisplayX + kDisplayXWidth, kDisplayY + kDisplayHeight); + delayDisplay = new CParamDisplay (size, 0, kCenterText); + delayDisplay->setFont (kNormalFontSmall); + delayDisplay->setFontColor (kWhiteCColor); + delayDisplay->setBackColor (kBlackCColor); + delayDisplay->setFrameColor (kBlueCColor); + delayDisplay->setValue (effect->getParameter (kDelay)); + lFrame->addView (delayDisplay); + + // FeedBack + size.offset (kFaderInc + hFaderBody->getWidth (), 0); + feedbackDisplay = new CParamDisplay (size, 0, kCenterText); + feedbackDisplay->setFont (kNormalFontSmall); + feedbackDisplay->setFontColor (kWhiteCColor); + feedbackDisplay->setBackColor (kBlackCColor); + feedbackDisplay->setFrameColor (kBlueCColor); + feedbackDisplay->setValue (effect->getParameter (kFeedBack)); + feedbackDisplay->setStringConvert (percentStringConvert); + lFrame->addView (feedbackDisplay); + + // Volume + size.offset (kFaderInc + hFaderBody->getWidth (), 0); + volumeDisplay = new CParamDisplay (size, 0, kCenterText); + volumeDisplay->setFont (kNormalFontSmall); + volumeDisplay->setFontColor (kWhiteCColor); + volumeDisplay->setBackColor (kBlackCColor); + volumeDisplay->setFrameColor (kBlueCColor); + volumeDisplay->setValue (effect->getParameter (kOut)); + volumeDisplay->setStringConvert (percentStringConvert); + lFrame->addView (volumeDisplay); + + + // Note : in the constructor of a CBitmap, the number of references is set to 1. + // Then, each time the bitmap is used (for hinstance in a vertical slider), this + // number is incremented. + // As a consequence, everything happens as if the constructor by itself was adding + // a reference. That's why we need til here a call to forget (). + // You mustn't call delete here directly, because the bitmap is used by some CControls... + // These "rules" apply to the other VSTGUI objects too. + hFaderBody->forget (); + hFaderHandle->forget (); + + frame = lFrame; + return true; +} + +//----------------------------------------------------------------------------- +void SDEditor::close () +{ + delete frame; + frame = 0; +} + +//----------------------------------------------------------------------------- +void SDEditor::setParameter (VstInt32 index, float value) +{ + if (frame == 0) + return; + + // called from ADelayEdit + switch (index) + { + case kDelay: + if (delayFader) + delayFader->setValue (effect->getParameter (index)); + if (delayDisplay) + delayDisplay->setValue (effect->getParameter (index)); + break; + + case kFeedBack: + if (feedbackFader) + feedbackFader->setValue (effect->getParameter (index)); + if (feedbackDisplay) + feedbackDisplay->setValue (effect->getParameter (index)); + break; + + case kOut: + if (volumeFader) + volumeFader->setValue (effect->getParameter (index)); + if (volumeDisplay) + volumeDisplay->setValue (effect->getParameter (index)); + break; + } +} + +//----------------------------------------------------------------------------- +void SDEditor::valueChanged (CDrawContext* context, CControl* control) +{ + long tag = control->getTag (); + switch (tag) + { + case kDelay: + case kFeedBack: + case kOut: + effect->setParameterAutomated (tag, control->getValue ()); + control->setDirty (); + break; + } +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- diff --git a/public.sdk/samples/vst2.x/adelay/editor/sdeditor.h b/public.sdk/samples/vst2.x/adelay/editor/sdeditor.h new file mode 100644 index 0000000..abe427a --- /dev/null +++ b/public.sdk/samples/vst2.x/adelay/editor/sdeditor.h @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------------------------------------- +// VST Plug-Ins SDK +// Version 2.4 $Date: 2006/11/13 09:08:28 $ +// +// Category : VST 2.x SDK Samples +// Filename : sdeditor.h +// Created by : Steinberg Media Technologies +// Description : Simple Surround Delay plugin with Editor using VSTGUI +// +// © 2006, Steinberg Media Technologies, All Rights Reserved +//------------------------------------------------------------------------------------------------------- + +#ifndef __sdeditor__ +#define __sdeditor__ + + +// include VSTGUI +#ifndef __vstgui__ +#include "vstgui.sf/vstgui/vstgui.h" +#endif + + +//----------------------------------------------------------------------------- +class SDEditor : public AEffGUIEditor, public CControlListener +{ +public: + SDEditor (AudioEffect* effect); + virtual ~SDEditor (); + +public: + virtual bool open (void* ptr); + virtual void close (); + + virtual void setParameter (VstInt32 index, float value); + virtual void valueChanged (CDrawContext* context, CControl* control); + +private: + // Controls + CVerticalSlider* delayFader; + CVerticalSlider* feedbackFader; + CVerticalSlider* volumeFader; + + CParamDisplay* delayDisplay; + CParamDisplay* feedbackDisplay; + CParamDisplay* volumeDisplay; + + // Bitmap + CBitmap* hBackground; +}; + +#endif diff --git a/public.sdk/samples/vst2.x/adelay/surrounddelay.cpp b/public.sdk/samples/vst2.x/adelay/surrounddelay.cpp new file mode 100644 index 0000000..d8c5a99 --- /dev/null +++ b/public.sdk/samples/vst2.x/adelay/surrounddelay.cpp @@ -0,0 +1,172 @@ +//------------------------------------------------------------------------------------------------------- +// VST Plug-Ins SDK +// Version 2.4 $Date: 2006/11/13 09:08:27 $ +// +// Category : VST 2.x SDK Samples +// Filename : surrounddelay.cpp +// Created by : Steinberg Media Technologies +// Description : Simple Surround Delay plugin with Editor using VSTGUI +// +// © 2006, Steinberg Media Technologies, All Rights Reserved +//------------------------------------------------------------------------------------------------------- + +#ifndef __surrounddelay__ +#include "surrounddelay.h" +#endif + +#ifndef __sdeditor__ +#include "editor/sdeditor.h" +#endif + +#include +#include + +//------------------------------------------------------------------------------------------------------- +AudioEffect* createEffectInstance (audioMasterCallback audioMaster) +{ + return new SurroundDelay (audioMaster); +} + +//----------------------------------------------------------------------------- +SurroundDelay::SurroundDelay (audioMasterCallback audioMaster) +: ADelay (audioMaster) +, plugInput (0) +, plugOutput (0) +{ + + // The first buffer is allocated in ADelay's constructor + for (int i = 1; i < MAX_CHANNELS; i++) + { + sBuffers[i] = new float[size]; + } + + setNumInputs (MAX_CHANNELS); + setNumOutputs (MAX_CHANNELS); + + // We initialize the arrangements to default values. + // Nevertheless, the host should modify them via + // appropriate calls to setSpeakerArrangement. + allocateArrangement (&plugInput, MAX_CHANNELS); + plugInput->type = kSpeakerArr51; + + allocateArrangement (&plugOutput, MAX_CHANNELS); + plugOutput->type = kSpeakerArr51; + + setUniqueID ('SDlE'); // this should be unique, use the Steinberg web page for plugin Id registration + + // create the editor + editor = new SDEditor (this); + + resume (); +} + +//----------------------------------------------------------------------------- +SurroundDelay::~SurroundDelay () +{ + sBuffers[0] = 0; + // We let ~ADelay delete "buffer"... + for (int i = 1; i < MAX_CHANNELS; i++) + { + if (sBuffers[i]) + { + delete[] sBuffers[i]; + } + sBuffers[i] = 0; + } + + deallocateArrangement (&plugInput); + deallocateArrangement (&plugOutput); +} + +//------------------------------------------------------------------------ +void SurroundDelay::resume () +{ + memset (buffer, 0, size * sizeof (float)); + sBuffers[0] = buffer; + + for (int i = 1; i < MAX_CHANNELS; i++) + { + memset (sBuffers[i], 0, size * sizeof (float)); + } +} + +//------------------------------------------------------------------------ +bool SurroundDelay::getSpeakerArrangement (VstSpeakerArrangement** pluginInput, VstSpeakerArrangement** pluginOutput) +{ + *pluginInput = plugInput; + *pluginOutput = plugOutput; + return true; +} + +//------------------------------------------------------------------------ +bool SurroundDelay::setSpeakerArrangement (VstSpeakerArrangement* pluginInput, + VstSpeakerArrangement* pluginOutput) +{ + if (!pluginOutput || !pluginInput) + return false; + + bool result = true; + + // This plug-in can act on any speaker arrangement, + // provided that there are the same number of inputs/outputs. + if (pluginInput->numChannels > MAX_CHANNELS) + { + // This plug-in can't have so many channels. So we answer + // false, and we set the input arrangement with the maximum + // number of channels possible + result = false; + allocateArrangement (&plugInput, MAX_CHANNELS); + plugInput->type = kSpeakerArr51; + } + else + { + matchArrangement (&plugInput, pluginInput); + } + + if (pluginOutput->numChannels != plugInput->numChannels) + { + // This plug-in only deals with symetric IO configurations... + result = false; + matchArrangement (&plugOutput, plugInput); + } + else + { + matchArrangement (&plugOutput, pluginOutput); + } + + return result; +} + +//------------------------------------------------------------------------ +void SurroundDelay::processReplacing (float** inputs, float** outputs, VstInt32 sampleframes) +{ + float* inputs2[1]; + float* outputs2[2]; + + outputs2[1] = NULL; + + long cursorTemp = cursor; + + for (int i = 0; i < plugInput->numChannels; i++) + { + cursor = cursorTemp; + + buffer = sBuffers[i]; + + inputs2[0] = inputs[i]; + outputs2[0] = outputs[i]; + + ADelay::processReplacing (inputs2, outputs2, sampleframes); + } + + buffer = sBuffers[0]; +} + +//----------------------------------------------------------------------------- +void SurroundDelay::setParameter (VstInt32 index, float value) +{ + ADelay::setParameter (index, value); + + if (editor) + ((AEffGUIEditor*)editor)->setParameter (index, value); +} diff --git a/public.sdk/samples/vst2.x/adelay/surrounddelay.h b/public.sdk/samples/vst2.x/adelay/surrounddelay.h new file mode 100644 index 0000000..f8412b9 --- /dev/null +++ b/public.sdk/samples/vst2.x/adelay/surrounddelay.h @@ -0,0 +1,54 @@ +//------------------------------------------------------------------------------------------------------- +// VST Plug-Ins SDK +// Version 2.4 $Date: 2006/11/13 09:08:27 $ +// +// Category : VST 2.x SDK Samples +// Filename : surrounddelay.h +// Created by : Steinberg Media Technologies +// Description : Simple Surround Delay plugin with Editor using VSTGUI +// +// © 2006, Steinberg Media Technologies, All Rights Reserved +//------------------------------------------------------------------------------------------------------- + +#ifndef __surrounddelay__ +#define __surrounddelay__ + +#ifndef __adelay__ +#include "adelay.h" +#endif + +#define MAX_CHANNELS 6 // maximun number of channel + +//------------------------------------------------------------------------ +// SurroundDelay declaration +//------------------------------------------------------------------------ +class SurroundDelay : public ADelay +{ +public: + SurroundDelay (audioMasterCallback audioMaster); + ~SurroundDelay (); + + virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleframes); + + void setParameter (VstInt32 index, float value); + + // functions VST version 2 + virtual bool getVendorString (char* text) { if (text) strcpy (text, "Steinberg"); return true; } + virtual bool getProductString (char* text) { if (text) strcpy (text, "SDelay"); return true; } + virtual VstInt32 getVendorVersion () { return 1000; } + + virtual VstPlugCategory getPlugCategory () { return kPlugSurroundFx; } + + virtual bool getSpeakerArrangement (VstSpeakerArrangement** pluginInput, VstSpeakerArrangement** pluginOutput); + virtual bool setSpeakerArrangement (VstSpeakerArrangement* pluginInput, VstSpeakerArrangement* pluginOutput); + + virtual void resume (); + +private: + VstSpeakerArrangement* plugInput; + VstSpeakerArrangement* plugOutput; + + float* sBuffers[MAX_CHANNELS]; +}; + +#endif diff --git a/public.sdk/samples/vst2.x/adelay/win/adelay.vcproj b/public.sdk/samples/vst2.x/adelay/win/adelay.vcproj new file mode 100644 index 0000000..3391506 --- /dev/null +++ b/public.sdk/samples/vst2.x/adelay/win/adelay.vcproj @@ -0,0 +1,400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public.sdk/samples/vst2.x/adelay/win/surrounddelay.vcproj b/public.sdk/samples/vst2.x/adelay/win/surrounddelay.vcproj new file mode 100644 index 0000000..194bc12 --- /dev/null +++ b/public.sdk/samples/vst2.x/adelay/win/surrounddelay.vcproj @@ -0,0 +1,444 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3-70-g09d2