1 #include "BlueSaturation.h"
4 AudioEffect* createEffectInstance(audioMasterCallback audioMaster)
6 return new BlueSaturation(audioMaster);
12 BlueSaturation::BlueSaturation(audioMasterCallback audioMaster) :
13 AudioEffectX(audioMaster, kNumPresets, kNumParameters),
24 canProcessReplacing();
27 TTObjectInstantiate(
TT(
"overdrive"), &mOverdrive, mNumChannels);
28 TTObjectInstantiate(kTTSym_audiosignal, &mInput, mNumChannels);
29 TTObjectInstantiate(kTTSym_audiosignal, &mOutput, mNumChannels);
31 mParameterList =
new BlueParameter[kNumParameters];
33 strncpy(mParameterList[kParameterDrive].
name,
"drive", 256);
34 mParameterList[kParameterDrive].scaling = 9.0;
35 mParameterList[kParameterDrive].offset = 1.0;
37 strncpy(mParameterList[kParameterPreamp].
name,
"preamp", 256);
38 mParameterList[kParameterPreamp].scaling = 96.0;
39 mParameterList[kParameterPreamp].offset = -78.0;
41 strncpy(mParameterList[kParameterMode].
name,
"mode", 256);
42 mParameterList[kParameterMode].scaling = 2.0;
43 mParameterList[kParameterMode].offset = 0.5;
45 strncpy(mParameterList[kParameterBlockDC].
name,
"dcblocker", 256);
46 mParameterList[kParameterBlockDC].scaling = 1.0;
47 mParameterList[kParameterBlockDC].offset = 0.5;
49 vst_strncpy(programName,
"Default", kVstMaxProgNameLen);
52 BlueSaturation::~BlueSaturation()
54 TTObjectRelease(&mOverdrive);
55 TTObjectRelease(&mInput);
56 TTObjectRelease(&mOutput);
61 void BlueSaturation::setProgramName(
char* name)
63 vst_strncpy(programName, name, kVstMaxProgNameLen);
67 void BlueSaturation::getProgramName(
char* name)
69 vst_strncpy(name, programName, kVstMaxProgNameLen);
73 void BlueSaturation::setParameter(VstInt32 index,
float value)
80 temp = value * mParameterList[index].scaling;
81 temp += mParameterList[index].offset;
82 mOverdrive->setAttributeValue(
TT(
"drive"), temp);
84 case kParameterPreamp:
85 temp = value * mParameterList[index].scaling;
86 temp += mParameterList[index].offset;
87 mOverdrive->setAttributeValue(
TT(
"preamp"), temp);
90 temp = value * mParameterList[index].scaling;
91 temp += mParameterList[index].offset;
93 mOverdrive->setAttributeValue(
TT(
"mode"), i);
95 case kParameterBlockDC:
96 temp = value * mParameterList[index].scaling;
97 temp += mParameterList[index].offset;
99 mOverdrive->setAttributeValue(
TT(
"dcBlocker"), i);
107 float BlueSaturation::getParameter(VstInt32 index)
112 case kParameterDrive:
113 mOverdrive->getAttributeValue(
TT(
"drive"), value);
114 value -= mParameterList[index].offset;
115 value /= mParameterList[index].scaling;
117 case kParameterPreamp:
118 mOverdrive->getAttributeValue(
TT(
"preamp"), value);
119 value -= mParameterList[index].offset;
120 value /= mParameterList[index].scaling;
123 mOverdrive->getAttributeValue(
TT(
"mode"), value);
125 case kParameterBlockDC:
126 mOverdrive->getAttributeValue(
TT(
"dcBlocker"), value);
135 void BlueSaturation::getParameterName(VstInt32 index,
char* label)
137 strncpy(label, mParameterList[index].name, kVstMaxParamStrLen);
141 void BlueSaturation::getParameterDisplay(VstInt32 index,
char* text)
147 void BlueSaturation::getParameterLabel(VstInt32 index,
char* label)
149 if(index == kParameterPreamp)
150 vst_strncpy(label,
"dB", kVstMaxParamStrLen);
154 bool BlueSaturation::getEffectName(
char* name)
156 vst_strncpy(name,
"BlueSaturation", kVstMaxEffectNameLen);
161 bool BlueSaturation::getProductString(
char* text)
163 vst_strncpy(text,
"BlueSaturation", kVstMaxProductStrLen);
168 bool BlueSaturation::getVendorString(
char* text)
170 vst_strncpy(text,
"Jamoma (jamoma.org)", kVstMaxVendorStrLen);
175 VstInt32 BlueSaturation::getVendorVersion()
182 void BlueSaturation::processReplacing(
float** inputs,
float** outputs, VstInt32 sampleFrames)
184 mInput->setVector(0, sampleFrames, (
TTFloat32*)inputs[0]);
185 mInput->setVector(1, sampleFrames, (
TTFloat32*)inputs[1]);
186 mOutput->setVectorSizeWithInt(sampleFrames);
189 mOverdrive->process(mInput, mOutput);
191 mOutput->getVector(0, sampleFrames, (
TTFloat32*)outputs[0]);
192 mOutput->getVector(1, sampleFrames, (
TTFloat32*)outputs[1]);
196 void BlueSaturation::processDoubleReplacing(
double** inputs,
double** outputs, VstInt32 sampleFrames)
198 mInput->setVector(0, sampleFrames, (
TTFloat64*)inputs[0]);
199 mInput->setVector(1, sampleFrames, (
TTFloat64*)inputs[1]);
200 mOutput->setVectorSizeWithInt(sampleFrames);
203 mOverdrive->process(mInput, mOutput);
205 mOutput->getVector(0, sampleFrames, (
TTFloat64*)outputs[0]);
206 mOutput->getVector(1, sampleFrames, (
TTFloat64*)outputs[1]);
double TTFloat64
64 bit floating point number
#define TT
This macro is defined as a shortcut for doing a lookup in the symbol table.
float TTFloat32
32 bit floating point number
TTSymbol name
Name of this unit.
void TTDSP_EXPORT TTDSPInit(const char *pathToBinaries=NULL)
Initialise the Jamoma DSP library, as well as Jamoma Foundation foundation if needed.