mirror of
https://github.com/airwindows/airwindows.git
synced 2026-05-15 14:16:00 -06:00
Big Double/Denormalization Update
This commit is contained in:
parent
47e16fec36
commit
54fd8c7a18
3302 changed files with 52490 additions and 63509 deletions
|
|
@ -30,8 +30,8 @@ ADClip7::ADClip7(audioMasterCallback audioMaster) :
|
|||
iirLowsBL = 0.0;
|
||||
iirLowsBR = 0.0;
|
||||
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
|
|
@ -55,11 +55,11 @@ private:
|
|||
char _programName[kVstMaxProgNameLen + 1];
|
||||
std::set< std::string > _canDo;
|
||||
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
long double lastSampleL;
|
||||
long double lastSampleR;
|
||||
double lastSampleL;
|
||||
double lastSampleR;
|
||||
float bL[22200];
|
||||
float bR[22200];
|
||||
int gcount;
|
||||
|
|
@ -69,8 +69,8 @@ private:
|
|||
double iirLowsAR;
|
||||
double iirLowsBL;
|
||||
double iirLowsBR;
|
||||
long double refclipL;
|
||||
long double refclipR;
|
||||
double refclipL;
|
||||
double refclipR;
|
||||
|
||||
float A;
|
||||
float B;
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ void ADClip7::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
|
|||
double overallscale = 1.0;
|
||||
overallscale /= 44100.0;
|
||||
overallscale *= getSampleRate();
|
||||
long double fpOld = 0.618033988749894848204586; //golden ratio!
|
||||
long double fpNew = 1.0 - fpOld;
|
||||
double fpOld = 0.618033988749894848204586; //golden ratio!
|
||||
double fpNew = 1.0 - fpOld;
|
||||
double inputGain = pow(10.0,(A*18.0)/20.0);
|
||||
double softness = B * fpNew;
|
||||
double hardness = 1.0 - softness;
|
||||
|
|
@ -28,7 +28,7 @@ void ADClip7::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
|
|||
double calibsubs = subslift/53;
|
||||
double invcalibsubs = 1.0 - calibsubs;
|
||||
double subs = 0.81 + (calibsubs*2);
|
||||
long double bridgerectifier;
|
||||
double bridgerectifier;
|
||||
int mode = (int) floor(D*2.999)+1;
|
||||
double overshootL;
|
||||
double overshootR;
|
||||
|
|
@ -55,51 +55,15 @@ void ADClip7::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
|
|||
double highsR = 0.0;
|
||||
int count = 0;
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
|
||||
|
||||
|
||||
|
|
@ -447,14 +411,14 @@ void ADClip7::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
|
|||
if (inputSampleR < -refclipR) inputSampleR = -refclipR;
|
||||
//final iron bar
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -476,8 +440,8 @@ void ADClip7::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
double overallscale = 1.0;
|
||||
overallscale /= 44100.0;
|
||||
overallscale *= getSampleRate();
|
||||
long double fpOld = 0.618033988749894848204586; //golden ratio!
|
||||
long double fpNew = 1.0 - fpOld;
|
||||
double fpOld = 0.618033988749894848204586; //golden ratio!
|
||||
double fpNew = 1.0 - fpOld;
|
||||
double inputGain = pow(10.0,(A*18.0)/20.0);
|
||||
double softness = B * fpNew;
|
||||
double hardness = 1.0 - softness;
|
||||
|
|
@ -487,7 +451,7 @@ void ADClip7::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
double calibsubs = subslift/53;
|
||||
double invcalibsubs = 1.0 - calibsubs;
|
||||
double subs = 0.81 + (calibsubs*2);
|
||||
long double bridgerectifier;
|
||||
double bridgerectifier;
|
||||
int mode = (int) floor(D*2.999)+1;
|
||||
double overshootL;
|
||||
double overshootR;
|
||||
|
|
@ -514,52 +478,16 @@ void ADClip7::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
double highsR = 0.0;
|
||||
int count = 0;
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
|
||||
|
||||
|
||||
|
|
@ -907,16 +835,14 @@ void ADClip7::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
if (inputSampleR < -refclipR) inputSampleR = -refclipR;
|
||||
//final iron bar
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ void ADT::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrame
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
|
|
@ -164,8 +164,8 @@ void ADT::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sam
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ AQuickVoiceClip::AQuickVoiceClip(audioMasterCallback audioMaster) :
|
|||
ataK4 = 0.886; //remainder of interpolated dry, adds up to 1.0
|
||||
ataK5 = 0.431; //subtract this much prev. diff sample, brightens. 0.431 becomes flat
|
||||
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
|
|
@ -115,8 +115,8 @@ private:
|
|||
double RiirSampleD;
|
||||
bool flip;
|
||||
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
|
||||
float A;
|
||||
|
|
|
|||
|
|
@ -42,51 +42,15 @@ void AQuickVoiceClip::processReplacing(float **inputs, float **outputs, VstInt32
|
|||
double RdrySample;
|
||||
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
LpassThrough = LataDrySample = inputSampleL;
|
||||
RpassThrough = RataDrySample = inputSampleR;
|
||||
|
||||
|
|
@ -407,14 +371,14 @@ void AQuickVoiceClip::processReplacing(float **inputs, float **outputs, VstInt32
|
|||
if (LlpDepth < 0.0) LlpDepth = 0.0;
|
||||
if (RlpDepth < 0.0) RlpDepth = 0.0;
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
inputSampleL *= (1.0-LmaxRecent);
|
||||
inputSampleR *= (1.0-RmaxRecent);
|
||||
|
|
@ -474,51 +438,15 @@ void AQuickVoiceClip::processDoubleReplacing(double **inputs, double **outputs,
|
|||
double RdrySample;
|
||||
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
LpassThrough = LataDrySample = inputSampleL;
|
||||
RpassThrough = RataDrySample = inputSampleR;
|
||||
|
||||
|
|
@ -839,16 +767,14 @@ void AQuickVoiceClip::processDoubleReplacing(double **inputs, double **outputs,
|
|||
if (LlpDepth < 0.0) LlpDepth = 0.0;
|
||||
if (RlpDepth < 0.0) RlpDepth = 0.0;
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
inputSampleL *= (1.0-LmaxRecent);
|
||||
inputSampleR *= (1.0-RmaxRecent);
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ Acceleration::Acceleration(audioMasterCallback audioMaster) :
|
|||
o1R = o2R = o3R = 0.0;
|
||||
m1R = m2R = desR = 0.0;
|
||||
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ private:
|
|||
char _programName[kVstMaxProgNameLen + 1];
|
||||
std::set< std::string > _canDo;
|
||||
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
double ataLastOutL;
|
||||
double s1L;
|
||||
|
|
|
|||
|
|
@ -29,51 +29,15 @@ void Acceleration::processReplacing(float **inputs, float **outputs, VstInt32 sa
|
|||
double accumulatorSample;
|
||||
double drySampleL;
|
||||
double drySampleR;
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
drySampleL = inputSampleL;
|
||||
drySampleR = inputSampleR;
|
||||
|
||||
|
|
@ -132,14 +96,14 @@ void Acceleration::processReplacing(float **inputs, float **outputs, VstInt32 sa
|
|||
inputSampleR = (inputSampleR * wet) + (drySampleR * dry);
|
||||
}
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -173,51 +137,15 @@ void Acceleration::processDoubleReplacing(double **inputs, double **outputs, Vst
|
|||
double accumulatorSample;
|
||||
double drySampleL;
|
||||
double drySampleR;
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
drySampleL = inputSampleL;
|
||||
drySampleR = inputSampleR;
|
||||
|
||||
|
|
@ -276,16 +204,14 @@ void Acceleration::processDoubleReplacing(double **inputs, double **outputs, Vst
|
|||
inputSampleR = (inputSampleR * wet) + (drySampleR * dry);
|
||||
}
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ private:
|
|||
double m1R;
|
||||
double m2R;
|
||||
|
||||
long double biquadA[11];
|
||||
long double biquadB[11]; //note that this stereo form doesn't require L and R forms!
|
||||
double biquadA[11];
|
||||
double biquadB[11]; //note that this stereo form doesn't require L and R forms!
|
||||
//This is because so much of it is coefficients etc. that are the same on both channels.
|
||||
//So the stored samples are in 7-8 and 9-10, and freq/res/coefficients serve both.
|
||||
|
||||
|
|
|
|||
|
|
@ -46,14 +46,14 @@ void Acceleration2::processReplacing(float **inputs, float **outputs, VstInt32 s
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpdL * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpdR * 1.18e-37;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
long double tempSample = (inputSampleL * biquadA[2]) + biquadA[7];
|
||||
double tempSample = (inputSampleL * biquadA[2]) + biquadA[7];
|
||||
biquadA[7] = (inputSampleL * biquadA[3]) - (tempSample * biquadA[5]) + biquadA[8];
|
||||
biquadA[8] = (inputSampleL * biquadA[4]) - (tempSample * biquadA[6]);
|
||||
double smoothL = tempSample; //like mono AU, 7 and 8 store L channel
|
||||
|
|
@ -151,14 +151,14 @@ void Acceleration2::processDoubleReplacing(double **inputs, double **outputs, Vs
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpdL * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpdR * 1.18e-43;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
long double tempSample = (inputSampleL * biquadA[2]) + biquadA[7];
|
||||
double tempSample = (inputSampleL * biquadA[2]) + biquadA[7];
|
||||
biquadA[7] = (inputSampleL * biquadA[3]) - (tempSample * biquadA[5]) + biquadA[8];
|
||||
biquadA[8] = (inputSampleL * biquadA[4]) - (tempSample * biquadA[6]);
|
||||
double smoothL = tempSample; //like mono AU, 7 and 8 store L channel
|
||||
|
|
@ -199,12 +199,12 @@ void Acceleration2::processDoubleReplacing(double **inputs, double **outputs, Vs
|
|||
}
|
||||
|
||||
//begin 64 bit stereo floating point dither
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
frexp((double)inputSampleR, &expon);
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ Air::Air(audioMasterCallback audioMaster) :
|
|||
D = 0.0;
|
||||
E = 1.0;
|
||||
F = 1.0;
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
|
|
@ -100,8 +100,8 @@ private:
|
|||
bool flop;
|
||||
int count;
|
||||
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
|
||||
float A;
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ void Air::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrame
|
|||
double dry = 1.0-wet;
|
||||
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
double drySampleL;
|
||||
double drySampleR;
|
||||
double correctionL;
|
||||
|
|
@ -34,44 +34,8 @@ void Air::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrame
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
drySampleL = inputSampleL;
|
||||
drySampleR = inputSampleR;
|
||||
|
||||
|
|
@ -257,14 +221,14 @@ void Air::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrame
|
|||
//nice little output stage template: if we have another scale of floating point
|
||||
//number, we really don't want to meaninglessly multiply that by 1.0.
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -292,8 +256,8 @@ void Air::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sam
|
|||
double dry = 1.0-wet;
|
||||
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
double drySampleL;
|
||||
double drySampleR;
|
||||
double correctionL;
|
||||
|
|
@ -303,44 +267,8 @@ void Air::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sam
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
drySampleL = inputSampleL;
|
||||
drySampleR = inputSampleR;
|
||||
|
||||
|
|
@ -526,16 +454,14 @@ void Air::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sam
|
|||
//nice little output stage template: if we have another scale of floating point
|
||||
//number, we really don't want to meaninglessly multiply that by 1.0.
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ private:
|
|||
bool flipB;
|
||||
bool flop;
|
||||
int count;
|
||||
long double postsine;
|
||||
double postsine;
|
||||
|
||||
|
||||
float A;
|
||||
|
|
|
|||
|
|
@ -44,17 +44,17 @@ void Air2::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpdL * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpdR * 1.18e-37;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
cycle++;
|
||||
if (cycle == cycleEnd) { //hit the end point and we do an Air sample
|
||||
long double correctionL = 0.0;
|
||||
long double correctionR = 0.0;
|
||||
double correctionL = 0.0;
|
||||
double correctionR = 0.0;
|
||||
if (fabs(hiIntensity) > 0.0001) {
|
||||
airFactorCL = airPrevCL - inputSampleL;
|
||||
airFactorCR = airPrevCR - inputSampleR;
|
||||
|
|
@ -190,7 +190,7 @@ void Air2::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram
|
|||
|
||||
correctionL *= intensity;
|
||||
correctionL -= 1.0;
|
||||
long double bridgerectifier = fabs(correctionL);
|
||||
double bridgerectifier = fabs(correctionL);
|
||||
if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633;
|
||||
bridgerectifier = sin(bridgerectifier);
|
||||
if (correctionL > 0) correctionL = bridgerectifier;
|
||||
|
|
@ -333,17 +333,17 @@ void Air2::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpdL * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpdR * 1.18e-43;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
cycle++;
|
||||
if (cycle == cycleEnd) { //hit the end point and we do an Air sample
|
||||
long double correctionL = 0.0;
|
||||
long double correctionR = 0.0;
|
||||
double correctionL = 0.0;
|
||||
double correctionR = 0.0;
|
||||
if (fabs(hiIntensity) > 0.0001) {
|
||||
airFactorCL = airPrevCL - inputSampleL;
|
||||
airFactorCR = airPrevCR - inputSampleR;
|
||||
|
|
@ -479,7 +479,7 @@ void Air2::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa
|
|||
|
||||
correctionL *= intensity;
|
||||
correctionL -= 1.0;
|
||||
long double bridgerectifier = fabs(correctionL);
|
||||
double bridgerectifier = fabs(correctionL);
|
||||
if (bridgerectifier > 1.57079633) bridgerectifier = 1.57079633;
|
||||
bridgerectifier = sin(bridgerectifier);
|
||||
if (correctionL > 0) correctionL = bridgerectifier;
|
||||
|
|
@ -568,12 +568,12 @@ void Air2::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa
|
|||
inputSampleR += drySampleR;
|
||||
|
||||
//begin 64 bit stereo floating point dither
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
frexp((double)inputSampleR, &expon);
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ void Apicolypse::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
|
||||
|
|
@ -213,8 +213,8 @@ void Apicolypse::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
|
||||
|
|
|
|||
|
|
@ -56,49 +56,49 @@ private:
|
|||
double settingchase;
|
||||
double chasespeed;
|
||||
|
||||
long double fpNShapeL;
|
||||
long double lastSampleAL;
|
||||
long double lastSampleBL;
|
||||
long double lastSampleCL;
|
||||
long double lastSampleDL;
|
||||
long double lastSampleEL;
|
||||
long double lastSampleFL;
|
||||
long double lastSampleGL;
|
||||
long double lastSampleHL;
|
||||
long double lastSampleIL;
|
||||
long double lastSampleJL;
|
||||
long double lastSampleKL;
|
||||
long double lastSampleLL;
|
||||
long double lastSampleML;
|
||||
double fpNShapeL;
|
||||
double lastSampleAL;
|
||||
double lastSampleBL;
|
||||
double lastSampleCL;
|
||||
double lastSampleDL;
|
||||
double lastSampleEL;
|
||||
double lastSampleFL;
|
||||
double lastSampleGL;
|
||||
double lastSampleHL;
|
||||
double lastSampleIL;
|
||||
double lastSampleJL;
|
||||
double lastSampleKL;
|
||||
double lastSampleLL;
|
||||
double lastSampleML;
|
||||
|
||||
long double fpNShapeR;
|
||||
long double lastSampleAR;
|
||||
long double lastSampleBR;
|
||||
long double lastSampleCR;
|
||||
long double lastSampleDR;
|
||||
long double lastSampleER;
|
||||
long double lastSampleFR;
|
||||
long double lastSampleGR;
|
||||
long double lastSampleHR;
|
||||
long double lastSampleIR;
|
||||
long double lastSampleJR;
|
||||
long double lastSampleKR;
|
||||
long double lastSampleLR;
|
||||
long double lastSampleMR;
|
||||
double fpNShapeR;
|
||||
double lastSampleAR;
|
||||
double lastSampleBR;
|
||||
double lastSampleCR;
|
||||
double lastSampleDR;
|
||||
double lastSampleER;
|
||||
double lastSampleFR;
|
||||
double lastSampleGR;
|
||||
double lastSampleHR;
|
||||
double lastSampleIR;
|
||||
double lastSampleJR;
|
||||
double lastSampleKR;
|
||||
double lastSampleLR;
|
||||
double lastSampleMR;
|
||||
|
||||
long double thresholdA;
|
||||
long double thresholdB;
|
||||
long double thresholdC;
|
||||
long double thresholdD;
|
||||
long double thresholdE;
|
||||
long double thresholdF;
|
||||
long double thresholdG;
|
||||
long double thresholdH;
|
||||
long double thresholdI;
|
||||
long double thresholdJ;
|
||||
long double thresholdK;
|
||||
long double thresholdL;
|
||||
long double thresholdM;
|
||||
double thresholdA;
|
||||
double thresholdB;
|
||||
double thresholdC;
|
||||
double thresholdD;
|
||||
double thresholdE;
|
||||
double thresholdF;
|
||||
double thresholdG;
|
||||
double thresholdH;
|
||||
double thresholdI;
|
||||
double thresholdJ;
|
||||
double thresholdK;
|
||||
double thresholdL;
|
||||
double thresholdM;
|
||||
|
||||
float A;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ void AtmosphereBuss::processReplacing(float **inputs, float **outputs, VstInt32
|
|||
overallscale *= getSampleRate();
|
||||
double drySampleL;
|
||||
double drySampleR;
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
long double clamp;
|
||||
double clamp;
|
||||
double inputgain = A;
|
||||
|
||||
if (settingchase != inputgain) {
|
||||
|
|
@ -249,14 +249,14 @@ void AtmosphereBuss::processReplacing(float **inputs, float **outputs, VstInt32
|
|||
lastSampleAR = drySampleR;
|
||||
//store the raw R input sample again for use next time
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -279,10 +279,10 @@ void AtmosphereBuss::processDoubleReplacing(double **inputs, double **outputs, V
|
|||
overallscale *= getSampleRate();
|
||||
double drySampleL;
|
||||
double drySampleR;
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
long double clamp;
|
||||
double clamp;
|
||||
double inputgain = A;
|
||||
|
||||
if (settingchase != inputgain) {
|
||||
|
|
@ -510,16 +510,14 @@ void AtmosphereBuss::processDoubleReplacing(double **inputs, double **outputs, V
|
|||
lastSampleAR = drySampleR;
|
||||
//store the raw R input sample again for use next time
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
|
|||
|
|
@ -56,49 +56,49 @@ private:
|
|||
double settingchase;
|
||||
double chasespeed;
|
||||
|
||||
long double fpNShapeL;
|
||||
long double lastSampleAL;
|
||||
long double lastSampleBL;
|
||||
long double lastSampleCL;
|
||||
long double lastSampleDL;
|
||||
long double lastSampleEL;
|
||||
long double lastSampleFL;
|
||||
long double lastSampleGL;
|
||||
long double lastSampleHL;
|
||||
long double lastSampleIL;
|
||||
long double lastSampleJL;
|
||||
long double lastSampleKL;
|
||||
long double lastSampleLL;
|
||||
long double lastSampleML;
|
||||
double fpNShapeL;
|
||||
double lastSampleAL;
|
||||
double lastSampleBL;
|
||||
double lastSampleCL;
|
||||
double lastSampleDL;
|
||||
double lastSampleEL;
|
||||
double lastSampleFL;
|
||||
double lastSampleGL;
|
||||
double lastSampleHL;
|
||||
double lastSampleIL;
|
||||
double lastSampleJL;
|
||||
double lastSampleKL;
|
||||
double lastSampleLL;
|
||||
double lastSampleML;
|
||||
|
||||
long double fpNShapeR;
|
||||
long double lastSampleAR;
|
||||
long double lastSampleBR;
|
||||
long double lastSampleCR;
|
||||
long double lastSampleDR;
|
||||
long double lastSampleER;
|
||||
long double lastSampleFR;
|
||||
long double lastSampleGR;
|
||||
long double lastSampleHR;
|
||||
long double lastSampleIR;
|
||||
long double lastSampleJR;
|
||||
long double lastSampleKR;
|
||||
long double lastSampleLR;
|
||||
long double lastSampleMR;
|
||||
double fpNShapeR;
|
||||
double lastSampleAR;
|
||||
double lastSampleBR;
|
||||
double lastSampleCR;
|
||||
double lastSampleDR;
|
||||
double lastSampleER;
|
||||
double lastSampleFR;
|
||||
double lastSampleGR;
|
||||
double lastSampleHR;
|
||||
double lastSampleIR;
|
||||
double lastSampleJR;
|
||||
double lastSampleKR;
|
||||
double lastSampleLR;
|
||||
double lastSampleMR;
|
||||
|
||||
long double thresholdA;
|
||||
long double thresholdB;
|
||||
long double thresholdC;
|
||||
long double thresholdD;
|
||||
long double thresholdE;
|
||||
long double thresholdF;
|
||||
long double thresholdG;
|
||||
long double thresholdH;
|
||||
long double thresholdI;
|
||||
long double thresholdJ;
|
||||
long double thresholdK;
|
||||
long double thresholdL;
|
||||
long double thresholdM;
|
||||
double thresholdA;
|
||||
double thresholdB;
|
||||
double thresholdC;
|
||||
double thresholdD;
|
||||
double thresholdE;
|
||||
double thresholdF;
|
||||
double thresholdG;
|
||||
double thresholdH;
|
||||
double thresholdI;
|
||||
double thresholdJ;
|
||||
double thresholdK;
|
||||
double thresholdL;
|
||||
double thresholdM;
|
||||
|
||||
float A;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ void AtmosphereChannel::processReplacing(float **inputs, float **outputs, VstInt
|
|||
overallscale *= getSampleRate();
|
||||
double drySampleL;
|
||||
double drySampleR;
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
long double clamp;
|
||||
double clamp;
|
||||
double inputgain = A;
|
||||
|
||||
if (settingchase != inputgain) {
|
||||
|
|
@ -244,14 +244,14 @@ void AtmosphereChannel::processReplacing(float **inputs, float **outputs, VstInt
|
|||
lastSampleAR = drySampleR;
|
||||
//store the raw R input sample again for use next time
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -274,10 +274,10 @@ void AtmosphereChannel::processDoubleReplacing(double **inputs, double **outputs
|
|||
overallscale *= getSampleRate();
|
||||
double drySampleL;
|
||||
double drySampleR;
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
long double clamp;
|
||||
double clamp;
|
||||
double inputgain = A;
|
||||
|
||||
if (settingchase != inputgain) {
|
||||
|
|
@ -500,16 +500,14 @@ void AtmosphereChannel::processDoubleReplacing(double **inputs, double **outputs
|
|||
lastSampleAR = drySampleR;
|
||||
//store the raw R input sample again for use next time
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ Aura::Aura(audioMasterCallback audioMaster) :
|
|||
lastSampleR = 0.0;
|
||||
previousVelocityR = 0.0;
|
||||
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
|
|
@ -53,12 +53,12 @@ private:
|
|||
char _programName[kVstMaxProgNameLen + 1];
|
||||
std::set< std::string > _canDo;
|
||||
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
long double lastSampleL;
|
||||
double lastSampleL;
|
||||
double previousVelocityL;
|
||||
long double lastSampleR;
|
||||
double lastSampleR;
|
||||
double previousVelocityR;
|
||||
|
||||
double bL[21];
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ void Aura::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram
|
|||
double overallscale = trim * 10.0;
|
||||
double gain = overallscale + (pow(wet,3) * 0.187859642462067);
|
||||
trim *= (1.0 - (pow(wet,3) * 0.187859642462067));
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
double drySampleL;
|
||||
double drySampleR;
|
||||
|
||||
|
|
@ -83,44 +83,8 @@ void Aura::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
drySampleL = inputSampleL;
|
||||
drySampleR = inputSampleR;
|
||||
|
||||
|
|
@ -208,14 +172,14 @@ void Aura::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram
|
|||
inputSampleR = (inputSampleR * wet) + (drySampleR * dry);
|
||||
}
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -247,8 +211,8 @@ void Aura::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa
|
|||
double overallscale = trim * 10.0;
|
||||
double gain = overallscale + (pow(wet,3) * 0.187859642462067);
|
||||
trim *= (1.0 - (pow(wet,3) * 0.187859642462067));
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
double drySampleL;
|
||||
double drySampleR;
|
||||
|
||||
|
|
@ -303,44 +267,8 @@ void Aura::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
drySampleL = inputSampleL;
|
||||
drySampleR = inputSampleR;
|
||||
|
||||
|
|
@ -428,16 +356,14 @@ void Aura::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa
|
|||
inputSampleR = (inputSampleR * wet) + (drySampleR * dry);
|
||||
}
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ void AutoPan::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpdL * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpdR * 1.18e-37;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
rate += (oldfpd*drift);
|
||||
if (rate > 6.283185307179586) {
|
||||
|
|
@ -44,8 +44,8 @@ void AutoPan::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
|
|||
inputSampleL *= (sin(rate)+1.0);
|
||||
inputSampleR *= (sin(rate+offset)+1.0);
|
||||
|
||||
long double mid = (inputSampleL + inputSampleR)*panlaw;
|
||||
long double side = inputSampleL - inputSampleR;
|
||||
double mid = (inputSampleL + inputSampleR)*panlaw;
|
||||
double side = inputSampleL - inputSampleR;
|
||||
//assign mid and side.Between these sections, you can do mid/side processing
|
||||
|
||||
inputSampleL = (mid+side)/4.0;
|
||||
|
|
@ -95,12 +95,12 @@ void AutoPan::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpdL * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpdR * 1.18e-43;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
rate += (oldfpd*drift);
|
||||
if (rate > 6.283185307179586) {
|
||||
|
|
@ -114,8 +114,8 @@ void AutoPan::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
inputSampleL *= (sin(rate)+1.0);
|
||||
inputSampleR *= (sin(rate+offset)+1.0);
|
||||
|
||||
long double mid = (inputSampleL + inputSampleR)*panlaw;
|
||||
long double side = inputSampleL - inputSampleR;
|
||||
double mid = (inputSampleL + inputSampleR)*panlaw;
|
||||
double side = inputSampleL - inputSampleR;
|
||||
//assign mid and side.Between these sections, you can do mid/side processing
|
||||
|
||||
inputSampleL = (mid+side)/4.0;
|
||||
|
|
@ -129,12 +129,12 @@ void AutoPan::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
//Dry/Wet control, defaults to the last slider
|
||||
|
||||
//begin 64 bit stereo floating point dither
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
frexp((double)inputSampleR, &expon);
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
|
|
|
|||
|
|
@ -48,15 +48,15 @@ void AverMatrix::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
long double previousPoleL = 0;
|
||||
long double previousPoleR = 0;
|
||||
double previousPoleL = 0;
|
||||
double previousPoleR = 0;
|
||||
for (int y = 0; y < yLimit; y++) {
|
||||
for (int x = xLimit; x >= 0; x--) {
|
||||
bL[x+1][y] = bL[x][y];
|
||||
|
|
@ -140,15 +140,15 @@ void AverMatrix::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
long double previousPoleL = 0;
|
||||
long double previousPoleR = 0;
|
||||
double previousPoleL = 0;
|
||||
double previousPoleR = 0;
|
||||
for (int y = 0; y < yLimit; y++) {
|
||||
for (int x = xLimit; x >= 0; x--) {
|
||||
bL[x+1][y] = bL[x][y];
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ Average::Average(audioMasterCallback audioMaster) :
|
|||
|
||||
for(int count = 0; count < 11; count++) {bL[count] = 0.0; bR[count] = 0.0; f[count] = 0.0;}
|
||||
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ private:
|
|||
double f[11];
|
||||
double bR[11];
|
||||
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
|
||||
float A;
|
||||
|
|
|
|||
|
|
@ -57,44 +57,8 @@ void Average::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
drySampleL = inputSampleL;
|
||||
drySampleR = inputSampleR;
|
||||
|
||||
|
|
@ -151,14 +115,14 @@ void Average::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
|
|||
//in the floating point system.
|
||||
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -218,44 +182,8 @@ void Average::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
drySampleL = inputSampleL;
|
||||
drySampleR = inputSampleR;
|
||||
|
||||
|
|
@ -311,16 +239,14 @@ void Average::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
//if it 'won't change anything' but our sample might be at a very different scaling
|
||||
//in the floating point system.
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ void BassAmp::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double LinputSample = *in1;
|
||||
long double RinputSample = *in2;
|
||||
double LinputSample = *in1;
|
||||
double RinputSample = *in2;
|
||||
if (fabs(LinputSample)<1.18e-37) LinputSample = fpd * 1.18e-37;
|
||||
if (fabs(RinputSample)<1.18e-37) RinputSample = fpd * 1.18e-37;
|
||||
|
||||
|
|
@ -408,8 +408,8 @@ void BassAmp::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double LinputSample = *in1;
|
||||
long double RinputSample = *in2;
|
||||
double LinputSample = *in1;
|
||||
double RinputSample = *in2;
|
||||
if (fabs(LinputSample)<1.18e-43) LinputSample = fpd * 1.18e-43;
|
||||
if (fabs(RinputSample)<1.18e-43) RinputSample = fpd * 1.18e-43;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ void BassDrive::processReplacing(float **inputs, float **outputs, VstInt32 sampl
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
|
||||
|
|
@ -349,8 +349,8 @@ void BassDrive::processDoubleReplacing(double **inputs, double **outputs, VstInt
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ BassKit::BassKit(audioMasterCallback audioMaster) :
|
|||
|
||||
oscGate = 1.0;
|
||||
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ private:
|
|||
double iirSampleZ;
|
||||
double oscGate;
|
||||
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
|
||||
float A;
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ void BassKit::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
|
||||
static int noisesourceL = 0;
|
||||
static int noisesourceR = 850010;
|
||||
|
|
@ -204,14 +204,14 @@ void BassKit::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
|
|||
bflip++;
|
||||
if (bflip < 1 || bflip > 3) bflip = 1;
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -249,8 +249,8 @@ void BassKit::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
|
||||
static int noisesourceL = 0;
|
||||
static int noisesourceR = 850010;
|
||||
|
|
@ -420,16 +420,14 @@ void BassKit::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
bflip++;
|
||||
if (bflip < 1 || bflip > 3) bflip = 1;
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
|
|||
|
|
@ -56,15 +56,15 @@ private:
|
|||
|
||||
uint32_t fpd;
|
||||
//default stuff
|
||||
long double trebleAL[9];
|
||||
long double trebleBL[9];
|
||||
long double bassAL[9];
|
||||
long double bassBL[9];
|
||||
double trebleAL[9];
|
||||
double trebleBL[9];
|
||||
double bassAL[9];
|
||||
double bassBL[9];
|
||||
|
||||
long double trebleAR[9];
|
||||
long double trebleBR[9];
|
||||
long double bassAR[9];
|
||||
long double bassBR[9];
|
||||
double trebleAR[9];
|
||||
double trebleBR[9];
|
||||
double bassAR[9];
|
||||
double bassBR[9];
|
||||
bool flip;
|
||||
|
||||
float A;
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ void Baxandall::processReplacing(float **inputs, float **outputs, VstInt32 sampl
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
|
||||
|
|
@ -59,10 +59,10 @@ void Baxandall::processReplacing(float **inputs, float **outputs, VstInt32 sampl
|
|||
inputSampleR = sin(inputSampleR);
|
||||
//encode Console5: good cleanness
|
||||
|
||||
long double trebleSampleL;
|
||||
long double bassSampleL;
|
||||
long double trebleSampleR;
|
||||
long double bassSampleR;
|
||||
double trebleSampleL;
|
||||
double bassSampleL;
|
||||
double trebleSampleR;
|
||||
double bassSampleR;
|
||||
|
||||
if (flip)
|
||||
{
|
||||
|
|
@ -182,8 +182,8 @@ void Baxandall::processDoubleReplacing(double **inputs, double **outputs, VstInt
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
|
||||
|
|
@ -196,10 +196,10 @@ void Baxandall::processDoubleReplacing(double **inputs, double **outputs, VstInt
|
|||
inputSampleR = sin(inputSampleR);
|
||||
//encode Console5: good cleanness
|
||||
|
||||
long double trebleSampleL;
|
||||
long double bassSampleL;
|
||||
long double trebleSampleR;
|
||||
long double bassSampleR;
|
||||
double trebleSampleL;
|
||||
double bassSampleL;
|
||||
double trebleSampleR;
|
||||
double bassSampleR;
|
||||
|
||||
if (flip)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ void Beam::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
|
|
@ -164,8 +164,8 @@ void Beam::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ private:
|
|||
char _programName[kVstMaxProgNameLen + 1];
|
||||
std::set< std::string > _canDo;
|
||||
|
||||
long double biquad[11]; //note that this stereo form doesn't require L and R forms!
|
||||
double biquad[11]; //note that this stereo form doesn't require L and R forms!
|
||||
//This is because so much of it is coefficients etc. that are the same on both channels.
|
||||
//So the stored samples are in 7-8 and 9-10, and freq/res/coefficients serve both.
|
||||
|
||||
|
|
|
|||
|
|
@ -88,12 +88,12 @@ void Biquad::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
|
||||
inputSampleL = sin(inputSampleL);
|
||||
|
|
@ -101,16 +101,16 @@ void Biquad::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
|
|||
//encode Console5: good cleanness
|
||||
|
||||
/*
|
||||
long double mid = inputSampleL + inputSampleR;
|
||||
long double side = inputSampleL - inputSampleR;
|
||||
double mid = inputSampleL + inputSampleR;
|
||||
double side = inputSampleL - inputSampleR;
|
||||
//assign mid and side.Between these sections, you can do mid/side processing
|
||||
|
||||
long double tempSampleM = (mid * biquad[2]) + biquad[7];
|
||||
double tempSampleM = (mid * biquad[2]) + biquad[7];
|
||||
biquad[7] = (mid * biquad[3]) - (tempSampleM * biquad[5]) + biquad[8];
|
||||
biquad[8] = (mid * biquad[4]) - (tempSampleM * biquad[6]);
|
||||
mid = tempSampleM; //like mono AU, 7 and 8 store mid channel
|
||||
|
||||
long double tempSampleS = (side * biquad[2]) + biquad[9];
|
||||
double tempSampleS = (side * biquad[2]) + biquad[9];
|
||||
biquad[9] = (side * biquad[3]) - (tempSampleS * biquad[5]) + biquad[10];
|
||||
biquad[10] = (side * biquad[4]) - (tempSampleS * biquad[6]);
|
||||
inputSampleR = tempSampleS; //note: 9 and 10 store the side channel
|
||||
|
|
@ -120,12 +120,12 @@ void Biquad::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
|
|||
//unassign mid and side
|
||||
*/
|
||||
|
||||
long double tempSampleL = (inputSampleL * biquad[2]) + biquad[7];
|
||||
double tempSampleL = (inputSampleL * biquad[2]) + biquad[7];
|
||||
biquad[7] = (inputSampleL * biquad[3]) - (tempSampleL * biquad[5]) + biquad[8];
|
||||
biquad[8] = (inputSampleL * biquad[4]) - (tempSampleL * biquad[6]);
|
||||
inputSampleL = tempSampleL; //like mono AU, 7 and 8 store L channel
|
||||
|
||||
long double tempSampleR = (inputSampleR * biquad[2]) + biquad[9];
|
||||
double tempSampleR = (inputSampleR * biquad[2]) + biquad[9];
|
||||
biquad[9] = (inputSampleR * biquad[3]) - (tempSampleR * biquad[5]) + biquad[10];
|
||||
biquad[10] = (inputSampleR * biquad[4]) - (tempSampleR * biquad[6]);
|
||||
inputSampleR = tempSampleR; //note: 9 and 10 store the R channel
|
||||
|
|
@ -245,12 +245,12 @@ void Biquad::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
|
||||
inputSampleL = sin(inputSampleL);
|
||||
|
|
@ -258,16 +258,16 @@ void Biquad::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
//encode Console5: good cleanness
|
||||
|
||||
/*
|
||||
long double mid = inputSampleL + inputSampleR;
|
||||
long double side = inputSampleL - inputSampleR;
|
||||
double mid = inputSampleL + inputSampleR;
|
||||
double side = inputSampleL - inputSampleR;
|
||||
//assign mid and side.Between these sections, you can do mid/side processing
|
||||
|
||||
long double tempSampleM = (mid * biquad[2]) + biquad[7];
|
||||
double tempSampleM = (mid * biquad[2]) + biquad[7];
|
||||
biquad[7] = (mid * biquad[3]) - (tempSampleM * biquad[5]) + biquad[8];
|
||||
biquad[8] = (mid * biquad[4]) - (tempSampleM * biquad[6]);
|
||||
mid = tempSampleM; //like mono AU, 7 and 8 store mid channel
|
||||
|
||||
long double tempSampleS = (side * biquad[2]) + biquad[9];
|
||||
double tempSampleS = (side * biquad[2]) + biquad[9];
|
||||
biquad[9] = (side * biquad[3]) - (tempSampleS * biquad[5]) + biquad[10];
|
||||
biquad[10] = (side * biquad[4]) - (tempSampleS * biquad[6]);
|
||||
inputSampleR = tempSampleS; //note: 9 and 10 store the side channel
|
||||
|
|
@ -277,12 +277,12 @@ void Biquad::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
//unassign mid and side
|
||||
*/
|
||||
|
||||
long double tempSampleL = (inputSampleL * biquad[2]) + biquad[7];
|
||||
double tempSampleL = (inputSampleL * biquad[2]) + biquad[7];
|
||||
biquad[7] = (inputSampleL * biquad[3]) - (tempSampleL * biquad[5]) + biquad[8];
|
||||
biquad[8] = (inputSampleL * biquad[4]) - (tempSampleL * biquad[6]);
|
||||
inputSampleL = tempSampleL; //like mono AU, 7 and 8 store L channel
|
||||
|
||||
long double tempSampleR = (inputSampleR * biquad[2]) + biquad[9];
|
||||
double tempSampleR = (inputSampleR * biquad[2]) + biquad[9];
|
||||
biquad[9] = (inputSampleR * biquad[3]) - (tempSampleR * biquad[5]) + biquad[10];
|
||||
biquad[10] = (inputSampleR * biquad[4]) - (tempSampleR * biquad[6]);
|
||||
inputSampleR = tempSampleR; //note: 9 and 10 store the R channel
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ private:
|
|||
char _programName[kVstMaxProgNameLen + 1];
|
||||
std::set< std::string > _canDo;
|
||||
|
||||
long double biquad[15]; //note that this stereo form doesn't require L and R forms!
|
||||
double biquad[15]; //note that this stereo form doesn't require L and R forms!
|
||||
//This is because so much of it is coefficients etc. that are the same on both channels.
|
||||
//So the stored samples are in 7-8-9-10 and 11-12-13-14, and freq/res/coefficients serve both.
|
||||
|
||||
|
|
|
|||
|
|
@ -79,12 +79,12 @@ void Biquad2::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
double chasespeed = 50000;
|
||||
if (frequencychase < frequencytarget) chasespeed = 500000;
|
||||
|
|
@ -134,10 +134,10 @@ void Biquad2::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
|
|||
inputSampleR = sin(inputSampleR);
|
||||
//encode Console5: good cleanness
|
||||
|
||||
long double outSampleL = biquad[2]*inputSampleL+biquad[3]*biquad[7]+biquad[4]*biquad[8]-biquad[5]*biquad[9]-biquad[6]*biquad[10];
|
||||
double outSampleL = biquad[2]*inputSampleL+biquad[3]*biquad[7]+biquad[4]*biquad[8]-biquad[5]*biquad[9]-biquad[6]*biquad[10];
|
||||
biquad[8] = biquad[7]; biquad[7] = inputSampleL; inputSampleL = outSampleL; biquad[10] = biquad[9]; biquad[9] = inputSampleL; //DF1 left
|
||||
|
||||
long double outSampleR = biquad[2]*inputSampleR+biquad[3]*biquad[11]+biquad[4]*biquad[12]-biquad[5]*biquad[13]-biquad[6]*biquad[14];
|
||||
double outSampleR = biquad[2]*inputSampleR+biquad[3]*biquad[11]+biquad[4]*biquad[12]-biquad[5]*biquad[13]-biquad[6]*biquad[14];
|
||||
biquad[12] = biquad[11]; biquad[11] = inputSampleR; inputSampleR = outSampleR; biquad[14] = biquad[13]; biquad[13] = inputSampleR; //DF1 right
|
||||
|
||||
if (inputSampleL > 1.0) inputSampleL = 1.0;
|
||||
|
|
@ -291,12 +291,12 @@ void Biquad2::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
double chasespeed = 50000;
|
||||
if (frequencychase < frequencytarget) chasespeed = 500000;
|
||||
|
|
@ -346,10 +346,10 @@ void Biquad2::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
inputSampleR = sin(inputSampleR);
|
||||
//encode Console5: good cleanness
|
||||
|
||||
long double outSampleL = biquad[2]*inputSampleL+biquad[3]*biquad[7]+biquad[4]*biquad[8]-biquad[5]*biquad[9]-biquad[6]*biquad[10];
|
||||
double outSampleL = biquad[2]*inputSampleL+biquad[3]*biquad[7]+biquad[4]*biquad[8]-biquad[5]*biquad[9]-biquad[6]*biquad[10];
|
||||
biquad[8] = biquad[7]; biquad[7] = inputSampleL; inputSampleL = outSampleL; biquad[10] = biquad[9]; biquad[9] = inputSampleL; //DF1 left
|
||||
|
||||
long double outSampleR = biquad[2]*inputSampleR+biquad[3]*biquad[11]+biquad[4]*biquad[12]-biquad[5]*biquad[13]-biquad[6]*biquad[14];
|
||||
double outSampleR = biquad[2]*inputSampleR+biquad[3]*biquad[11]+biquad[4]*biquad[12]-biquad[5]*biquad[13]-biquad[6]*biquad[14];
|
||||
biquad[12] = biquad[11]; biquad[11] = inputSampleR; inputSampleR = outSampleR; biquad[14] = biquad[13]; biquad[13] = inputSampleR; //DF1 right
|
||||
|
||||
if (inputSampleL > 1.0) inputSampleL = 1.0;
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ private:
|
|||
std::set< std::string > _canDo;
|
||||
|
||||
|
||||
long double biquadA[11];
|
||||
long double biquadB[11]; //note that this stereo form doesn't require L and R forms!
|
||||
double biquadA[11];
|
||||
double biquadB[11]; //note that this stereo form doesn't require L and R forms!
|
||||
//This is because so much of it is coefficients etc. that are the same on both channels.
|
||||
//So the stored samples are in 7-8 and 9-10, and freq/res/coefficients serve both.
|
||||
|
||||
|
|
|
|||
|
|
@ -89,24 +89,24 @@ void BiquadDouble::processReplacing(float **inputs, float **outputs, VstInt32 sa
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
|
||||
inputSampleL = sin(inputSampleL);
|
||||
inputSampleR = sin(inputSampleR);
|
||||
//encode Console5: good cleanness
|
||||
|
||||
long double tempSampleL = (inputSampleL * biquadA[2]) + biquadA[7];
|
||||
double tempSampleL = (inputSampleL * biquadA[2]) + biquadA[7];
|
||||
biquadA[7] = (inputSampleL * biquadA[3]) - (tempSampleL * biquadA[5]) + biquadA[8];
|
||||
biquadA[8] = (inputSampleL * biquadA[4]) - (tempSampleL * biquadA[6]);
|
||||
inputSampleL = tempSampleL; //like mono AU, 7 and 8 store L channel
|
||||
|
||||
long double tempSampleR = (inputSampleR * biquadA[2]) + biquadA[9];
|
||||
double tempSampleR = (inputSampleR * biquadA[2]) + biquadA[9];
|
||||
biquadA[9] = (inputSampleR * biquadA[3]) - (tempSampleR * biquadA[5]) + biquadA[10];
|
||||
biquadA[10] = (inputSampleR * biquadA[4]) - (tempSampleR * biquadA[6]);
|
||||
inputSampleR = tempSampleR; //note: 9 and 10 store the R channel
|
||||
|
|
@ -238,24 +238,24 @@ void BiquadDouble::processDoubleReplacing(double **inputs, double **outputs, Vst
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
|
||||
inputSampleL = sin(inputSampleL);
|
||||
inputSampleR = sin(inputSampleR);
|
||||
//encode Console5: good cleanness
|
||||
|
||||
long double tempSampleL = (inputSampleL * biquadA[2]) + biquadA[7];
|
||||
double tempSampleL = (inputSampleL * biquadA[2]) + biquadA[7];
|
||||
biquadA[7] = (inputSampleL * biquadA[3]) - (tempSampleL * biquadA[5]) + biquadA[8];
|
||||
biquadA[8] = (inputSampleL * biquadA[4]) - (tempSampleL * biquadA[6]);
|
||||
inputSampleL = tempSampleL; //like mono AU, 7 and 8 store L channel
|
||||
|
||||
long double tempSampleR = (inputSampleR * biquadA[2]) + biquadA[9];
|
||||
double tempSampleR = (inputSampleR * biquadA[2]) + biquadA[9];
|
||||
biquadA[9] = (inputSampleR * biquadA[3]) - (tempSampleR * biquadA[5]) + biquadA[10];
|
||||
biquadA[10] = (inputSampleR * biquadA[4]) - (tempSampleR * biquadA[6]);
|
||||
inputSampleR = tempSampleR; //note: 9 and 10 store the R channel
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ private:
|
|||
char _programName[kVstMaxProgNameLen + 1];
|
||||
std::set< std::string > _canDo;
|
||||
|
||||
long double biquadAL[9];
|
||||
long double biquadAR[9];
|
||||
long double biquadBL[9];
|
||||
long double biquadBR[9];
|
||||
double biquadAL[9];
|
||||
double biquadAR[9];
|
||||
double biquadBL[9];
|
||||
double biquadBR[9];
|
||||
bool flip;
|
||||
uint32_t fpd;
|
||||
//default stuff
|
||||
|
|
|
|||
|
|
@ -87,19 +87,19 @@ void BiquadOneHalf::processReplacing(float **inputs, float **outputs, VstInt32 s
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
inputSampleL = sin(inputSampleL);
|
||||
inputSampleR = sin(inputSampleR);
|
||||
//encode Console5: good cleanness
|
||||
|
||||
long double tempSampleL;
|
||||
long double tempSampleR;
|
||||
double tempSampleL;
|
||||
double tempSampleR;
|
||||
|
||||
if (flip)
|
||||
{
|
||||
|
|
@ -239,20 +239,20 @@ void BiquadOneHalf::processDoubleReplacing(double **inputs, double **outputs, Vs
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
|
||||
inputSampleL = sin(inputSampleL);
|
||||
inputSampleR = sin(inputSampleR);
|
||||
//encode Console5: good cleanness
|
||||
|
||||
long double tempSampleL;
|
||||
long double tempSampleR;
|
||||
double tempSampleL;
|
||||
double tempSampleR;
|
||||
|
||||
if (flip)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ private:
|
|||
biq_total
|
||||
};
|
||||
|
||||
long double biquad[biq_total];
|
||||
double biquad[biq_total];
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
|
|
|
|||
|
|
@ -107,20 +107,20 @@ void BiquadPlus::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpdL * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpdR * 1.18e-37;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
long double buf = (long double)sampleFrames/inFramesToProcess;
|
||||
double buf = (double)sampleFrames/inFramesToProcess;
|
||||
biquad[biq_a0] = (biquad[biq_aA0]*buf)+(biquad[biq_aB0]*(1.0-buf));
|
||||
biquad[biq_a1] = (biquad[biq_aA1]*buf)+(biquad[biq_aB1]*(1.0-buf));
|
||||
biquad[biq_a2] = (biquad[biq_aA2]*buf)+(biquad[biq_aB2]*(1.0-buf));
|
||||
biquad[biq_b1] = (biquad[biq_bA1]*buf)+(biquad[biq_bB1]*(1.0-buf));
|
||||
biquad[biq_b2] = (biquad[biq_bA2]*buf)+(biquad[biq_bB2]*(1.0-buf));
|
||||
long double tempSample = (inputSampleL * biquad[biq_a0]) + biquad[biq_sL1];
|
||||
double tempSample = (inputSampleL * biquad[biq_a0]) + biquad[biq_sL1];
|
||||
biquad[biq_sL1] = (inputSampleL * biquad[biq_a1]) - (tempSample * biquad[biq_b1]) + biquad[biq_sL2];
|
||||
biquad[biq_sL2] = (inputSampleL * biquad[biq_a2]) - (tempSample * biquad[biq_b2]);
|
||||
inputSampleL = tempSample;
|
||||
|
|
@ -239,20 +239,20 @@ void BiquadPlus::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpdL * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpdR * 1.18e-43;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
long double buf = (long double)sampleFrames/inFramesToProcess;
|
||||
double buf = (double)sampleFrames/inFramesToProcess;
|
||||
biquad[biq_a0] = (biquad[biq_aA0]*buf)+(biquad[biq_aB0]*(1.0-buf));
|
||||
biquad[biq_a1] = (biquad[biq_aA1]*buf)+(biquad[biq_aB1]*(1.0-buf));
|
||||
biquad[biq_a2] = (biquad[biq_aA2]*buf)+(biquad[biq_aB2]*(1.0-buf));
|
||||
biquad[biq_b1] = (biquad[biq_bA1]*buf)+(biquad[biq_bB1]*(1.0-buf));
|
||||
biquad[biq_b2] = (biquad[biq_bA2]*buf)+(biquad[biq_bB2]*(1.0-buf));
|
||||
long double tempSample = (inputSampleL * biquad[biq_a0]) + biquad[biq_sL1];
|
||||
double tempSample = (inputSampleL * biquad[biq_a0]) + biquad[biq_sL1];
|
||||
biquad[biq_sL1] = (inputSampleL * biquad[biq_a1]) - (tempSample * biquad[biq_b1]) + biquad[biq_sL2];
|
||||
biquad[biq_sL2] = (inputSampleL * biquad[biq_a2]) - (tempSample * biquad[biq_b2]);
|
||||
inputSampleL = tempSample;
|
||||
|
|
@ -268,12 +268,12 @@ void BiquadPlus::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
}
|
||||
|
||||
//begin 64 bit stereo floating point dither
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
frexp((double)inputSampleR, &expon);
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
|
|
|
|||
|
|
@ -55,9 +55,9 @@ private:
|
|||
char _programName[kVstMaxProgNameLen + 1];
|
||||
std::set< std::string > _canDo;
|
||||
|
||||
long double biquadA[11];
|
||||
long double biquadB[11];
|
||||
long double biquadC[11]; //note that this stereo form doesn't require L and R forms!
|
||||
double biquadA[11];
|
||||
double biquadB[11];
|
||||
double biquadC[11]; //note that this stereo form doesn't require L and R forms!
|
||||
//This is because so much of it is coefficients etc. that are the same on both channels.
|
||||
//So the stored samples are in 7-8 and 9-10, and freq/res/coefficients serve both.
|
||||
|
||||
|
|
|
|||
|
|
@ -90,24 +90,24 @@ void BiquadTriple::processReplacing(float **inputs, float **outputs, VstInt32 sa
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
|
||||
inputSampleL = sin(inputSampleL);
|
||||
inputSampleR = sin(inputSampleR);
|
||||
//encode Console5: good cleanness
|
||||
|
||||
long double tempSampleL = (inputSampleL * biquadA[2]) + biquadA[7];
|
||||
double tempSampleL = (inputSampleL * biquadA[2]) + biquadA[7];
|
||||
biquadA[7] = (inputSampleL * biquadA[3]) - (tempSampleL * biquadA[5]) + biquadA[8];
|
||||
biquadA[8] = (inputSampleL * biquadA[4]) - (tempSampleL * biquadA[6]);
|
||||
inputSampleL = tempSampleL; //like mono AU, 7 and 8 store L channel
|
||||
|
||||
long double tempSampleR = (inputSampleR * biquadA[2]) + biquadA[9];
|
||||
double tempSampleR = (inputSampleR * biquadA[2]) + biquadA[9];
|
||||
biquadA[9] = (inputSampleR * biquadA[3]) - (tempSampleR * biquadA[5]) + biquadA[10];
|
||||
biquadA[10] = (inputSampleR * biquadA[4]) - (tempSampleR * biquadA[6]);
|
||||
inputSampleR = tempSampleR; //note: 9 and 10 store the R channel
|
||||
|
|
@ -251,23 +251,23 @@ void BiquadTriple::processDoubleReplacing(double **inputs, double **outputs, Vst
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
inputSampleL = sin(inputSampleL);
|
||||
inputSampleR = sin(inputSampleR);
|
||||
//encode Console5: good cleanness
|
||||
|
||||
long double tempSampleL = (inputSampleL * biquadA[2]) + biquadA[7];
|
||||
double tempSampleL = (inputSampleL * biquadA[2]) + biquadA[7];
|
||||
biquadA[7] = (inputSampleL * biquadA[3]) - (tempSampleL * biquadA[5]) + biquadA[8];
|
||||
biquadA[8] = (inputSampleL * biquadA[4]) - (tempSampleL * biquadA[6]);
|
||||
inputSampleL = tempSampleL; //like mono AU, 7 and 8 store L channel
|
||||
|
||||
long double tempSampleR = (inputSampleR * biquadA[2]) + biquadA[9];
|
||||
double tempSampleR = (inputSampleR * biquadA[2]) + biquadA[9];
|
||||
biquadA[9] = (inputSampleR * biquadA[3]) - (tempSampleR * biquadA[5]) + biquadA[10];
|
||||
biquadA[10] = (inputSampleR * biquadA[4]) - (tempSampleR * biquadA[6]);
|
||||
inputSampleR = tempSampleR; //note: 9 and 10 store the R channel
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@ void BitGlitter::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
|
||||
//first, the distortion section
|
||||
|
|
@ -68,7 +68,7 @@ void BitGlitter::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
|
||||
//begin raw sample L
|
||||
positionAL += rateA;
|
||||
long double outputSampleL = heldSampleAL;
|
||||
double outputSampleL = heldSampleAL;
|
||||
if (positionAL > 1.0)
|
||||
{
|
||||
positionAL -= 1.0;
|
||||
|
|
@ -97,7 +97,7 @@ void BitGlitter::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
|
||||
//begin raw sample R
|
||||
positionAR += rateA;
|
||||
long double outputSampleR = heldSampleAR;
|
||||
double outputSampleR = heldSampleAR;
|
||||
if (positionAR > 1.0)
|
||||
{
|
||||
positionAR -= 1.0;
|
||||
|
|
@ -252,12 +252,12 @@ void BitGlitter::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
//first, the distortion section
|
||||
inputSampleL *= ingain;
|
||||
|
|
@ -287,7 +287,7 @@ void BitGlitter::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
|
||||
//begin raw sample L
|
||||
positionAL += rateA;
|
||||
long double outputSampleL = heldSampleAL;
|
||||
double outputSampleL = heldSampleAL;
|
||||
if (positionAL > 1.0)
|
||||
{
|
||||
positionAL -= 1.0;
|
||||
|
|
@ -316,7 +316,7 @@ void BitGlitter::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
|
||||
//begin raw sample R
|
||||
positionAR += rateA;
|
||||
long double outputSampleR = heldSampleAR;
|
||||
double outputSampleR = heldSampleAR;
|
||||
if (positionAR > 1.0)
|
||||
{
|
||||
positionAR -= 1.0;
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ Bite::Bite(audioMasterCallback audioMaster) :
|
|||
sampleHR = 0.0;
|
||||
sampleIR = 0.0;
|
||||
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ private:
|
|||
char _programName[kVstMaxProgNameLen + 1];
|
||||
std::set< std::string > _canDo;
|
||||
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
double sampleAL;
|
||||
double sampleBL;
|
||||
|
|
|
|||
|
|
@ -50,44 +50,8 @@ void Bite::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram
|
|||
sampleBR = sampleAR;
|
||||
sampleAR = *in2;
|
||||
//rotate the buffer in primitive fashion
|
||||
if (sampleAL<1.2e-38 && -sampleAL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
sampleAL = applyresidue;
|
||||
}
|
||||
if (sampleAR<1.2e-38 && -sampleAR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
sampleAR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(sampleAL)<1.18e-23) sampleAL = fpdL * 1.18e-17;
|
||||
if (fabs(sampleAR)<1.18e-23) sampleAR = fpdR * 1.18e-17;
|
||||
|
||||
midA = sampleAL - sampleEL;
|
||||
midB = sampleIL - sampleEL;
|
||||
|
|
@ -116,14 +80,14 @@ void Bite::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram
|
|||
inputSampleR *= outputgain;
|
||||
}
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -178,44 +142,8 @@ void Bite::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa
|
|||
sampleBR = sampleAR;
|
||||
sampleAR = *in2;
|
||||
//rotate the buffer in primitive fashion
|
||||
if (sampleAL<1.2e-38 && -sampleAL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
sampleAL = applyresidue;
|
||||
}
|
||||
if (sampleAR<1.2e-38 && -sampleAR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
sampleAR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(sampleAL)<1.18e-23) sampleAL = fpdL * 1.18e-17;
|
||||
if (fabs(sampleAR)<1.18e-23) sampleAR = fpdR * 1.18e-17;
|
||||
|
||||
midA = sampleAL - sampleEL;
|
||||
midB = sampleIL - sampleEL;
|
||||
|
|
@ -244,16 +172,14 @@ void Bite::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa
|
|||
inputSampleR *= outputgain;
|
||||
}
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ void BlockParty::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
|
||||
static int noisesourceL = 0;
|
||||
static int noisesourceR = 850010;
|
||||
|
|
@ -68,8 +68,8 @@ void BlockParty::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
}
|
||||
//for live air, we always apply the dither noise. Then, if our result is
|
||||
//effectively digital black, we'll subtract it again. We want a 'air' hiss
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
double muMakeupGainL = 1.0 / thresholdL;
|
||||
double outMakeupGainL = sqrt(muMakeupGainL);
|
||||
|
|
@ -590,8 +590,8 @@ void BlockParty::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
|
||||
static int noisesourceL = 0;
|
||||
static int noisesourceR = 850010;
|
||||
|
|
@ -629,8 +629,8 @@ void BlockParty::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
}
|
||||
//for live air, we always apply the dither noise. Then, if our result is
|
||||
//effectively digital black, we'll subtract it again. We want a 'air' hiss
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
double muMakeupGainL = 1.0 / thresholdL;
|
||||
double outMakeupGainL = sqrt(muMakeupGainL);
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ void BrassRider::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
|
||||
static int noisesourceL = 0;
|
||||
static int noisesourceR = 850010;
|
||||
|
|
@ -60,8 +60,8 @@ void BrassRider::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
}
|
||||
//for live air, we always apply the dither noise. Then, if our result is
|
||||
//effectively digital black, we'll subtract it again. We want a 'air' hiss
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
inputSampleL *= limitOut;
|
||||
highIIRL = (highIIRL*0.5);
|
||||
|
|
@ -70,7 +70,7 @@ void BrassRider::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
highIIR2L = (highIIR2L*0.5);
|
||||
highIIR2L += (inputSampleL*0.5);
|
||||
inputSampleL -= highIIR2L;
|
||||
long double slewSampleL = fabs(inputSampleL - lastSampleL);
|
||||
double slewSampleL = fabs(inputSampleL - lastSampleL);
|
||||
lastSampleL = inputSampleL;
|
||||
slewSampleL /= fabs(inputSampleL * lastSampleL)+0.2;
|
||||
slewIIRL = (slewIIRL*0.5);
|
||||
|
|
@ -79,7 +79,7 @@ void BrassRider::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
slewIIR2L = (slewIIR2L*0.5);
|
||||
slewIIR2L += (slewSampleL*0.5);
|
||||
slewSampleL = fabs(slewSampleL - slewIIR2L);
|
||||
long double bridgerectifier = slewSampleL;
|
||||
double bridgerectifier = slewSampleL;
|
||||
//there's the left channel, now to feed it to overall clamp
|
||||
|
||||
if (bridgerectifier > 3.1415) bridgerectifier = 0.0;
|
||||
|
|
@ -102,7 +102,7 @@ void BrassRider::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
highIIR2R = (highIIR2R*0.5);
|
||||
highIIR2R += (inputSampleR*0.5);
|
||||
inputSampleR -= highIIR2R;
|
||||
long double slewSampleR = fabs(inputSampleR - lastSampleR);
|
||||
double slewSampleR = fabs(inputSampleR - lastSampleR);
|
||||
lastSampleR = inputSampleR;
|
||||
slewSampleR /= fabs(inputSampleR * lastSampleR)+0.2;
|
||||
slewIIRR = (slewIIRR*0.5);
|
||||
|
|
@ -163,8 +163,8 @@ void BrassRider::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
|
||||
static int noisesourceL = 0;
|
||||
static int noisesourceR = 850010;
|
||||
|
|
@ -202,8 +202,8 @@ void BrassRider::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
}
|
||||
//for live air, we always apply the dither noise. Then, if our result is
|
||||
//effectively digital black, we'll subtract it again. We want a 'air' hiss
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
inputSampleL *= limitOut;
|
||||
highIIRL = (highIIRL*0.5);
|
||||
|
|
@ -212,7 +212,7 @@ void BrassRider::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
highIIR2L = (highIIR2L*0.5);
|
||||
highIIR2L += (inputSampleL*0.5);
|
||||
inputSampleL -= highIIR2L;
|
||||
long double slewSampleL = fabs(inputSampleL - lastSampleL);
|
||||
double slewSampleL = fabs(inputSampleL - lastSampleL);
|
||||
lastSampleL = inputSampleL;
|
||||
slewSampleL /= fabs(inputSampleL * lastSampleL)+0.2;
|
||||
slewIIRL = (slewIIRL*0.5);
|
||||
|
|
@ -221,7 +221,7 @@ void BrassRider::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
slewIIR2L = (slewIIR2L*0.5);
|
||||
slewIIR2L += (slewSampleL*0.5);
|
||||
slewSampleL = fabs(slewSampleL - slewIIR2L);
|
||||
long double bridgerectifier = slewSampleL;
|
||||
double bridgerectifier = slewSampleL;
|
||||
//there's the left channel, now to feed it to overall clamp
|
||||
|
||||
if (bridgerectifier > 3.1415) bridgerectifier = 0.0;
|
||||
|
|
@ -244,7 +244,7 @@ void BrassRider::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
highIIR2R = (highIIR2R*0.5);
|
||||
highIIR2R += (inputSampleR*0.5);
|
||||
inputSampleR -= highIIR2R;
|
||||
long double slewSampleR = fabs(inputSampleR - lastSampleR);
|
||||
double slewSampleR = fabs(inputSampleR - lastSampleR);
|
||||
lastSampleR = inputSampleR;
|
||||
slewSampleR /= fabs(inputSampleR * lastSampleR)+0.2;
|
||||
slewIIRR = (slewIIRR*0.5);
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ void BrightAmbience::processReplacing(float **inputs, float **outputs, VstInt32
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
|
||||
|
|
@ -174,7 +174,7 @@ void BrightAmbience::processReplacing(float **inputs, float **outputs, VstInt32
|
|||
temp += pL[count+121]; temp += pL[count+109]; temp += pL[count+73]; temp += pL[count+47]; temp += pL[count+41]; temp += pL[count+19]; temp += pL[count+11];
|
||||
//Highest Offset = 12679: gcount limit is 12680, Reset() goes to 25360, definition in .h must be p[25361]
|
||||
}
|
||||
inputSampleL = (inputSampleL*(1-wet))+((long double)(temp/(8388352.0*scale))*wet);
|
||||
inputSampleL = (inputSampleL*(1-wet))+((double)(temp/(8388352.0*scale))*wet);
|
||||
//end L
|
||||
|
||||
//begin R
|
||||
|
|
@ -315,7 +315,7 @@ void BrightAmbience::processReplacing(float **inputs, float **outputs, VstInt32
|
|||
temp += pR[count+121]; temp += pR[count+109]; temp += pR[count+73]; temp += pR[count+47]; temp += pR[count+41]; temp += pR[count+19]; temp += pR[count+11];
|
||||
//Highest Offset = 12679: gcount limit is 12680, Reset() goes to 25360, definition in .h must be p[25361]
|
||||
}
|
||||
inputSampleR = (inputSampleR*(1-wet))+((long double)(temp/(8388352.0*scale))*wet);
|
||||
inputSampleR = (inputSampleR*(1-wet))+((double)(temp/(8388352.0*scale))*wet);
|
||||
//end R
|
||||
|
||||
gcount--;
|
||||
|
|
@ -355,8 +355,8 @@ void BrightAmbience::processDoubleReplacing(double **inputs, double **outputs, V
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
|
||||
|
|
@ -506,7 +506,7 @@ void BrightAmbience::processDoubleReplacing(double **inputs, double **outputs, V
|
|||
temp += pL[count+121]; temp += pL[count+109]; temp += pL[count+73]; temp += pL[count+47]; temp += pL[count+41]; temp += pL[count+19]; temp += pL[count+11];
|
||||
//Highest Offset = 12679: gcount limit is 12680, Reset() goes to 25360, definition in .h must be p[25361]
|
||||
}
|
||||
inputSampleL = (inputSampleL*(1-wet))+((long double)(temp/(8388352.0*scale))*wet);
|
||||
inputSampleL = (inputSampleL*(1-wet))+((double)(temp/(8388352.0*scale))*wet);
|
||||
//end L
|
||||
|
||||
//begin R
|
||||
|
|
@ -647,7 +647,7 @@ void BrightAmbience::processDoubleReplacing(double **inputs, double **outputs, V
|
|||
temp += pR[count+121]; temp += pR[count+109]; temp += pR[count+73]; temp += pR[count+47]; temp += pR[count+41]; temp += pR[count+19]; temp += pR[count+11];
|
||||
//Highest Offset = 12679: gcount limit is 12680, Reset() goes to 25360, definition in .h must be p[25361]
|
||||
}
|
||||
inputSampleR = (inputSampleR*(1-wet))+((long double)(temp/(8388352.0*scale))*wet);
|
||||
inputSampleR = (inputSampleR*(1-wet))+((double)(temp/(8388352.0*scale))*wet);
|
||||
//end R
|
||||
|
||||
gcount--;
|
||||
|
|
|
|||
|
|
@ -64,9 +64,9 @@ private:
|
|||
int gcount;
|
||||
float pL[32768];
|
||||
float pR[32768];
|
||||
long double feedbackA;
|
||||
long double feedbackB;
|
||||
long double feedbackC;
|
||||
double feedbackA;
|
||||
double feedbackB;
|
||||
double feedbackC;
|
||||
|
||||
float A;
|
||||
float B;
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@ void BrightAmbience2::processReplacing(float **inputs, float **outputs, VstInt32
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
long double tempL = 0.0;
|
||||
long double tempR = 0.0;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
double tempL = 0.0;
|
||||
double tempR = 0.0;
|
||||
|
||||
if (gcount < 0 || gcount > 32767) gcount = 32767;
|
||||
int count = gcount;
|
||||
|
|
@ -90,14 +90,14 @@ void BrightAmbience2::processDoubleReplacing(double **inputs, double **outputs,
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
long double tempL = 0.0;
|
||||
long double tempR = 0.0;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
double tempL = 0.0;
|
||||
double tempR = 0.0;
|
||||
|
||||
if (gcount < 0 || gcount > 32767) gcount = 32767;
|
||||
int count = gcount;
|
||||
|
|
|
|||
|
|
@ -62,10 +62,10 @@ private:
|
|||
int gcount;
|
||||
double pL[32768];
|
||||
double pR[32768];
|
||||
long double feedbackA;
|
||||
long double feedbackB;
|
||||
long double figureL[9];
|
||||
long double figureR[9];
|
||||
double feedbackA;
|
||||
double feedbackB;
|
||||
double figureL[9];
|
||||
double figureR[9];
|
||||
double lastRefL[10];
|
||||
double lastRefR[10];
|
||||
int cycle;
|
||||
|
|
|
|||
|
|
@ -43,17 +43,17 @@ void BrightAmbience3::processReplacing(float **inputs, float **outputs, VstInt32
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpdL * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpdR * 1.18e-37;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
cycle++;
|
||||
if (cycle == cycleEnd) { //hit the end point and we do an Air sample
|
||||
long double tempL = 0.0;
|
||||
long double tempR = 0.0;
|
||||
double tempL = 0.0;
|
||||
double tempR = 0.0;
|
||||
if (gcount < 0 || gcount > 32767) gcount = 32767; int count = gcount;
|
||||
|
||||
pL[count] = inputSampleL + feedbackB;
|
||||
|
|
@ -67,7 +67,7 @@ void BrightAmbience3::processReplacing(float **inputs, float **outputs, VstInt32
|
|||
inputSampleL = tempL/cbrt(length);
|
||||
inputSampleR = tempR/cbrt(length);
|
||||
|
||||
long double tempSample = (inputSampleL * figureL[2]) + figureL[7];
|
||||
double tempSample = (inputSampleL * figureL[2]) + figureL[7];
|
||||
figureL[7] = -(tempSample * figureL[5]) + figureL[8];
|
||||
figureL[8] = (inputSampleL * figureL[4]) - (tempSample * figureL[6]);
|
||||
feedbackA = sin(tempSample) * feedbackAmount;
|
||||
|
|
@ -202,17 +202,17 @@ void BrightAmbience3::processDoubleReplacing(double **inputs, double **outputs,
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpdL * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpdR * 1.18e-43;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
cycle++;
|
||||
if (cycle == cycleEnd) { //hit the end point and we do an Air sample
|
||||
long double tempL = 0.0;
|
||||
long double tempR = 0.0;
|
||||
double tempL = 0.0;
|
||||
double tempR = 0.0;
|
||||
if (gcount < 0 || gcount > 32767) gcount = 32767; int count = gcount;
|
||||
|
||||
pL[count] = inputSampleL + feedbackB;
|
||||
|
|
@ -226,7 +226,7 @@ void BrightAmbience3::processDoubleReplacing(double **inputs, double **outputs,
|
|||
inputSampleL = tempL/cbrt(length);
|
||||
inputSampleR = tempR/cbrt(length);
|
||||
|
||||
long double tempSample = (inputSampleL * figureL[2]) + figureL[7];
|
||||
double tempSample = (inputSampleL * figureL[2]) + figureL[7];
|
||||
figureL[7] = -(tempSample * figureL[5]) + figureL[8];
|
||||
figureL[8] = (inputSampleL * figureL[4]) - (tempSample * figureL[6]);
|
||||
feedbackA = sin(tempSample) * feedbackAmount;
|
||||
|
|
@ -307,12 +307,12 @@ void BrightAmbience3::processDoubleReplacing(double **inputs, double **outputs,
|
|||
//Dry/Wet control, defaults to the last slider
|
||||
|
||||
//begin 64 bit stereo floating point dither
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
frexp((double)inputSampleR, &expon);
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
|
|
|
|||
|
|
@ -32,44 +32,8 @@ void BuildATPDF::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
|
||||
inputSampleL *= 8388608.0;
|
||||
inputSampleR *= 8388608.0;
|
||||
|
|
@ -149,44 +113,8 @@ void BuildATPDF::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
|
||||
inputSampleL *= 8388608.0;
|
||||
inputSampleR *= 8388608.0;
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ BussColors4::BussColors4(audioMasterCallback audioMaster) :
|
|||
slowdynR = 0;
|
||||
gcount = 0;
|
||||
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ private:
|
|||
double slowdynR;
|
||||
int gcount;
|
||||
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
|
||||
float A;
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ void BussColors4::processReplacing(float **inputs, float **outputs, VstInt32 sam
|
|||
double outgain = 1.0;
|
||||
double bridgerectifier;
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
int console = (int)( A * 7.999 )+1; //the AU used a 1-8 index, will just keep it
|
||||
switch (console)
|
||||
|
|
@ -58,44 +58,8 @@ void BussColors4::processReplacing(float **inputs, float **outputs, VstInt32 sam
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
drySampleL = inputSampleL;
|
||||
drySampleR = inputSampleR;
|
||||
|
||||
|
|
@ -792,14 +756,14 @@ void BussColors4::processReplacing(float **inputs, float **outputs, VstInt32 sam
|
|||
inputSampleR = (inputSampleR * wet) + (drySampleR * dry);
|
||||
}
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -836,8 +800,8 @@ void BussColors4::processDoubleReplacing(double **inputs, double **outputs, VstI
|
|||
double outgain = 1.0;
|
||||
double bridgerectifier;
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
int console = (int)( A * 7.999 )+1; //the AU used a 1-8 index, will just keep it
|
||||
switch (console)
|
||||
|
|
@ -862,44 +826,8 @@ void BussColors4::processDoubleReplacing(double **inputs, double **outputs, VstI
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
drySampleL = inputSampleL;
|
||||
drySampleR = inputSampleR;
|
||||
|
||||
|
|
@ -1596,16 +1524,14 @@ void BussColors4::processDoubleReplacing(double **inputs, double **outputs, VstI
|
|||
inputSampleR = (inputSampleR * wet) + (drySampleR * dry);
|
||||
}
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ ButterComp::ButterComp(audioMasterCallback audioMaster) :
|
|||
controlBnegR = 1.0;
|
||||
targetposR = 1.0;
|
||||
targetnegR = 1.0;
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ private:
|
|||
double controlBnegR;
|
||||
double targetposR;
|
||||
double targetnegR;
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
|
||||
float A;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ void ButterComp::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
double calcnegL;
|
||||
double outputposL;
|
||||
double outputnegL;
|
||||
long double totalmultiplierL;
|
||||
long double inputSampleL;
|
||||
double totalmultiplierL;
|
||||
double inputSampleL;
|
||||
double drySampleL;
|
||||
|
||||
double inputposR;
|
||||
|
|
@ -34,8 +34,8 @@ void ButterComp::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
double calcnegR;
|
||||
double outputposR;
|
||||
double outputnegR;
|
||||
long double totalmultiplierR;
|
||||
long double inputSampleR;
|
||||
double totalmultiplierR;
|
||||
double inputSampleR;
|
||||
double drySampleR;
|
||||
|
||||
double inputgain = pow(10.0,(A*14.0)/20.0);
|
||||
|
|
@ -54,44 +54,8 @@ void ButterComp::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
drySampleL = inputSampleL;
|
||||
drySampleR = inputSampleR;
|
||||
|
||||
|
|
@ -178,14 +142,14 @@ void ButterComp::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
inputSampleR = (inputSampleR * wet) + (drySampleR * dry);
|
||||
}
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -214,8 +178,8 @@ void ButterComp::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
double calcnegL;
|
||||
double outputposL;
|
||||
double outputnegL;
|
||||
long double totalmultiplierL;
|
||||
long double inputSampleL;
|
||||
double totalmultiplierL;
|
||||
double inputSampleL;
|
||||
double drySampleL;
|
||||
|
||||
double inputposR;
|
||||
|
|
@ -224,8 +188,8 @@ void ButterComp::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
double calcnegR;
|
||||
double outputposR;
|
||||
double outputnegR;
|
||||
long double totalmultiplierR;
|
||||
long double inputSampleR;
|
||||
double totalmultiplierR;
|
||||
double inputSampleR;
|
||||
double drySampleR;
|
||||
|
||||
double inputgain = pow(10.0,(A*14.0)/20.0);
|
||||
|
|
@ -244,44 +208,8 @@ void ButterComp::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
drySampleL = inputSampleL;
|
||||
drySampleR = inputSampleR;
|
||||
|
||||
|
|
@ -368,16 +296,14 @@ void ButterComp::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
inputSampleR = (inputSampleR * wet) + (drySampleR * dry);
|
||||
}
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ ButterComp2::ButterComp2(audioMasterCallback audioMaster) :
|
|||
A = 0.0;
|
||||
B = 0.5;
|
||||
C = 1.0;
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
|
|
@ -54,23 +54,23 @@ private:
|
|||
char _programName[kVstMaxProgNameLen + 1];
|
||||
std::set< std::string > _canDo;
|
||||
|
||||
long double controlAposL;
|
||||
long double controlAnegL;
|
||||
long double controlBposL;
|
||||
long double controlBnegL;
|
||||
long double targetposL;
|
||||
long double targetnegL;
|
||||
long double lastOutputL;
|
||||
long double controlAposR;
|
||||
long double controlAnegR;
|
||||
long double controlBposR;
|
||||
long double controlBnegR;
|
||||
long double targetposR;
|
||||
long double targetnegR;
|
||||
long double lastOutputR;
|
||||
double controlAposL;
|
||||
double controlAnegL;
|
||||
double controlBposL;
|
||||
double controlBnegL;
|
||||
double targetposL;
|
||||
double targetnegL;
|
||||
double lastOutputL;
|
||||
double controlAposR;
|
||||
double controlAnegR;
|
||||
double controlBposR;
|
||||
double controlBnegR;
|
||||
double targetposR;
|
||||
double targetnegR;
|
||||
double lastOutputR;
|
||||
bool flip;
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
|
||||
float A;
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ void ButterComp2::processReplacing(float **inputs, float **outputs, VstInt32 sam
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
|
||||
static int noisesourceL = 0;
|
||||
static int noisesourceR = 850010;
|
||||
|
|
@ -75,30 +75,30 @@ void ButterComp2::processReplacing(float **inputs, float **outputs, VstInt32 sam
|
|||
inputSampleL *= inputgain;
|
||||
inputSampleR *= inputgain;
|
||||
|
||||
long double divisor = compfactor / (1.0+fabs(lastOutputL));
|
||||
double divisor = compfactor / (1.0+fabs(lastOutputL));
|
||||
//this is slowing compressor recovery while output waveforms were high
|
||||
divisor /= overallscale;
|
||||
long double remainder = divisor;
|
||||
double remainder = divisor;
|
||||
divisor = 1.0 - divisor;
|
||||
//recalculate divisor every sample
|
||||
|
||||
long double inputposL = inputSampleL + 1.0;
|
||||
double inputposL = inputSampleL + 1.0;
|
||||
if (inputposL < 0.0) inputposL = 0.0;
|
||||
long double outputposL = inputposL / 2.0;
|
||||
double outputposL = inputposL / 2.0;
|
||||
if (outputposL > 1.0) outputposL = 1.0;
|
||||
inputposL *= inputposL;
|
||||
targetposL *= divisor;
|
||||
targetposL += (inputposL * remainder);
|
||||
long double calcposL = pow((1.0/targetposL),2);
|
||||
double calcposL = pow((1.0/targetposL),2);
|
||||
|
||||
long double inputnegL = (-inputSampleL) + 1.0;
|
||||
double inputnegL = (-inputSampleL) + 1.0;
|
||||
if (inputnegL < 0.0) inputnegL = 0.0;
|
||||
long double outputnegL = inputnegL / 2.0;
|
||||
double outputnegL = inputnegL / 2.0;
|
||||
if (outputnegL > 1.0) outputnegL = 1.0;
|
||||
inputnegL *= inputnegL;
|
||||
targetnegL *= divisor;
|
||||
targetnegL += (inputnegL * remainder);
|
||||
long double calcnegL = pow((1.0/targetnegL),2);
|
||||
double calcnegL = pow((1.0/targetnegL),2);
|
||||
//now we have mirrored targets for comp
|
||||
//outputpos and outputneg go from 0 to 1
|
||||
|
||||
|
|
@ -138,23 +138,23 @@ void ButterComp2::processReplacing(float **inputs, float **outputs, VstInt32 sam
|
|||
divisor = 1.0 - divisor;
|
||||
//recalculate divisor every sample
|
||||
|
||||
long double inputposR = inputSampleR + 1.0;
|
||||
double inputposR = inputSampleR + 1.0;
|
||||
if (inputposR < 0.0) inputposR = 0.0;
|
||||
long double outputposR = inputposR / 2.0;
|
||||
double outputposR = inputposR / 2.0;
|
||||
if (outputposR > 1.0) outputposR = 1.0;
|
||||
inputposR *= inputposR;
|
||||
targetposR *= divisor;
|
||||
targetposR += (inputposR * remainder);
|
||||
long double calcposR = pow((1.0/targetposR),2);
|
||||
double calcposR = pow((1.0/targetposR),2);
|
||||
|
||||
long double inputnegR = (-inputSampleR) + 1.0;
|
||||
double inputnegR = (-inputSampleR) + 1.0;
|
||||
if (inputnegR < 0.0) inputnegR = 0.0;
|
||||
long double outputnegR = inputnegR / 2.0;
|
||||
double outputnegR = inputnegR / 2.0;
|
||||
if (outputnegR > 1.0) outputnegR = 1.0;
|
||||
inputnegR *= inputnegR;
|
||||
targetnegR *= divisor;
|
||||
targetnegR += (inputnegR * remainder);
|
||||
long double calcnegR = pow((1.0/targetnegR),2);
|
||||
double calcnegR = pow((1.0/targetnegR),2);
|
||||
//now we have mirrored targets for comp
|
||||
//outputpos and outputneg go from 0 to 1
|
||||
|
||||
|
|
@ -187,8 +187,8 @@ void ButterComp2::processReplacing(float **inputs, float **outputs, VstInt32 sam
|
|||
}
|
||||
//this causes each of the four to update only when active and in the correct 'flip'
|
||||
|
||||
long double totalmultiplierL;
|
||||
long double totalmultiplierR;
|
||||
double totalmultiplierL;
|
||||
double totalmultiplierR;
|
||||
if (flip)
|
||||
{
|
||||
totalmultiplierL = (controlAposL * outputposL) + (controlAnegL * outputnegL);
|
||||
|
|
@ -223,14 +223,14 @@ void ButterComp2::processReplacing(float **inputs, float **outputs, VstInt32 sam
|
|||
|
||||
flip = !flip;
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -265,8 +265,8 @@ void ButterComp2::processDoubleReplacing(double **inputs, double **outputs, VstI
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
|
||||
static int noisesourceL = 0;
|
||||
static int noisesourceR = 850010;
|
||||
|
|
@ -310,30 +310,30 @@ void ButterComp2::processDoubleReplacing(double **inputs, double **outputs, VstI
|
|||
inputSampleL *= inputgain;
|
||||
inputSampleR *= inputgain;
|
||||
|
||||
long double divisor = compfactor / (1.0+fabs(lastOutputL));
|
||||
double divisor = compfactor / (1.0+fabs(lastOutputL));
|
||||
//this is slowing compressor recovery while output waveforms were high
|
||||
divisor /= overallscale;
|
||||
long double remainder = divisor;
|
||||
double remainder = divisor;
|
||||
divisor = 1.0 - divisor;
|
||||
//recalculate divisor every sample
|
||||
|
||||
long double inputposL = inputSampleL + 1.0;
|
||||
double inputposL = inputSampleL + 1.0;
|
||||
if (inputposL < 0.0) inputposL = 0.0;
|
||||
long double outputposL = inputposL / 2.0;
|
||||
double outputposL = inputposL / 2.0;
|
||||
if (outputposL > 1.0) outputposL = 1.0;
|
||||
inputposL *= inputposL;
|
||||
targetposL *= divisor;
|
||||
targetposL += (inputposL * remainder);
|
||||
long double calcposL = pow((1.0/targetposL),2);
|
||||
double calcposL = pow((1.0/targetposL),2);
|
||||
|
||||
long double inputnegL = (-inputSampleL) + 1.0;
|
||||
double inputnegL = (-inputSampleL) + 1.0;
|
||||
if (inputnegL < 0.0) inputnegL = 0.0;
|
||||
long double outputnegL = inputnegL / 2.0;
|
||||
double outputnegL = inputnegL / 2.0;
|
||||
if (outputnegL > 1.0) outputnegL = 1.0;
|
||||
inputnegL *= inputnegL;
|
||||
targetnegL *= divisor;
|
||||
targetnegL += (inputnegL * remainder);
|
||||
long double calcnegL = pow((1.0/targetnegL),2);
|
||||
double calcnegL = pow((1.0/targetnegL),2);
|
||||
//now we have mirrored targets for comp
|
||||
//outputpos and outputneg go from 0 to 1
|
||||
|
||||
|
|
@ -373,23 +373,23 @@ void ButterComp2::processDoubleReplacing(double **inputs, double **outputs, VstI
|
|||
divisor = 1.0 - divisor;
|
||||
//recalculate divisor every sample
|
||||
|
||||
long double inputposR = inputSampleR + 1.0;
|
||||
double inputposR = inputSampleR + 1.0;
|
||||
if (inputposR < 0.0) inputposR = 0.0;
|
||||
long double outputposR = inputposR / 2.0;
|
||||
double outputposR = inputposR / 2.0;
|
||||
if (outputposR > 1.0) outputposR = 1.0;
|
||||
inputposR *= inputposR;
|
||||
targetposR *= divisor;
|
||||
targetposR += (inputposR * remainder);
|
||||
long double calcposR = pow((1.0/targetposR),2);
|
||||
double calcposR = pow((1.0/targetposR),2);
|
||||
|
||||
long double inputnegR = (-inputSampleR) + 1.0;
|
||||
double inputnegR = (-inputSampleR) + 1.0;
|
||||
if (inputnegR < 0.0) inputnegR = 0.0;
|
||||
long double outputnegR = inputnegR / 2.0;
|
||||
double outputnegR = inputnegR / 2.0;
|
||||
if (outputnegR > 1.0) outputnegR = 1.0;
|
||||
inputnegR *= inputnegR;
|
||||
targetnegR *= divisor;
|
||||
targetnegR += (inputnegR * remainder);
|
||||
long double calcnegR = pow((1.0/targetnegR),2);
|
||||
double calcnegR = pow((1.0/targetnegR),2);
|
||||
//now we have mirrored targets for comp
|
||||
//outputpos and outputneg go from 0 to 1
|
||||
|
||||
|
|
@ -422,8 +422,8 @@ void ButterComp2::processDoubleReplacing(double **inputs, double **outputs, VstI
|
|||
}
|
||||
//this causes each of the four to update only when active and in the correct 'flip'
|
||||
|
||||
long double totalmultiplierL;
|
||||
long double totalmultiplierR;
|
||||
double totalmultiplierL;
|
||||
double totalmultiplierR;
|
||||
if (flip)
|
||||
{
|
||||
totalmultiplierL = (controlAposL * outputposL) + (controlAnegL * outputnegL);
|
||||
|
|
@ -458,16 +458,14 @@ void ButterComp2::processDoubleReplacing(double **inputs, double **outputs, VstI
|
|||
|
||||
flip = !flip;
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ C5RawBuss::C5RawBuss(audioMasterCallback audioMaster) :
|
|||
lastSampleBussL = 0.0;
|
||||
lastFXBussR = 0.0;
|
||||
lastSampleBussR = 0.0;
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ private:
|
|||
char _programName[kVstMaxProgNameLen + 1];
|
||||
std::set< std::string > _canDo;
|
||||
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
double lastFXBussL;
|
||||
double lastSampleBussL;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ void C5RawBuss::processReplacing(float **inputs, float **outputs, VstInt32 sampl
|
|||
float* out2 = outputs[1];
|
||||
|
||||
|
||||
long double centering = A * 0.5;
|
||||
double centering = A * 0.5;
|
||||
centering = 1.0 - pow(centering,5);
|
||||
//we can set our centering force from zero to rather high, but
|
||||
//there's a really intense taper on it forcing it to mostly be almost 1.0.
|
||||
|
|
@ -24,51 +24,15 @@ void C5RawBuss::processReplacing(float **inputs, float **outputs, VstInt32 sampl
|
|||
double differenceL;
|
||||
double differenceR;
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
|
||||
if (inputSampleL > 1.0) inputSampleL = 1.0;
|
||||
if (inputSampleL < -1.0) inputSampleL = -1.0;
|
||||
|
|
@ -108,14 +72,14 @@ void C5RawBuss::processReplacing(float **inputs, float **outputs, VstInt32 sampl
|
|||
//build new signal off what was present in output last time
|
||||
//slew aspect
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -135,7 +99,7 @@ void C5RawBuss::processDoubleReplacing(double **inputs, double **outputs, VstInt
|
|||
double* out2 = outputs[1];
|
||||
|
||||
|
||||
long double centering = A * 0.5;
|
||||
double centering = A * 0.5;
|
||||
centering = 1.0 - pow(centering,5);
|
||||
//we can set our centering force from zero to rather high, but
|
||||
//there's a really intense taper on it forcing it to mostly be almost 1.0.
|
||||
|
|
@ -144,51 +108,15 @@ void C5RawBuss::processDoubleReplacing(double **inputs, double **outputs, VstInt
|
|||
double differenceL;
|
||||
double differenceR;
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
|
||||
if (inputSampleL > 1.0) inputSampleL = 1.0;
|
||||
if (inputSampleL < -1.0) inputSampleL = -1.0;
|
||||
|
|
@ -228,16 +156,14 @@ void C5RawBuss::processDoubleReplacing(double **inputs, double **outputs, VstInt
|
|||
//build new signal off what was present in output last time
|
||||
//slew aspect
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ C5RawChannel::C5RawChannel(audioMasterCallback audioMaster) :
|
|||
lastSampleChannelL = 0.0;
|
||||
lastFXChannelR = 0.0;
|
||||
lastSampleChannelR = 0.0;
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ private:
|
|||
char _programName[kVstMaxProgNameLen + 1];
|
||||
std::set< std::string > _canDo;
|
||||
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
double lastFXChannelL;
|
||||
double lastSampleChannelL;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ void C5RawChannel::processReplacing(float **inputs, float **outputs, VstInt32 sa
|
|||
float* out2 = outputs[1];
|
||||
|
||||
|
||||
long double centering = A * 0.5;
|
||||
double centering = A * 0.5;
|
||||
centering = 1.0 - pow(centering,5);
|
||||
//we can set our centering force from zero to rather high, but
|
||||
//there's a really intense taper on it forcing it to mostly be almost 1.0.
|
||||
|
|
@ -24,51 +24,15 @@ void C5RawChannel::processReplacing(float **inputs, float **outputs, VstInt32 sa
|
|||
double differenceL;
|
||||
double differenceR;
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
|
||||
differenceL = lastSampleChannelL - inputSampleL;
|
||||
lastSampleChannelL = inputSampleL;
|
||||
|
|
@ -107,14 +71,14 @@ void C5RawChannel::processReplacing(float **inputs, float **outputs, VstInt32 sa
|
|||
inputSampleR = sin(inputSampleR);
|
||||
//amplitude aspect
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -134,7 +98,7 @@ void C5RawChannel::processDoubleReplacing(double **inputs, double **outputs, Vst
|
|||
double* out2 = outputs[1];
|
||||
|
||||
|
||||
long double centering = A * 0.5;
|
||||
double centering = A * 0.5;
|
||||
centering = 1.0 - pow(centering,5);
|
||||
//we can set our centering force from zero to rather high, but
|
||||
//there's a really intense taper on it forcing it to mostly be almost 1.0.
|
||||
|
|
@ -143,51 +107,15 @@ void C5RawChannel::processDoubleReplacing(double **inputs, double **outputs, Vst
|
|||
double differenceL;
|
||||
double differenceR;
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
|
||||
differenceL = lastSampleChannelL - inputSampleL;
|
||||
lastSampleChannelL = inputSampleL;
|
||||
|
|
@ -226,16 +154,14 @@ void C5RawChannel::processDoubleReplacing(double **inputs, double **outputs, Vst
|
|||
inputSampleR = sin(inputSampleR);
|
||||
//amplitude aspect
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
|
|||
|
|
@ -153,8 +153,8 @@ CStrip::CStrip(audioMasterCallback audioMaster) :
|
|||
nvgRA = nvgRB = 0.0;
|
||||
//end ButterComp
|
||||
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ private:
|
|||
char _programName[kVstMaxProgNameLen + 1];
|
||||
std::set< std::string > _canDo;
|
||||
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
|
||||
double lastSampleL;
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ void CStrip::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
|
|||
overallscale = getSampleRate();
|
||||
compscale = compscale * overallscale;
|
||||
//compscale is the one that's 1 or something like 2.2 for 96K rates
|
||||
long double fpOld = 0.618033988749894848204586; //golden ratio!
|
||||
long double fpNew = 1.0 - fpOld;
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double fpOld = 0.618033988749894848204586; //golden ratio!
|
||||
double fpNew = 1.0 - fpOld;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
double highSampleL = 0.0;
|
||||
double midSampleL = 0.0;
|
||||
|
|
@ -111,44 +111,8 @@ void CStrip::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
|
||||
last2SampleL = lastSampleL;
|
||||
lastSampleL = inputSampleL;
|
||||
|
|
@ -726,14 +690,14 @@ void CStrip::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
|
|||
inputSampleR *= outputgain;
|
||||
}
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -758,10 +722,10 @@ void CStrip::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
overallscale = getSampleRate();
|
||||
compscale = compscale * overallscale;
|
||||
//compscale is the one that's 1 or something like 2.2 for 96K rates
|
||||
long double fpOld = 0.618033988749894848204586; //golden ratio!
|
||||
long double fpNew = 1.0 - fpOld;
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double fpOld = 0.618033988749894848204586; //golden ratio!
|
||||
double fpNew = 1.0 - fpOld;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
double highSampleL = 0.0;
|
||||
double midSampleL = 0.0;
|
||||
|
|
@ -849,44 +813,8 @@ void CStrip::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
|
||||
last2SampleL = lastSampleL;
|
||||
lastSampleL = inputSampleL;
|
||||
|
|
@ -1464,16 +1392,14 @@ void CStrip::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
inputSampleR *= outputgain;
|
||||
}
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ void Calibre::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
|
||||
|
|
@ -218,8 +218,8 @@ void Calibre::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ Capacitor::Capacitor(audioMasterCallback audioMaster) :
|
|||
lastHighpass = 1000.0;
|
||||
lastWet = 1000.0;
|
||||
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
|
|
@ -94,8 +94,8 @@ private:
|
|||
double lastHighpass;
|
||||
double lastWet;
|
||||
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
|
||||
float A;
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ void Capacitor::processReplacing(float **inputs, float **outputs, VstInt32 sampl
|
|||
double dry;
|
||||
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
float drySampleL;
|
||||
float drySampleR;
|
||||
|
||||
|
|
@ -40,44 +40,8 @@ void Capacitor::processReplacing(float **inputs, float **outputs, VstInt32 sampl
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
drySampleL = inputSampleL;
|
||||
drySampleR = inputSampleR;
|
||||
|
||||
|
|
@ -179,14 +143,14 @@ void Capacitor::processReplacing(float **inputs, float **outputs, VstInt32 sampl
|
|||
inputSampleL = (drySampleL * dry) + (inputSampleL * wet);
|
||||
inputSampleR = (drySampleR * dry) + (inputSampleR * wet);
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -222,8 +186,8 @@ void Capacitor::processDoubleReplacing(double **inputs, double **outputs, VstInt
|
|||
double dry;
|
||||
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
double drySampleL;
|
||||
double drySampleR;
|
||||
|
||||
|
|
@ -232,44 +196,8 @@ void Capacitor::processDoubleReplacing(double **inputs, double **outputs, VstInt
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
drySampleL = inputSampleL;
|
||||
drySampleR = inputSampleR;
|
||||
|
||||
|
|
@ -370,16 +298,14 @@ void Capacitor::processDoubleReplacing(double **inputs, double **outputs, VstInt
|
|||
inputSampleL = (drySampleL * dry) + (inputSampleL * wet);
|
||||
inputSampleR = (drySampleR * dry) + (inputSampleR * wet);
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
|
|||
|
|
@ -30,12 +30,12 @@ void Capacitor2::processReplacing(float **inputs, float **outputs, VstInt32 samp
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
double dielectricScaleL = fabs(2.0-((inputSampleL+nonLin)/nonLin));
|
||||
double dielectricScaleR = fabs(2.0-((inputSampleR+nonLin)/nonLin));
|
||||
|
|
@ -193,12 +193,12 @@ void Capacitor2::processDoubleReplacing(double **inputs, double **outputs, VstIn
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
double dielectricScaleL = fabs(2.0-((inputSampleL+nonLin)/nonLin));
|
||||
double dielectricScaleR = fabs(2.0-((inputSampleR+nonLin)/nonLin));
|
||||
|
|
|
|||
|
|
@ -58,12 +58,12 @@ void Chamber::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
iirCL = (iirCL*(1.0-highpass))+(inputSampleL*highpass); inputSampleL -= iirCL;
|
||||
iirCR = (iirCR*(1.0-highpass))+(inputSampleR*highpass); inputSampleR -= iirCR;
|
||||
|
|
@ -314,12 +314,12 @@ void Chamber::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
iirCL = (iirCL*(1.0-highpass))+(inputSampleL*highpass); inputSampleL -= iirCL;
|
||||
iirCR = (iirCR*(1.0-highpass))+(inputSampleR*highpass); inputSampleR -= iirCR;
|
||||
|
|
@ -501,12 +501,12 @@ void Chamber::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
//purpose is that, if you're adding verb, you're not altering other balances
|
||||
|
||||
//begin 64 bit stereo floating point dither
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
frexp((double)inputSampleR, &expon);
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ private:
|
|||
char _programName[kVstMaxProgNameLen + 1];
|
||||
std::set< std::string > _canDo;
|
||||
|
||||
long double fpNShapeLA;
|
||||
long double fpNShapeLB;
|
||||
long double fpNShapeRA;
|
||||
long double fpNShapeRB;
|
||||
double fpNShapeLA;
|
||||
double fpNShapeLB;
|
||||
double fpNShapeRA;
|
||||
double fpNShapeRB;
|
||||
bool fpFlip;
|
||||
//default stuff
|
||||
double iirSampleLA;
|
||||
|
|
|
|||
|
|
@ -25,53 +25,17 @@ void Channel4::processReplacing(float **inputs, float **outputs, VstInt32 sample
|
|||
const double localthreshold = threshold / overallscale;
|
||||
const double density = pow(drive,2); //this doesn't relate to the plugins Density and Drive much
|
||||
double clamp;
|
||||
long double bridgerectifier;
|
||||
double bridgerectifier;
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
|
||||
if (fpFlip)
|
||||
{
|
||||
|
|
@ -165,53 +129,17 @@ void Channel4::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
const double localthreshold = threshold / overallscale;
|
||||
const double density = pow(drive,2); //this doesn't relate to the plugins Density and Drive much
|
||||
double clamp;
|
||||
long double bridgerectifier;
|
||||
double bridgerectifier;
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
|
||||
if (fpFlip)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ Channel5::Channel5(audioMasterCallback audioMaster) :
|
|||
consoletype = 0.0;
|
||||
drive = 0.0;
|
||||
output = 1.0;
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
fpFlip = true;
|
||||
iirSampleLA = 0.0;
|
||||
iirSampleRA = 0.0;
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ private:
|
|||
char _programName[kVstMaxProgNameLen + 1];
|
||||
std::set< std::string > _canDo;
|
||||
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
bool fpFlip;
|
||||
//default stuff
|
||||
double iirSampleLA;
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ void Channel5::processReplacing(float **inputs, float **outputs, VstInt32 sample
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
|
||||
static int noisesourceL = 0;
|
||||
static int noisesourceR = 850010;
|
||||
|
|
@ -79,7 +79,7 @@ void Channel5::processReplacing(float **inputs, float **outputs, VstInt32 sample
|
|||
}
|
||||
//highpass section
|
||||
|
||||
long double bridgerectifier = fabs(inputSampleL)*1.57079633;
|
||||
double bridgerectifier = fabs(inputSampleL)*1.57079633;
|
||||
if (bridgerectifier > 1.57079633) bridgerectifier = 1.0;
|
||||
else bridgerectifier = sin(bridgerectifier);
|
||||
if (inputSampleL > 0) inputSampleL = (inputSampleL*(1-density))+(bridgerectifier*density);
|
||||
|
|
@ -158,8 +158,8 @@ void Channel5::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
|
||||
static int noisesourceL = 0;
|
||||
static int noisesourceR = 850010;
|
||||
|
|
@ -214,7 +214,7 @@ void Channel5::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
}
|
||||
//highpass section
|
||||
|
||||
long double bridgerectifier = fabs(inputSampleL)*1.57079633;
|
||||
double bridgerectifier = fabs(inputSampleL)*1.57079633;
|
||||
if (bridgerectifier > 1.57079633) bridgerectifier = 1.0;
|
||||
else bridgerectifier = sin(bridgerectifier);
|
||||
if (inputSampleL > 0) inputSampleL = (inputSampleL*(1-density))+(bridgerectifier*density);
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ void Channel6::processReplacing(float **inputs, float **outputs, VstInt32 sample
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
|
|
@ -45,8 +45,8 @@ void Channel6::processReplacing(float **inputs, float **outputs, VstInt32 sample
|
|||
inputSampleR = inputSampleR - iirSampleRB;
|
||||
}
|
||||
//highpass section
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
|
||||
if (inputSampleL > 1.0) inputSampleL = 1.0;
|
||||
|
|
@ -54,7 +54,7 @@ void Channel6::processReplacing(float **inputs, float **outputs, VstInt32 sample
|
|||
inputSampleL *= 1.2533141373155;
|
||||
//clip to 1.2533141373155 to reach maximum output
|
||||
|
||||
long double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
|
||||
double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
|
||||
inputSampleL = (drySampleL*(1-density))+(distSampleL*density);
|
||||
//drive section
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ void Channel6::processReplacing(float **inputs, float **outputs, VstInt32 sample
|
|||
inputSampleR *= 1.2533141373155;
|
||||
//clip to 1.2533141373155 to reach maximum output
|
||||
|
||||
long double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
|
||||
double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
|
||||
inputSampleR = (drySampleR*(1-density))+(distSampleR*density);
|
||||
//drive section
|
||||
|
||||
|
|
@ -123,8 +123,8 @@ void Channel6::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
|
|
@ -145,8 +145,8 @@ void Channel6::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
inputSampleR = inputSampleR - iirSampleRB;
|
||||
}
|
||||
//highpass section
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
|
||||
if (inputSampleL > 1.0) inputSampleL = 1.0;
|
||||
|
|
@ -154,7 +154,7 @@ void Channel6::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
inputSampleL *= 1.2533141373155;
|
||||
//clip to 1.2533141373155 to reach maximum output
|
||||
|
||||
long double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
|
||||
double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
|
||||
inputSampleL = (drySampleL*(1-density))+(distSampleL*density);
|
||||
//drive section
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ void Channel6::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
inputSampleR *= 1.2533141373155;
|
||||
//clip to 1.2533141373155 to reach maximum output
|
||||
|
||||
long double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
|
||||
double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
|
||||
inputSampleR = (drySampleR*(1-density))+(distSampleR*density);
|
||||
//drive section
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ void Channel7::processReplacing(float **inputs, float **outputs, VstInt32 sample
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
|
||||
|
|
@ -46,16 +46,16 @@ void Channel7::processReplacing(float **inputs, float **outputs, VstInt32 sample
|
|||
inputSampleR = inputSampleR - iirSampleRB;
|
||||
}
|
||||
//highpass section
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
if (inputSampleL > 1.0) inputSampleL = 1.0;
|
||||
if (inputSampleL < -1.0) inputSampleL = -1.0;
|
||||
long double phatSampleL = sin(inputSampleL * 1.57079633);
|
||||
double phatSampleL = sin(inputSampleL * 1.57079633);
|
||||
inputSampleL *= 1.2533141373155;
|
||||
//clip to 1.2533141373155 to reach maximum output, or 1.57079633 for pure sine 'phat' version
|
||||
|
||||
long double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
|
||||
double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
|
||||
|
||||
inputSampleL = distSampleL; //purest form is full Spiral
|
||||
if (density < 1.0) inputSampleL = (drySampleL*(1-density))+(distSampleL*density); //fade Spiral aspect
|
||||
|
|
@ -63,11 +63,11 @@ void Channel7::processReplacing(float **inputs, float **outputs, VstInt32 sample
|
|||
|
||||
if (inputSampleR > 1.0) inputSampleR = 1.0;
|
||||
if (inputSampleR < -1.0) inputSampleR = -1.0;
|
||||
long double phatSampleR = sin(inputSampleR * 1.57079633);
|
||||
double phatSampleR = sin(inputSampleR * 1.57079633);
|
||||
inputSampleR *= 1.2533141373155;
|
||||
//clip to 1.2533141373155 to reach maximum output, or 1.57079633 for pure sine 'phat' version
|
||||
|
||||
long double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
|
||||
double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
|
||||
|
||||
inputSampleR = distSampleR; //purest form is full Spiral
|
||||
if (density < 1.0) inputSampleR = (drySampleR*(1-density))+(distSampleR*density); //fade Spiral aspect
|
||||
|
|
@ -132,8 +132,8 @@ void Channel7::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
|
||||
|
|
@ -152,16 +152,16 @@ void Channel7::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
inputSampleR = inputSampleR - iirSampleRB;
|
||||
}
|
||||
//highpass section
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
if (inputSampleL > 1.0) inputSampleL = 1.0;
|
||||
if (inputSampleL < -1.0) inputSampleL = -1.0;
|
||||
long double phatSampleL = sin(inputSampleL * 1.57079633);
|
||||
double phatSampleL = sin(inputSampleL * 1.57079633);
|
||||
inputSampleL *= 1.2533141373155;
|
||||
//clip to 1.2533141373155 to reach maximum output, or 1.57079633 for pure sine 'phat' version
|
||||
|
||||
long double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
|
||||
double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
|
||||
|
||||
inputSampleL = distSampleL; //purest form is full Spiral
|
||||
if (density < 1.0) inputSampleL = (drySampleL*(1-density))+(distSampleL*density); //fade Spiral aspect
|
||||
|
|
@ -169,11 +169,11 @@ void Channel7::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
|
||||
if (inputSampleR > 1.0) inputSampleR = 1.0;
|
||||
if (inputSampleR < -1.0) inputSampleR = -1.0;
|
||||
long double phatSampleR = sin(inputSampleR * 1.57079633);
|
||||
double phatSampleR = sin(inputSampleR * 1.57079633);
|
||||
inputSampleR *= 1.2533141373155;
|
||||
//clip to 1.2533141373155 to reach maximum output, or 1.57079633 for pure sine 'phat' version
|
||||
|
||||
long double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
|
||||
double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
|
||||
|
||||
inputSampleR = distSampleR; //purest form is full Spiral
|
||||
if (density < 1.0) inputSampleR = (drySampleR*(1-density))+(distSampleR*density); //fade Spiral aspect
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ void Channel8::processReplacing(float **inputs, float **outputs, VstInt32 sample
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
|
||||
|
||||
|
|
@ -50,16 +50,16 @@ void Channel8::processReplacing(float **inputs, float **outputs, VstInt32 sample
|
|||
inputSampleR = inputSampleR - iirSampleRB;
|
||||
}
|
||||
//highpass section
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
if (inputSampleL > 1.0) inputSampleL = 1.0;
|
||||
if (inputSampleL < -1.0) inputSampleL = -1.0;
|
||||
long double phatSampleL = sin(inputSampleL * 1.57079633);
|
||||
double phatSampleL = sin(inputSampleL * 1.57079633);
|
||||
inputSampleL *= 1.2533141373155;
|
||||
//clip to 1.2533141373155 to reach maximum output, or 1.57079633 for pure sine 'phat' version
|
||||
|
||||
long double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
|
||||
double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
|
||||
|
||||
inputSampleL = distSampleL; //purest form is full Spiral
|
||||
if (density < 1.0) inputSampleL = (drySampleL*(1-density))+(distSampleL*density); //fade Spiral aspect
|
||||
|
|
@ -67,11 +67,11 @@ void Channel8::processReplacing(float **inputs, float **outputs, VstInt32 sample
|
|||
|
||||
if (inputSampleR > 1.0) inputSampleR = 1.0;
|
||||
if (inputSampleR < -1.0) inputSampleR = -1.0;
|
||||
long double phatSampleR = sin(inputSampleR * 1.57079633);
|
||||
double phatSampleR = sin(inputSampleR * 1.57079633);
|
||||
inputSampleR *= 1.2533141373155;
|
||||
//clip to 1.2533141373155 to reach maximum output, or 1.57079633 for pure sine 'phat' version
|
||||
|
||||
long double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
|
||||
double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
|
||||
|
||||
inputSampleR = distSampleR; //purest form is full Spiral
|
||||
if (density < 1.0) inputSampleR = (drySampleR*(1-density))+(distSampleR*density); //fade Spiral aspect
|
||||
|
|
@ -157,8 +157,8 @@ void Channel8::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
|
||||
|
||||
|
|
@ -180,16 +180,16 @@ void Channel8::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
inputSampleR = inputSampleR - iirSampleRB;
|
||||
}
|
||||
//highpass section
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
if (inputSampleL > 1.0) inputSampleL = 1.0;
|
||||
if (inputSampleL < -1.0) inputSampleL = -1.0;
|
||||
long double phatSampleL = sin(inputSampleL * 1.57079633);
|
||||
double phatSampleL = sin(inputSampleL * 1.57079633);
|
||||
inputSampleL *= 1.2533141373155;
|
||||
//clip to 1.2533141373155 to reach maximum output, or 1.57079633 for pure sine 'phat' version
|
||||
|
||||
long double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
|
||||
double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
|
||||
|
||||
inputSampleL = distSampleL; //purest form is full Spiral
|
||||
if (density < 1.0) inputSampleL = (drySampleL*(1-density))+(distSampleL*density); //fade Spiral aspect
|
||||
|
|
@ -197,11 +197,11 @@ void Channel8::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
|
||||
if (inputSampleR > 1.0) inputSampleR = 1.0;
|
||||
if (inputSampleR < -1.0) inputSampleR = -1.0;
|
||||
long double phatSampleR = sin(inputSampleR * 1.57079633);
|
||||
double phatSampleR = sin(inputSampleR * 1.57079633);
|
||||
inputSampleR *= 1.2533141373155;
|
||||
//clip to 1.2533141373155 to reach maximum output, or 1.57079633 for pure sine 'phat' version
|
||||
|
||||
long double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
|
||||
double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
|
||||
|
||||
inputSampleR = distSampleR; //purest form is full Spiral
|
||||
if (density < 1.0) inputSampleR = (drySampleR*(1-density))+(distSampleR*density); //fade Spiral aspect
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ private:
|
|||
double lastSampleAR;
|
||||
double lastSampleBR;
|
||||
double lastSampleCR;
|
||||
long double biquadA[15];
|
||||
long double biquadB[15];
|
||||
double biquadA[15];
|
||||
double biquadB[15];
|
||||
double iirAmount;
|
||||
double threshold;
|
||||
double cutoff;
|
||||
|
|
|
|||
|
|
@ -46,11 +46,11 @@ void Channel9::processReplacing(float **inputs, float **outputs, VstInt32 sample
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpdL * 1.18e-37;
|
||||
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpdR * 1.18e-37;
|
||||
long double tempSample;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
double tempSample;
|
||||
|
||||
if (biquadA[0] < 0.49999) {
|
||||
tempSample = biquadA[2]*inputSampleL+biquadA[3]*biquadA[7]+biquadA[4]*biquadA[8]-biquadA[5]*biquadA[9]-biquadA[6]*biquadA[10];
|
||||
|
|
@ -83,16 +83,16 @@ void Channel9::processReplacing(float **inputs, float **outputs, VstInt32 sample
|
|||
inputSampleR = inputSampleR - iirSampleRB;
|
||||
}
|
||||
//highpass section
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
if (inputSampleL > 1.0) inputSampleL = 1.0;
|
||||
if (inputSampleL < -1.0) inputSampleL = -1.0;
|
||||
long double phatSampleL = sin(inputSampleL * 1.57079633);
|
||||
double phatSampleL = sin(inputSampleL * 1.57079633);
|
||||
inputSampleL *= 1.2533141373155;
|
||||
//clip to 1.2533141373155 to reach maximum output, or 1.57079633 for pure sine 'phat' version
|
||||
|
||||
long double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
|
||||
double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
|
||||
|
||||
inputSampleL = distSampleL; //purest form is full Spiral
|
||||
if (density < 1.0) inputSampleL = (drySampleL*(1-density))+(distSampleL*density); //fade Spiral aspect
|
||||
|
|
@ -100,11 +100,11 @@ void Channel9::processReplacing(float **inputs, float **outputs, VstInt32 sample
|
|||
|
||||
if (inputSampleR > 1.0) inputSampleR = 1.0;
|
||||
if (inputSampleR < -1.0) inputSampleR = -1.0;
|
||||
long double phatSampleR = sin(inputSampleR * 1.57079633);
|
||||
double phatSampleR = sin(inputSampleR * 1.57079633);
|
||||
inputSampleR *= 1.2533141373155;
|
||||
//clip to 1.2533141373155 to reach maximum output, or 1.57079633 for pure sine 'phat' version
|
||||
|
||||
long double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
|
||||
double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
|
||||
|
||||
inputSampleR = distSampleR; //purest form is full Spiral
|
||||
if (density < 1.0) inputSampleR = (drySampleR*(1-density))+(distSampleR*density); //fade Spiral aspect
|
||||
|
|
@ -218,11 +218,11 @@ void Channel9::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
|
||||
while (--sampleFrames >= 0)
|
||||
{
|
||||
long double inputSampleL = *in1;
|
||||
long double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpdL * 1.18e-43;
|
||||
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpdR * 1.18e-43;
|
||||
long double tempSample;
|
||||
double inputSampleL = *in1;
|
||||
double inputSampleR = *in2;
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
double tempSample;
|
||||
|
||||
if (biquadA[0] < 0.49999) {
|
||||
tempSample = biquadA[2]*inputSampleL+biquadA[3]*biquadA[7]+biquadA[4]*biquadA[8]-biquadA[5]*biquadA[9]-biquadA[6]*biquadA[10];
|
||||
|
|
@ -255,16 +255,16 @@ void Channel9::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
inputSampleR = inputSampleR - iirSampleRB;
|
||||
}
|
||||
//highpass section
|
||||
long double drySampleL = inputSampleL;
|
||||
long double drySampleR = inputSampleR;
|
||||
double drySampleL = inputSampleL;
|
||||
double drySampleR = inputSampleR;
|
||||
|
||||
if (inputSampleL > 1.0) inputSampleL = 1.0;
|
||||
if (inputSampleL < -1.0) inputSampleL = -1.0;
|
||||
long double phatSampleL = sin(inputSampleL * 1.57079633);
|
||||
double phatSampleL = sin(inputSampleL * 1.57079633);
|
||||
inputSampleL *= 1.2533141373155;
|
||||
//clip to 1.2533141373155 to reach maximum output, or 1.57079633 for pure sine 'phat' version
|
||||
|
||||
long double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
|
||||
double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
|
||||
|
||||
inputSampleL = distSampleL; //purest form is full Spiral
|
||||
if (density < 1.0) inputSampleL = (drySampleL*(1-density))+(distSampleL*density); //fade Spiral aspect
|
||||
|
|
@ -272,11 +272,11 @@ void Channel9::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
|
||||
if (inputSampleR > 1.0) inputSampleR = 1.0;
|
||||
if (inputSampleR < -1.0) inputSampleR = -1.0;
|
||||
long double phatSampleR = sin(inputSampleR * 1.57079633);
|
||||
double phatSampleR = sin(inputSampleR * 1.57079633);
|
||||
inputSampleR *= 1.2533141373155;
|
||||
//clip to 1.2533141373155 to reach maximum output, or 1.57079633 for pure sine 'phat' version
|
||||
|
||||
long double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
|
||||
double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
|
||||
|
||||
inputSampleR = distSampleR; //purest form is full Spiral
|
||||
if (density < 1.0) inputSampleR = (drySampleR*(1-density))+(distSampleR*density); //fade Spiral aspect
|
||||
|
|
@ -333,12 +333,12 @@ void Channel9::processDoubleReplacing(double **inputs, double **outputs, VstInt3
|
|||
}
|
||||
|
||||
//begin 64 bit stereo floating point dither
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
frexp((double)inputSampleR, &expon);
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ Chorus::Chorus(audioMasterCallback audioMaster) :
|
|||
airOddR = 0.0;
|
||||
airFactorR = 0.0;
|
||||
fpFlip = true;
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ private:
|
|||
char _programName[kVstMaxProgNameLen + 1];
|
||||
std::set< std::string > _canDo;
|
||||
|
||||
long double fpNShapeL;
|
||||
long double fpNShapeR;
|
||||
uint32_t fpdL;
|
||||
uint32_t fpdR;
|
||||
//default stuff
|
||||
const static int totalsamples = 16386;
|
||||
float dL[totalsamples];
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ void Chorus::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
|
|||
//this is a double buffer so we will be splitting it in two
|
||||
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
double drySampleL;
|
||||
double drySampleR;
|
||||
|
||||
|
|
@ -40,44 +40,8 @@ void Chorus::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
drySampleL = inputSampleL;
|
||||
drySampleR = inputSampleR;
|
||||
|
||||
|
|
@ -133,14 +97,14 @@ void Chorus::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
|
|||
}
|
||||
fpFlip = !fpFlip;
|
||||
|
||||
//stereo 32 bit dither, made small and tidy.
|
||||
//begin 32 bit stereo floating point dither
|
||||
int expon; frexpf((float)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
frexpf((float)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 32 bit dither
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
|
||||
//end 32 bit stereo floating point dither
|
||||
|
||||
*out1 = inputSampleL;
|
||||
*out2 = inputSampleR;
|
||||
|
|
@ -176,8 +140,8 @@ void Chorus::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
//this is a double buffer so we will be splitting it in two
|
||||
|
||||
|
||||
long double inputSampleL;
|
||||
long double inputSampleR;
|
||||
double inputSampleL;
|
||||
double inputSampleR;
|
||||
double drySampleL;
|
||||
double drySampleR;
|
||||
|
||||
|
|
@ -185,44 +149,8 @@ void Chorus::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
{
|
||||
inputSampleL = *in1;
|
||||
inputSampleR = *in2;
|
||||
if (inputSampleL<1.2e-38 && -inputSampleL<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
//this declares a variable before anything else is compiled. It won't keep assigning
|
||||
//it to 0 for every sample, it's as if the declaration doesn't exist in this context,
|
||||
//but it lets me add this denormalization fix in a single place rather than updating
|
||||
//it in three different locations. The variable isn't thread-safe but this is only
|
||||
//a random seed and we can share it with whatever.
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleL = applyresidue;
|
||||
}
|
||||
if (inputSampleR<1.2e-38 && -inputSampleR<1.2e-38) {
|
||||
static int noisesource = 0;
|
||||
noisesource = noisesource % 1700021; noisesource++;
|
||||
int residue = noisesource * noisesource;
|
||||
residue = residue % 170003; residue *= residue;
|
||||
residue = residue % 17011; residue *= residue;
|
||||
residue = residue % 1709; residue *= residue;
|
||||
residue = residue % 173; residue *= residue;
|
||||
residue = residue % 17;
|
||||
double applyresidue = residue;
|
||||
applyresidue *= 0.00000001;
|
||||
applyresidue *= 0.00000001;
|
||||
inputSampleR = applyresidue;
|
||||
//this denormalization routine produces a white noise at -300 dB which the noise
|
||||
//shaping will interact with to produce a bipolar output, but the noise is actually
|
||||
//all positive. That should stop any variables from going denormal, and the routine
|
||||
//only kicks in if digital black is input. As a final touch, if you save to 24-bit
|
||||
//the silence will return to being digital black again.
|
||||
}
|
||||
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
|
||||
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
|
||||
drySampleL = inputSampleL;
|
||||
drySampleR = inputSampleR;
|
||||
|
||||
|
|
@ -277,16 +205,14 @@ void Chorus::processDoubleReplacing(double **inputs, double **outputs, VstInt32
|
|||
inputSampleR = (inputSampleR * wet) + (drySampleR * dry);
|
||||
}
|
||||
|
||||
//stereo 64 bit dither, made small and tidy.
|
||||
int expon; frexp((double)inputSampleL, &expon);
|
||||
long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
|
||||
frexp((double)inputSampleR, &expon);
|
||||
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
|
||||
dither /= 536870912.0; //needs this to scale to 64 bit zone
|
||||
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
|
||||
//end 64 bit dither
|
||||
//begin 64 bit stereo floating point dither
|
||||
//int expon; frexp((double)inputSampleL, &expon);
|
||||
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
|
||||
//inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//frexp((double)inputSampleR, &expon);
|
||||
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
|
||||
//inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
|
||||
//end 64 bit stereo floating point dither
|
||||
fpFlip = !fpFlip;
|
||||
|
||||
*out1 = inputSampleL;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ ChorusEnsemble::ChorusEnsemble(audioMasterCallback audioMaster) :
|
|||
airOddR = 0.0;
|
||||
airFactorR = 0.0;
|
||||
fpFlip = true;
|
||||
fpNShapeL = 0.0;
|
||||
fpNShapeR = 0.0;
|
||||
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
|
||||
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
|
||||
//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.
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue