summaryrefslogtreecommitdiff
path: root/vendor/vstsdk2.4/public.sdk/samples/vst2.x/vstxsynth/source/vstxsynth.h
diff options
context:
space:
mode:
authorpepper <peppersclothescult@gmail.com>2015-01-10 21:37:24 -0800
committerpepper <peppersclothescult@gmail.com>2015-01-10 21:37:24 -0800
commit58f8437f4b8b741ddc8e7bcde21bf983cc618430 (patch)
treebfd0a9d601274fe56de15a4eaeb0998f9481419d /vendor/vstsdk2.4/public.sdk/samples/vst2.x/vstxsynth/source/vstxsynth.h
parent36773a28ece1641a2d827a29869cdd4c38e87925 (diff)
added vstsdkHEADmaster
Diffstat (limited to 'vendor/vstsdk2.4/public.sdk/samples/vst2.x/vstxsynth/source/vstxsynth.h')
-rw-r--r--vendor/vstsdk2.4/public.sdk/samples/vst2.x/vstxsynth/source/vstxsynth.h139
1 files changed, 139 insertions, 0 deletions
diff --git a/vendor/vstsdk2.4/public.sdk/samples/vst2.x/vstxsynth/source/vstxsynth.h b/vendor/vstsdk2.4/public.sdk/samples/vst2.x/vstxsynth/source/vstxsynth.h
new file mode 100644
index 0000000..6212cac
--- /dev/null
+++ b/vendor/vstsdk2.4/public.sdk/samples/vst2.x/vstxsynth/source/vstxsynth.h
@@ -0,0 +1,139 @@
+//-------------------------------------------------------------------------------------------------------
+// VST Plug-Ins SDK
+// Version 2.4 $Date: 2006/11/13 09:08:27 $
+//
+// Category : VST 2.x SDK Samples
+// Filename : vstxsynth.h
+// Created by : Steinberg Media Technologies
+// Description : Example VstXSynth
+//
+// A simple 2 oscillators test 'synth',
+// Each oscillator has waveform, frequency, and volume
+//
+// *very* basic monophonic 'synth' example. you should not attempt to use this
+// example 'algorithm' to start a serious virtual instrument; it is intended to demonstrate
+// how VstEvents ('MIDI') are handled, but not how a virtual analog synth works.
+// there are numerous much better examples on the web which show how to deal with
+// bandlimited waveforms etc.
+//
+// © 2006, Steinberg Media Technologies, All Rights Reserved
+//-------------------------------------------------------------------------------------------------------
+
+#ifndef __vstxsynth__
+#define __vstxsynth__
+
+#include "public.sdk/source/vst2.x/audioeffectx.h"
+
+//------------------------------------------------------------------------------------------
+enum
+{
+ // Global
+ kNumPrograms = 128,
+ kNumOutputs = 2,
+
+ // Parameters Tags
+ kWaveform1 = 0,
+ kFreq1,
+ kVolume1,
+
+ kWaveform2,
+ kFreq2,
+ kVolume2,
+
+ kVolume,
+
+ kNumParams
+};
+
+//------------------------------------------------------------------------------------------
+// VstXSynthProgram
+//------------------------------------------------------------------------------------------
+class VstXSynthProgram
+{
+friend class VstXSynth;
+public:
+ VstXSynthProgram ();
+ ~VstXSynthProgram () {}
+
+private:
+ float fWaveform1;
+ float fFreq1;
+ float fVolume1;
+
+ float fWaveform2;
+ float fFreq2;
+ float fVolume2;
+
+ float fVolume;
+ char name[kVstMaxProgNameLen+1];
+};
+
+//------------------------------------------------------------------------------------------
+// VstXSynth
+//------------------------------------------------------------------------------------------
+class VstXSynth : public AudioEffectX
+{
+public:
+ VstXSynth (audioMasterCallback audioMaster);
+ ~VstXSynth ();
+
+ virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);
+ virtual VstInt32 processEvents (VstEvents* events);
+
+ 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 setSampleRate (float sampleRate);
+ virtual void setBlockSize (VstInt32 blockSize);
+
+ virtual bool getOutputProperties (VstInt32 index, VstPinProperties* properties);
+
+ virtual bool getEffectName (char* name);
+ virtual bool getVendorString (char* text);
+ virtual bool getProductString (char* text);
+ virtual VstInt32 getVendorVersion ();
+ virtual VstInt32 canDo (char* text);
+
+ virtual VstInt32 getNumMidiInputChannels ();
+ virtual VstInt32 getNumMidiOutputChannels ();
+
+ virtual VstInt32 getMidiProgramName (VstInt32 channel, MidiProgramName* midiProgramName);
+ virtual VstInt32 getCurrentMidiProgram (VstInt32 channel, MidiProgramName* currentProgram);
+ virtual VstInt32 getMidiProgramCategory (VstInt32 channel, MidiProgramCategory* category);
+ virtual bool hasMidiProgramsChanged (VstInt32 channel);
+ virtual bool getMidiKeyName (VstInt32 channel, MidiKeyName* keyName);
+
+private:
+ float fWaveform1;
+ float fFreq1;
+ float fVolume1;
+ float fWaveform2;
+ float fFreq2;
+ float fVolume2;
+ float fVolume;
+ float fPhase1, fPhase2;
+ float fScaler;
+
+ VstXSynthProgram* programs;
+ VstInt32 channelPrograms[16];
+
+ VstInt32 currentNote;
+ VstInt32 currentVelocity;
+ VstInt32 currentDelta;
+ bool noteIsOn;
+
+ void initProcess ();
+ void noteOn (VstInt32 note, VstInt32 velocity, VstInt32 delta);
+ void noteOff ();
+ void fillProgram (VstInt32 channel, VstInt32 prg, MidiProgramName* mpn);
+};
+
+#endif