00001 #ifndef __CVstEffect__
00002 #define __CVstEffect__
00003
00004 #include <ECore.h>
00005 #include <audioeffectx.h>
00006 #include "CHostCanDo.hpp"
00007 #include "CVstTempo.hpp"
00008 #include "SVstProcessInformation.hpp"
00009 #include "CVstMidiEventList.hpp"
00010
00011 using Exponent::Vst::CVstMidiEventList;
00012 using Exponent::Vst::CHostCanDo;
00013 using Exponent::Vst::CVstTempo;
00014 using Exponent::Vst::SVstProcessInformation;
00015
00016 namespace Exponent
00017 {
00018 namespace Vst
00019 {
00039 class CVstEffect : public AudioEffectX, public CCountedObject
00040 {
00042 EXPONENT_CLASS_DECLARATION;
00046
00047
00048 public:
00049
00050
00051
00058 #ifdef VST_2_4_EXTENSIONS
00059 CVstEffect(audioMasterCallback audioMaster, const VstInt32 numberOfParameters, const VstInt32 numberOfPresets = 0);
00060 #else
00061 CVstEffect(audioMasterCallback audioMaster, const long numberOfParameters, const long numberOfPresets = 0);
00062 #endif
00063
00067 virtual ~CVstEffect();
00068
00069
00070
00074 virtual void resume();
00075
00082 #ifdef VST_2_4_EXTENSIONS
00083 virtual void process(float **input, float **output, VstInt32 numberOfSamples);
00084 #else
00085 virtual void process(float **input, float **output, long numberOfSamples);
00086 #endif
00087
00094 #ifdef VST_2_4_EXTENSIONS
00095 virtual void processReplacing(float **input, float **output, VstInt32 numberOfSamples);
00096 #else
00097 virtual void processReplacing(float **input, float **output, long numberOfSamples);
00098 #endif
00099
00100 #ifdef VST_2_4_EXTENSIONS
00101
00107 virtual void processDoubleReplacing(double **inputs, double **outputs, VstInt32 numberOfSamples);
00108 #endif
00109
00115 #ifdef VST_2_4_EXTENSIONS
00116 virtual VstInt32 processEvents(VstEvents *events);
00117 #else
00118 virtual long processEvents(VstEvents *events);
00119 #endif
00120
00121
00122
00128 virtual bool getEffectName(char* name);
00129
00135 virtual bool getVendorString(char* text);
00136
00142 virtual bool getProductString(char* text);
00143
00148 CHostCanDo &getHostCanDo() { return m_hostCanDo; }
00149
00154 CCriticalSection *getCriticalSection() const { return m_criticalSection; }
00155
00160 long getMidiChannel() const { return m_midiEventList.getMidiChannel(); }
00161
00162 #ifdef VST_2_4_EXTENSIONS
00163
00167 VstInt32 getNumMidiInputChannels() { return 1; }
00168 #endif
00169
00170
00171
00177 #ifdef VST_2_4_EXTENSIONS
00178 virtual void setParameter(VstInt32 index, float value) { }
00179 #else
00180 virtual void setParameter(long index, float value) { }
00181 #endif
00182
00188 #ifdef VST_2_4_EXTENSIONS
00189 virtual float getParameter(VstInt32 index) { return 0.f; }
00190 #else
00191 virtual float getParameter(long index) { return 0.f; }
00192 #endif
00193
00199 #ifdef VST_2_4_EXTENSIONS
00200 virtual void getParameterLabel(VstInt32 index, char *label) { strcpy(label, "No param"); }
00201 #else
00202 virtual void getParameterLabel(long index, char *label) { strcpy(label, "No param"); }
00203 #endif
00204
00210 #ifdef VST_2_4_EXTENSIONS
00211 virtual void getParameterDisplay(VstInt32 index, char *text) { strcpy(text, "No param"); }
00212 #else
00213 virtual void getParameterDisplay(long index, char *text) { strcpy(text, "No param"); }
00214 #endif
00215
00221 #ifdef VST_2_4_EXTENSIONS
00222 virtual void getParameterName(VstInt32 index, char *text) { strcpy(text, "No param"); }
00223 #else
00224 virtual void getParameterName(long index, char *text) { strcpy(text, "No param"); }
00225 #endif
00226
00233 #ifdef VST_2_4_EXTENSIONS
00234 virtual bool string2parameter(VstInt32 index, char *text) { return false; }
00235 #else
00236 virtual bool string2parameter(long index, char *text) { return false; }
00237 #endif
00238
00239
00240
00245 #ifdef VST_2_4_EXTENSIONS
00246 virtual void setBlockSize(VstInt32 blockSize);
00247 #else
00248 virtual void setBlockSize(long blockSize);
00249 #endif
00250
00255 virtual void setSampleRate(float rate);
00256
00261 virtual void setMidiChannel(const long channel);
00262
00267 virtual bool setBypass(bool onOff) { return false; }
00268
00269
00270
00275 virtual void setProgramName(char *name) { strcpy(name, "Default"); }
00276
00281 virtual void getProgramName(char *name) { strcpy(name, "Default"); }
00282
00287 #ifdef VST_2_4_EXTENSIONS
00288 virtual void setProgram(VstInt32 program) { AudioEffectX::setProgram(program); }
00289 #else
00290 virtual void setProgram(long program) { AudioEffectX::setProgram(program); }
00291 #endif
00292
00300 #ifdef VST_2_4_EXTENSIONS
00301 virtual bool getProgramNameIndexed(VstInt32 category, VstInt32 index, char* text) { strcpy(text, "Default"); return true; }
00302 #else
00303 virtual bool getProgramNameIndexed(long category, long index, char* text) { strcpy(text, "Default"); return true; }
00304 #endif
00305
00306
00307
00308 protected:
00309
00310
00311
00312 CHostCanDo m_hostCanDo;
00313 CVstTempo m_vstTempo;
00314 SVstProcessInformation m_processInfo;
00315 CVstMidiEventList m_midiEventList;
00316 TPointerCollection< TPointerCollection<CLong> > m_midiControllers;
00317 CCriticalSection *m_criticalSection;
00318 };
00319 }
00320 }
00321
00322 #endif // End of CVstEffect.hpp