1 /*
2  *  mdaBaseProcessor.h
3  *  mda-vst3
4  *
5  *  Created by Arne Scheffler on 6/14/08.
6  *
7  *  mda VST Plug-ins
8  *
9  *  Copyright (c) 2008 Paul Kellett
10  *
11  *  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12  *  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14  *
15  */
16 
17 #pragma once
18 
19 #include "public.sdk/source/vst/vstaudioeffect.h"
20 #include "pluginterfaces/vst/ivstevents.h"
21 #include "pluginterfaces/vst/ivstparameterchanges.h"
22 
23 namespace Steinberg {
24 namespace Vst {
25 namespace mda {
26 
27 //-----------------------------------------------------------------------------
28 class BaseProcessor : public AudioEffect
29 {
30 protected:
31 	BaseProcessor ();
32 	~BaseProcessor ();
33 
34 	virtual void doProcessing (ProcessData& data) = 0;
35 	virtual bool bypassProcessing (ProcessData& data);
processEvents(IEventList *)36 	virtual void processEvents (IEventList* /*events*/) {}
37 	virtual void checkSilence (ProcessData& data);
38 	virtual void setBypass (bool state, int32 sampleOffset);
39 	virtual bool processParameterChanges (IParameterChanges* changes);
40 	virtual void setParameter (ParamID index, ParamValue newValue, int32 sampleOffset);
41 	virtual void allocParameters (int32 numParams);
recalculate()42 	virtual void recalculate () {}
hasProgram()43 	virtual bool hasProgram () const { return false; }
getCurrentProgram()44 	virtual uint32 getCurrentProgram () const { return 0; }
getNumPrograms()45 	virtual uint32 getNumPrograms () const { return 1; }
setCurrentProgram(uint32)46 	virtual void setCurrentProgram (uint32 /*val*/) {}
setCurrentProgramNormalized(ParamValue)47 	virtual void setCurrentProgramNormalized (ParamValue /*val*/) {}
48 	virtual int32 getVst2UniqueId () const = 0;
49 
isBypassed()50 	bool isBypassed () const { return bypassState; }
getSampleRate()51 	double getSampleRate () const { return processSetup.sampleRate; }
52 
53 	tresult PLUGIN_API process (ProcessData& data) SMTG_OVERRIDE;
54 
55 	tresult PLUGIN_API setupProcessing (ProcessSetup& setup) SMTG_OVERRIDE;
56 	tresult PLUGIN_API setActive (TBool state) SMTG_OVERRIDE;
57 	tresult PLUGIN_API setBusArrangements (SpeakerArrangement* inputs, int32 numIns,
58 	                                       SpeakerArrangement* outputs, int32 numOuts) SMTG_OVERRIDE;
59 
60 	tresult PLUGIN_API setState (IBStream* state) SMTG_OVERRIDE;
61 	tresult PLUGIN_API getState (IBStream* state) SMTG_OVERRIDE;
62 
63 	ParamValue* params;
64 	uint32 numParams;
65 	int32 bypassRamp;
66 
67 	float* bypassBuffer0;
68 	float* bypassBuffer1;
69 
70 	bool bypassState;
71 };
72 }
73 }
74 } // namespace
75 
76