diff options
author | Chris Johnson <jinx6568@sover.net> | 2018-12-23 17:36:57 -0500 |
---|---|---|
committer | Chris Johnson <jinx6568@sover.net> | 2018-12-23 17:36:57 -0500 |
commit | 35ee7938c7c86758d0b5e6413679db9bb7b90ab2 (patch) | |
tree | 5cbc42fac43f66d20afc56683f393759a3c102f1 /plugins/MacVST/RawGlitters/source | |
parent | 2a6e1bef6b4bd039386aa24c988f5d69364ff874 (diff) | |
download | airwindows-lv2-port-35ee7938c7c86758d0b5e6413679db9bb7b90ab2.tar.gz airwindows-lv2-port-35ee7938c7c86758d0b5e6413679db9bb7b90ab2.tar.bz2 airwindows-lv2-port-35ee7938c7c86758d0b5e6413679db9bb7b90ab2.zip |
RawTimbers
Diffstat (limited to 'plugins/MacVST/RawGlitters/source')
-rwxr-xr-x | plugins/MacVST/RawGlitters/source/RawGlitters.cpp | 83 | ||||
-rwxr-xr-x | plugins/MacVST/RawGlitters/source/RawGlitters.h | 60 | ||||
-rwxr-xr-x | plugins/MacVST/RawGlitters/source/RawGlittersProc.cpp | 86 |
3 files changed, 229 insertions, 0 deletions
diff --git a/plugins/MacVST/RawGlitters/source/RawGlitters.cpp b/plugins/MacVST/RawGlitters/source/RawGlitters.cpp new file mode 100755 index 0000000..0429460 --- /dev/null +++ b/plugins/MacVST/RawGlitters/source/RawGlitters.cpp @@ -0,0 +1,83 @@ +/* ======================================== + * RawGlitters - RawGlitters.h + * Copyright (c) 2016 airwindows, All rights reserved + * ======================================== */ + +#ifndef __RawGlitters_H +#include "RawGlitters.h" +#endif + +AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new RawGlitters(audioMaster);} + +RawGlitters::RawGlitters(audioMasterCallback audioMaster) : + AudioEffectX(audioMaster, kNumPrograms, kNumParameters) +{ + lastSampleL = 0.0; + lastSample2L = 0.0; + lastSampleR = 0.0; + lastSample2R = 0.0; + //this is reset: values being initialized only once. Startup values, whatever they are. + + _canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect. + _canDo.insert("plugAsSend"); // plug-in can be used as a send effect. + _canDo.insert("x2in2out"); + setNumInputs(kNumInputs); + setNumOutputs(kNumOutputs); + setUniqueID(kUniqueId); + canProcessReplacing(); // supports output replacing + canDoubleReplacing(); // supports double precision processing + programsAreChunks(true); + vst_strncpy (_programName, "Default", kVstMaxProgNameLen); // default program name +} + +RawGlitters::~RawGlitters() {} +VstInt32 RawGlitters::getVendorVersion () {return 1000;} +void RawGlitters::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);} +void RawGlitters::getProgramName(char *name) {vst_strncpy (name, _programName, kVstMaxProgNameLen);} +//airwindows likes to ignore this stuff. Make your own programs, and make a different plugin rather than +//trying to do versioning and preventing people from using older versions. Maybe they like the old one! + +VstInt32 RawGlitters::getChunk (void** data, bool isPreset) +{ + float *chunkData = (float *)calloc(kNumParameters, sizeof(float)); + *data = chunkData; + return kNumParameters * sizeof(float); +} + +VstInt32 RawGlitters::setChunk (void* data, VstInt32 byteSize, bool isPreset) +{ + return 0; +} + +void RawGlitters::setParameter(VstInt32 index, float value) { +} + +float RawGlitters::getParameter(VstInt32 index) { + return 0.0; //we only need to update the relevant name, this is simple to manage +} + +void RawGlitters::getParameterName(VstInt32 index, char *text) { +} + +void RawGlitters::getParameterDisplay(VstInt32 index, char *text) { +} + +void RawGlitters::getParameterLabel(VstInt32 index, char *text) { +} + +VstInt32 RawGlitters::canDo(char *text) +{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know + +bool RawGlitters::getEffectName(char* name) { + vst_strncpy(name, "RawGlitters", kVstMaxProductStrLen); return true; +} + +VstPlugCategory RawGlitters::getPlugCategory() {return kPlugCategEffect;} + +bool RawGlitters::getProductString(char* text) { + vst_strncpy (text, "airwindows RawGlitters", kVstMaxProductStrLen); return true; +} + +bool RawGlitters::getVendorString(char* text) { + vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true; +} diff --git a/plugins/MacVST/RawGlitters/source/RawGlitters.h b/plugins/MacVST/RawGlitters/source/RawGlitters.h new file mode 100755 index 0000000..1a8752d --- /dev/null +++ b/plugins/MacVST/RawGlitters/source/RawGlitters.h @@ -0,0 +1,60 @@ +/* ======================================== + * RawGlitters - RawGlitters.h + * Created 8/12/11 by SPIAdmin + * Copyright (c) 2011 __MyCompanyName__, All rights reserved + * ======================================== */ + +#ifndef __RawGlitters_H +#define __RawGlitters_H + +#ifndef __audioeffect__ +#include "audioeffectx.h" +#endif + +#include <set> +#include <string> +#include <math.h> + +enum { + kNumParameters = 0 +}; // + +const int kNumPrograms = 0; +const int kNumInputs = 2; +const int kNumOutputs = 2; +const unsigned long kUniqueId = 'ragt'; //Change this to what the AU identity is! + +class RawGlitters : + public AudioEffectX +{ +public: + RawGlitters(audioMasterCallback audioMaster); + ~RawGlitters(); + virtual bool getEffectName(char* name); // The plug-in name + virtual VstPlugCategory getPlugCategory(); // The general category for the plug-in + virtual bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg + virtual bool getVendorString(char* text); // Vendor info + virtual VstInt32 getVendorVersion(); // Version number + virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames); + virtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames); + virtual void getProgramName(char *name); // read the name from the host + virtual void setProgramName(char *name); // changes the name of the preset displayed in the host + virtual VstInt32 getChunk (void** data, bool isPreset); + virtual VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset); + virtual float getParameter(VstInt32 index); // get the parameter value at the specified index + virtual void setParameter(VstInt32 index, float value); // set the parameter at index to value + virtual void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB) + virtual void getParameterName(VstInt32 index, char *text); // name of the parameter + virtual void getParameterDisplay(VstInt32 index, char *text); // text description of the current value + virtual VstInt32 canDo(char *text); +private: + char _programName[kVstMaxProgNameLen + 1]; + std::set< std::string > _canDo; + + double lastSampleL; + double lastSample2L; + double lastSampleR; + double lastSample2R; +}; + +#endif diff --git a/plugins/MacVST/RawGlitters/source/RawGlittersProc.cpp b/plugins/MacVST/RawGlitters/source/RawGlittersProc.cpp new file mode 100755 index 0000000..41d2bf7 --- /dev/null +++ b/plugins/MacVST/RawGlitters/source/RawGlittersProc.cpp @@ -0,0 +1,86 @@ +/* ======================================== + * RawGlitters - RawGlitters.h + * Copyright (c) 2016 airwindows, All rights reserved + * ======================================== */ + +#ifndef __RawGlitters_H +#include "RawGlitters.h" +#endif + +void RawGlitters::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames) +{ + float* in1 = inputs[0]; + float* in2 = inputs[1]; + float* out1 = outputs[0]; + float* out2 = outputs[1]; + + while (--sampleFrames >= 0) + { + double inputSampleL = *in1 * 8388608.0; + double inputSampleR = *in2 * 8388608.0; + double outputSampleL; + double outputSampleR; + + inputSampleL += 0.381966011250105; + inputSampleR += 0.381966011250105; + + if ((lastSampleL+lastSampleL) <= (inputSampleL+lastSample2L)) outputSampleL = floor(lastSampleL); + else outputSampleL = floor(lastSampleL+1.0); //round down or up based on whether it softens treble angles + + if ((lastSampleR+lastSampleR) <= (inputSampleR+lastSample2R)) outputSampleR = floor(lastSampleR); + else outputSampleR = floor(lastSampleR+1.0); //round down or up based on whether it softens treble angles + + lastSample2L = lastSampleL; + lastSampleL = inputSampleL; //we retain three samples in a row + + lastSample2R = lastSampleR; + lastSampleR = inputSampleR; //we retain three samples in a row + + *out1 = outputSampleL / 8388608.0; + *out2 = outputSampleR / 8388608.0; + + *in1++; + *in2++; + *out1++; + *out2++; + } +} + +void RawGlitters::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) +{ + double* in1 = inputs[0]; + double* in2 = inputs[1]; + double* out1 = outputs[0]; + double* out2 = outputs[1]; + + while (--sampleFrames >= 0) + { + double inputSampleL = *in1 * 8388608.0; + double inputSampleR = *in2 * 8388608.0; + double outputSampleL; + double outputSampleR; + + inputSampleL += 0.381966011250105; + inputSampleR += 0.381966011250105; + + if ((lastSampleL+lastSampleL) <= (inputSampleL+lastSample2L)) outputSampleL = floor(lastSampleL); + else outputSampleL = floor(lastSampleL+1.0); //round down or up based on whether it softens treble angles + + if ((lastSampleR+lastSampleR) <= (inputSampleR+lastSample2R)) outputSampleR = floor(lastSampleR); + else outputSampleR = floor(lastSampleR+1.0); //round down or up based on whether it softens treble angles + + lastSample2L = lastSampleL; + lastSampleL = inputSampleL; //we retain three samples in a row + + lastSample2R = lastSampleR; + lastSampleR = inputSampleR; //we retain three samples in a row + + *out1 = outputSampleL / 8388608.0; + *out2 = outputSampleR / 8388608.0; + + *in1++; + *in2++; + *out1++; + *out2++; + } +} |