ALL the code base should be up to date, now I am just compiling and packaging

This commit is contained in:
airwindows 2022-03-03 14:57:40 -05:00
parent 08755ab7d6
commit e1759b2f75
528 changed files with 2221 additions and 2255 deletions

View file

@ -1,143 +0,0 @@
/* ========================================
* Thunder - Thunder.h
* Copyright (c) 2016 airwindows, All rights reserved
* ======================================== */
#ifndef __Thunder_H
#include "Thunder.h"
#endif
AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new Thunder(audioMaster);}
Thunder::Thunder(audioMasterCallback audioMaster) :
AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
{
A = 0.0;
B = 1.0;
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
muSpeedA = 10000;
muSpeedB = 10000;
muCoefficientA = 1;
muCoefficientB = 1;
muVary = 1;
gateL = 0.0;
gateR = 0.0;
iirSampleAL = 0.0;
iirSampleBL = 0.0;
iirSampleAR = 0.0;
iirSampleBR = 0.0;
iirSampleAM = 0.0;
iirSampleBM = 0.0;
iirSampleCM = 0.0;
flip = false;
//this is reset: values being initialized only once. Startup values, whatever they are.
_canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect.
_canDo.insert("plugAsSend"); // plug-in can be used as a send effect.
_canDo.insert("x2in2out");
setNumInputs(kNumInputs);
setNumOutputs(kNumOutputs);
setUniqueID(kUniqueId);
canProcessReplacing(); // supports output replacing
canDoubleReplacing(); // supports double precision processing
programsAreChunks(true);
vst_strncpy (_programName, "Default", kVstMaxProgNameLen); // default program name
}
Thunder::~Thunder() {}
VstInt32 Thunder::getVendorVersion () {return 1000;}
void Thunder::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
void Thunder::getProgramName(char *name) {vst_strncpy (name, _programName, kVstMaxProgNameLen);}
//airwindows likes to ignore this stuff. Make your own programs, and make a different plugin rather than
//trying to do versioning and preventing people from using older versions. Maybe they like the old one!
static float pinParameter(float data)
{
if (data < 0.0f) return 0.0f;
if (data > 1.0f) return 1.0f;
return data;
}
VstInt32 Thunder::getChunk (void** data, bool isPreset)
{
float *chunkData = (float *)calloc(kNumParameters, sizeof(float));
chunkData[0] = A;
chunkData[1] = B;
/* Note: The way this is set up, it will break if you manage to save settings on an Intel
machine and load them on a PPC Mac. However, it's fine if you stick to the machine you
started with. */
*data = chunkData;
return kNumParameters * sizeof(float);
}
VstInt32 Thunder::setChunk (void* data, VstInt32 byteSize, bool isPreset)
{
float *chunkData = (float *)data;
A = pinParameter(chunkData[0]);
B = pinParameter(chunkData[1]);
/* We're ignoring byteSize as we found it to be a filthy liar */
/* calculate any other fields you need here - you could copy in
code from setParameter() here. */
return 0;
}
void Thunder::setParameter(VstInt32 index, float value) {
switch (index) {
case kParamA: A = value; break;
case kParamB: B = value; break; //percent. Using this value, it'll be 0-100 everywhere
default: throw; // unknown parameter, shouldn't happen!
}
}
float Thunder::getParameter(VstInt32 index) {
switch (index) {
case kParamA: return A; break;
case kParamB: return B; break;
default: break; // unknown parameter, shouldn't happen!
} return 0.0; //we only need to update the relevant name, this is simple to manage
}
void Thunder::getParameterName(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "Thunder", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "Output Trim", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this is our labels for displaying in the VST host
}
void Thunder::getParameterDisplay(VstInt32 index, char *text) {
switch (index) {
case kParamA: float2string (A, text, kVstMaxParamStrLen); break;
case kParamB: dB2string (B, text, kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this displays the values and handles 'popups' where it's discrete choices
}
void Thunder::getParameterLabel(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, " ", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "dB", kVstMaxParamStrLen); break; //the percent
default: break; // unknown parameter, shouldn't happen!
}
}
VstInt32 Thunder::canDo(char *text)
{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
bool Thunder::getEffectName(char* name) {
vst_strncpy(name, "Thunder", kVstMaxProductStrLen); return true;
}
VstPlugCategory Thunder::getPlugCategory() {return kPlugCategEffect;}
bool Thunder::getProductString(char* text) {
vst_strncpy (text, "airwindows Thunder", kVstMaxProductStrLen); return true;
}
bool Thunder::getVendorString(char* text) {
vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
}

View file

@ -1,81 +0,0 @@
/* ========================================
* Thunder - Thunder.h
* Created 8/12/11 by SPIAdmin
* Copyright (c) 2011 __MyCompanyName__, All rights reserved
* ======================================== */
#ifndef __Thunder_H
#define __Thunder_H
#ifndef __audioeffect__
#include "audioeffectx.h"
#endif
#include <set>
#include <string>
#include <math.h>
enum {
kParamA = 0,
kParamB = 1,
kNumParameters = 2
}; //
const int kNumPrograms = 0;
const int kNumInputs = 2;
const int kNumOutputs = 2;
const unsigned long kUniqueId = 'thun'; //Change this to what the AU identity is!
class Thunder :
public AudioEffectX
{
public:
Thunder(audioMasterCallback audioMaster);
~Thunder();
virtual bool getEffectName(char* name); // The plug-in name
virtual VstPlugCategory getPlugCategory(); // The general category for the plug-in
virtual bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg
virtual bool getVendorString(char* text); // Vendor info
virtual VstInt32 getVendorVersion(); // Version number
virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);
virtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames);
virtual void getProgramName(char *name); // read the name from the host
virtual void setProgramName(char *name); // changes the name of the preset displayed in the host
virtual VstInt32 getChunk (void** data, bool isPreset);
virtual VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset);
virtual float getParameter(VstInt32 index); // get the parameter value at the specified index
virtual void setParameter(VstInt32 index, float value); // set the parameter at index to value
virtual void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB)
virtual void getParameterName(VstInt32 index, char *text); // name of the parameter
virtual void getParameterDisplay(VstInt32 index, char *text); // text description of the current value
virtual VstInt32 canDo(char *text);
private:
char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo;
double muVary;
double muAttack;
double muNewSpeed;
double muSpeedA;
double muSpeedB;
double muCoefficientA;
double muCoefficientB;
double gateL;
double gateR;
double iirSampleAL;
double iirSampleBL;
double iirSampleAR;
double iirSampleBR;
double iirSampleAM;
double iirSampleBM;
double iirSampleCM;
uint32_t fpdL;
uint32_t fpdR;
bool flip;
float A;
float B;
};
#endif

View file

@ -1,406 +0,0 @@
/* ========================================
* Thunder - Thunder.h
* Copyright (c) 2016 airwindows, All rights reserved
* ======================================== */
#ifndef __Thunder_H
#include "Thunder.h"
#endif
void Thunder::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
{
float* in1 = inputs[0];
float* in2 = inputs[1];
float* out1 = outputs[0];
float* out2 = outputs[1];
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
double thunder = A * 0.4;
double threshold = 1.0 - (thunder * 2.0);
if (threshold < 0.01) threshold = 0.01;
double muMakeupGain = 1.0 / threshold;
double release = pow((1.28-thunder),5)*32768.0;
release /= overallscale;
double fastest = sqrt(release);
double EQ = ((0.0275 / getSampleRate())*32000.0);
double dcblock = EQ / 300.0;
double basstrim = (0.01/EQ)+1.0;
//FF parameters also ride off Speed
double outputGain = B;
double coefficient;
double inputSense;
double resultL;
double resultR;
double resultM;
double resultML;
double resultMR;
double inputSampleL;
double inputSampleR;
while (--sampleFrames >= 0)
{
inputSampleL = *in1;
inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
inputSampleL = inputSampleL * muMakeupGain;
inputSampleR = inputSampleR * muMakeupGain;
if (gateL < fabs(inputSampleL)) gateL = inputSampleL;
else gateL -= dcblock;
if (gateR < fabs(inputSampleR)) gateR = inputSampleR;
else gateR -= dcblock;
//setting up gated DC blocking to control the tendency for rumble and offset
//begin three FathomFive stages
iirSampleAL += (inputSampleL * EQ * thunder);
iirSampleAL -= (iirSampleAL * iirSampleAL * iirSampleAL * EQ);
if (iirSampleAL > gateL) iirSampleAL -= dcblock;
if (iirSampleAL < -gateL) iirSampleAL += dcblock;
resultL = iirSampleAL*basstrim;
iirSampleBL = (iirSampleBL * (1 - EQ)) + (resultL * EQ);
resultL = iirSampleBL;
iirSampleAR += (inputSampleR * EQ * thunder);
iirSampleAR -= (iirSampleAR * iirSampleAR * iirSampleAR * EQ);
if (iirSampleAR > gateR) iirSampleAR -= dcblock;
if (iirSampleAR < -gateR) iirSampleAR += dcblock;
resultR = iirSampleAR*basstrim;
iirSampleBR = (iirSampleBR * (1 - EQ)) + (resultR * EQ);
resultR = iirSampleBR;
iirSampleAM += ((inputSampleL + inputSampleR) * EQ * thunder);
iirSampleAM -= (iirSampleAM * iirSampleAM * iirSampleAM * EQ);
resultM = iirSampleAM*basstrim;
iirSampleBM = (iirSampleBM * (1 - EQ)) + (resultM * EQ);
resultM = iirSampleBM;
iirSampleCM = (iirSampleCM * (1 - EQ)) + (resultM * EQ);
resultM = fabs(iirSampleCM);
resultML = fabs(resultL);
resultMR = fabs(resultR);
if (resultM > resultML) resultML = resultM;
if (resultM > resultMR) resultMR = resultM;
//trying to restrict the buzziness
if (resultML > 1.0) resultML = 1.0;
if (resultMR > 1.0) resultMR = 1.0;
//now we have result L, R and M the trigger modulator which must be 0-1
//begin compressor section
inputSampleL -= (iirSampleBL * thunder);
inputSampleR -= (iirSampleBR * thunder);
//highpass the comp section by sneaking out what will be the reinforcement
inputSense = fabs(inputSampleL);
if (fabs(inputSampleR) > inputSense)
inputSense = fabs(inputSampleR);
//we will take the greater of either channel and just use that, then apply the result
//to both stereo channels.
if (flip)
{
if (inputSense > threshold)
{
muVary = threshold / inputSense;
muAttack = sqrt(fabs(muSpeedA));
muCoefficientA = muCoefficientA * (muAttack-1.0);
if (muVary < threshold)
{
muCoefficientA = muCoefficientA + threshold;
}
else
{
muCoefficientA = muCoefficientA + muVary;
}
muCoefficientA = muCoefficientA / muAttack;
}
else
{
muCoefficientA = muCoefficientA * ((muSpeedA * muSpeedA)-1.0);
muCoefficientA = muCoefficientA + 1.0;
muCoefficientA = muCoefficientA / (muSpeedA * muSpeedA);
}
muNewSpeed = muSpeedA * (muSpeedA-1);
muNewSpeed = muNewSpeed + fabs(inputSense*release)+fastest;
muSpeedA = muNewSpeed / muSpeedA;
}
else
{
if (inputSense > threshold)
{
muVary = threshold / inputSense;
muAttack = sqrt(fabs(muSpeedB));
muCoefficientB = muCoefficientB * (muAttack-1);
if (muVary < threshold)
{
muCoefficientB = muCoefficientB + threshold;
}
else
{
muCoefficientB = muCoefficientB + muVary;
}
muCoefficientB = muCoefficientB / muAttack;
}
else
{
muCoefficientB = muCoefficientB * ((muSpeedB * muSpeedB)-1.0);
muCoefficientB = muCoefficientB + 1.0;
muCoefficientB = muCoefficientB / (muSpeedB * muSpeedB);
}
muNewSpeed = muSpeedB * (muSpeedB-1);
muNewSpeed = muNewSpeed + fabs(inputSense*release)+fastest;
muSpeedB = muNewSpeed / muSpeedB;
}
//got coefficients, adjusted speeds
if (flip)
{
coefficient = pow(muCoefficientA,2);
inputSampleL *= coefficient;
inputSampleR *= coefficient;
}
else
{
coefficient = pow(muCoefficientB,2);
inputSampleL *= coefficient;
inputSampleR *= coefficient;
}
//applied compression with vari-vari-µ-µ-µ-µ-µ-µ-is-the-kitten-song o/~
//applied gain correction to control output level- tends to constrain sound rather than inflate it
inputSampleL += (resultL * resultM);
inputSampleR += (resultR * resultM);
//combine the two by adding the summed channnel of lows
if (outputGain != 1.0) {
inputSampleL *= outputGain;
inputSampleR *= outputGain;
}
//begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon);
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);
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;
*in1++;
*in2++;
*out1++;
*out2++;
}
}
void Thunder::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
{
double* in1 = inputs[0];
double* in2 = inputs[1];
double* out1 = outputs[0];
double* out2 = outputs[1];
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
double thunder = A * 0.4;
double threshold = 1.0 - (thunder * 2.0);
if (threshold < 0.01) threshold = 0.01;
double muMakeupGain = 1.0 / threshold;
double release = pow((1.28-thunder),5)*32768.0;
release /= overallscale;
double fastest = sqrt(release);
double EQ = ((0.0275 / getSampleRate())*32000.0);
double dcblock = EQ / 300.0;
double basstrim = (0.01/EQ)+1.0;
//FF parameters also ride off Speed
double outputGain = B;
double coefficient;
double inputSense;
double resultL;
double resultR;
double resultM;
double resultML;
double resultMR;
double inputSampleL;
double inputSampleR;
while (--sampleFrames >= 0)
{
inputSampleL = *in1;
inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
inputSampleL = inputSampleL * muMakeupGain;
inputSampleR = inputSampleR * muMakeupGain;
if (gateL < fabs(inputSampleL)) gateL = inputSampleL;
else gateL -= dcblock;
if (gateR < fabs(inputSampleR)) gateR = inputSampleR;
else gateR -= dcblock;
//setting up gated DC blocking to control the tendency for rumble and offset
//begin three FathomFive stages
iirSampleAL += (inputSampleL * EQ * thunder);
iirSampleAL -= (iirSampleAL * iirSampleAL * iirSampleAL * EQ);
if (iirSampleAL > gateL) iirSampleAL -= dcblock;
if (iirSampleAL < -gateL) iirSampleAL += dcblock;
resultL = iirSampleAL*basstrim;
iirSampleBL = (iirSampleBL * (1 - EQ)) + (resultL * EQ);
resultL = iirSampleBL;
iirSampleAR += (inputSampleR * EQ * thunder);
iirSampleAR -= (iirSampleAR * iirSampleAR * iirSampleAR * EQ);
if (iirSampleAR > gateR) iirSampleAR -= dcblock;
if (iirSampleAR < -gateR) iirSampleAR += dcblock;
resultR = iirSampleAR*basstrim;
iirSampleBR = (iirSampleBR * (1 - EQ)) + (resultR * EQ);
resultR = iirSampleBR;
iirSampleAM += ((inputSampleL + inputSampleR) * EQ * thunder);
iirSampleAM -= (iirSampleAM * iirSampleAM * iirSampleAM * EQ);
resultM = iirSampleAM*basstrim;
iirSampleBM = (iirSampleBM * (1 - EQ)) + (resultM * EQ);
resultM = iirSampleBM;
iirSampleCM = (iirSampleCM * (1 - EQ)) + (resultM * EQ);
resultM = fabs(iirSampleCM);
resultML = fabs(resultL);
resultMR = fabs(resultR);
if (resultM > resultML) resultML = resultM;
if (resultM > resultMR) resultMR = resultM;
//trying to restrict the buzziness
if (resultML > 1.0) resultML = 1.0;
if (resultMR > 1.0) resultMR = 1.0;
//now we have result L, R and M the trigger modulator which must be 0-1
//begin compressor section
inputSampleL -= (iirSampleBL * thunder);
inputSampleR -= (iirSampleBR * thunder);
//highpass the comp section by sneaking out what will be the reinforcement
inputSense = fabs(inputSampleL);
if (fabs(inputSampleR) > inputSense)
inputSense = fabs(inputSampleR);
//we will take the greater of either channel and just use that, then apply the result
//to both stereo channels.
if (flip)
{
if (inputSense > threshold)
{
muVary = threshold / inputSense;
muAttack = sqrt(fabs(muSpeedA));
muCoefficientA = muCoefficientA * (muAttack-1.0);
if (muVary < threshold)
{
muCoefficientA = muCoefficientA + threshold;
}
else
{
muCoefficientA = muCoefficientA + muVary;
}
muCoefficientA = muCoefficientA / muAttack;
}
else
{
muCoefficientA = muCoefficientA * ((muSpeedA * muSpeedA)-1.0);
muCoefficientA = muCoefficientA + 1.0;
muCoefficientA = muCoefficientA / (muSpeedA * muSpeedA);
}
muNewSpeed = muSpeedA * (muSpeedA-1);
muNewSpeed = muNewSpeed + fabs(inputSense*release)+fastest;
muSpeedA = muNewSpeed / muSpeedA;
}
else
{
if (inputSense > threshold)
{
muVary = threshold / inputSense;
muAttack = sqrt(fabs(muSpeedB));
muCoefficientB = muCoefficientB * (muAttack-1);
if (muVary < threshold)
{
muCoefficientB = muCoefficientB + threshold;
}
else
{
muCoefficientB = muCoefficientB + muVary;
}
muCoefficientB = muCoefficientB / muAttack;
}
else
{
muCoefficientB = muCoefficientB * ((muSpeedB * muSpeedB)-1.0);
muCoefficientB = muCoefficientB + 1.0;
muCoefficientB = muCoefficientB / (muSpeedB * muSpeedB);
}
muNewSpeed = muSpeedB * (muSpeedB-1);
muNewSpeed = muNewSpeed + fabs(inputSense*release)+fastest;
muSpeedB = muNewSpeed / muSpeedB;
}
//got coefficients, adjusted speeds
if (flip)
{
coefficient = pow(muCoefficientA,2);
inputSampleL *= coefficient;
inputSampleR *= coefficient;
}
else
{
coefficient = pow(muCoefficientB,2);
inputSampleL *= coefficient;
inputSampleR *= coefficient;
}
//applied compression with vari-vari-µ-µ-µ-µ-µ-µ-is-the-kitten-song o/~
//applied gain correction to control output level- tends to constrain sound rather than inflate it
inputSampleL += (resultL * resultM);
inputSampleR += (resultR * resultM);
//combine the two by adding the summed channnel of lows
if (outputGain != 1.0) {
inputSampleL *= outputGain;
inputSampleR *= outputGain;
}
//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;
*in1++;
*in2++;
*out1++;
*out2++;
}
}

View file

@ -24,8 +24,8 @@ ADT::ADT(audioMasterCallback audioMaster) :
offsetB = 9001; // :D offsetB = 9001; // :D
gcount = 0; gcount = 0;
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX; fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
fpdR = 1.0; while (fpdR < 16386) fpdR = 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. //this is reset: values being initialized only once. Startup values, whatever they are.
_canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect. _canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect.

View file

@ -126,10 +126,10 @@ void ADT::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrame
//begin 32 bit stereo floating point dither //begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += static_cast<int32_t>(fpdL) * 5.960464655174751e-36L * pow(2,expon+62); inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
frexpf((float)inputSampleR, &expon); frexpf((float)inputSampleR, &expon);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += static_cast<int32_t>(fpdR) * 5.960464655174751e-36L * pow(2,expon+62); inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit stereo floating point dither //end 32 bit stereo floating point dither
*out1 = inputSampleL; *out1 = inputSampleL;
@ -167,8 +167,8 @@ void ADT::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sam
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpdL * 1.18e-43; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpdR * 1.18e-43; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
if (fabs(offsetA - targetA) > 1000) offsetA = targetA; if (fabs(offsetA - targetA) > 1000) offsetA = targetA;
@ -259,12 +259,12 @@ void ADT::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sam
if (output < 1.0) {inputSampleL *= output; inputSampleR *= output;} if (output < 1.0) {inputSampleL *= output; inputSampleR *= output;}
//begin 64 bit stereo floating point dither //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; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += static_cast<int32_t>(fpdL) * 1.110223024625156e-44L * pow(2,expon+62); //inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
frexp((double)inputSampleR, &expon); //frexp((double)inputSampleR, &expon);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += static_cast<int32_t>(fpdR) * 1.110223024625156e-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 //end 64 bit stereo floating point dither
*out1 = inputSampleL; *out1 = inputSampleL;

View file

@ -19,8 +19,8 @@ Apicolypse::Apicolypse(audioMasterCallback audioMaster) :
for(int count = 0; count < 34; count++) {bR[count] = 0;bL[count] = 0;} for(int count = 0; count < 34; count++) {bR[count] = 0;bL[count] = 0;}
lastSampleR = 0.0;lastSampleL = 0.0; lastSampleR = 0.0;lastSampleL = 0.0;
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX; fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
fpdR = 1.0; while (fpdR < 16386) fpdR = 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. //this is reset: values being initialized only once. Startup values, whatever they are.
_canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect. _canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect.

View file

@ -59,8 +59,8 @@ private:
double lastSampleR; double lastSampleR;
double bL[35]; double bL[35];
double lastSampleL; double lastSampleL;
uint32_t fpdL; uint32_t fpdL;
uint32_t fpdR; uint32_t fpdR;
//default stuff //default stuff
float A; float A;

View file

@ -215,8 +215,8 @@ void Apicolypse::processDoubleReplacing(double **inputs, double **outputs, VstIn
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpdL * 1.18e-43; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpdR * 1.18e-43; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
inputSampleL *= indrive; inputSampleL *= indrive;
inputSampleR *= indrive; inputSampleR *= indrive;

View file

@ -56,6 +56,8 @@ private:
double settingchase; double settingchase;
double chasespeed; double chasespeed;
uint32_t fpdL;
uint32_t fpdR;
double fpNShapeL; double fpNShapeL;
double lastSampleAL; double lastSampleAL;
double lastSampleBL; double lastSampleBL;
@ -100,9 +102,6 @@ private:
double thresholdL; double thresholdL;
double thresholdM; double thresholdM;
uint32_t fpdL;
uint32_t fpdR;
float A; float A;
}; };

View file

@ -56,6 +56,8 @@ private:
double settingchase; double settingchase;
double chasespeed; double chasespeed;
uint32_t fpdL;
uint32_t fpdR;
double fpNShapeL; double fpNShapeL;
double lastSampleAL; double lastSampleAL;
double lastSampleBL; double lastSampleBL;
@ -99,9 +101,6 @@ private:
double thresholdK; double thresholdK;
double thresholdL; double thresholdL;
double thresholdM; double thresholdM;
uint32_t fpdL;
uint32_t fpdR;
float A; float A;
}; };

View file

@ -22,8 +22,8 @@ AverMatrix::AverMatrix(audioMasterCallback audioMaster) :
} }
} }
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX; fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
fpdR = 1.0; while (fpdR < 16386) fpdR = 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. //this is reset: values being initialized only once. Startup values, whatever they are.
_canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect. _canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect.

View file

@ -57,8 +57,8 @@ private:
double bL[11][11]; double bL[11][11];
double bR[11][11]; double bR[11][11];
double f[11]; double f[11];
uint32_t fpdL; uint32_t fpdL;
uint32_t fpdR; uint32_t fpdR;
//default stuff //default stuff
float A; float A;

View file

@ -195,7 +195,7 @@ void BassAmp::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
LataLowpass += LataHalfwayLowpass; //and combined them. Now we make sub-octaves LataLowpass += LataHalfwayLowpass; //and combined them. Now we make sub-octaves
RataLowpass += RataHalfwayLowpass; //and combined them. Now we make sub-octaves RataLowpass += RataHalfwayLowpass; //and combined them. Now we make sub-octaves
double randy = (double(fpdL)/UINT32_MAX)*0.0555; //0 to 1 the noise, may not be needed double randy = (double(fpdL)/UINT32_MAX)*0.0555; //0 to 1 the noise, may not be needed
switch (bflip) switch (bflip)
{ {
@ -365,8 +365,8 @@ void BassAmp::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
LinputSample += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62)); LinputSample += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
frexpf((float)RinputSample, &expon); frexpf((float)RinputSample, &expon);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
RinputSample += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62)); RinputSample += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit stereo floating point dither //end 32 bit stereo floating point dither
*out1 = LinputSample; *out1 = LinputSample;

View file

@ -37,9 +37,9 @@ void Beam::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpdL * 1.18e-37; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpdR * 1.18e-37; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
@ -166,9 +166,9 @@ void Beam::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpdL * 1.18e-43; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpdR * 1.18e-43; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;

View file

@ -14,7 +14,7 @@ BlockParty::BlockParty(audioMasterCallback audioMaster) :
{ {
A = 0.0; A = 0.0;
B = 1.0; B = 1.0;
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX; fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX; fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
muSpeedAL = 10000; muSpeedAL = 10000;

View file

@ -22,9 +22,7 @@ BuildATPDF::BuildATPDF(audioMasterCallback audioMaster) :
H = 0.5; H = 0.5;
I = 0.5; I = 0.5;
J = 0.5; J = 0.5;
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
for(int count = 0; count < 11; count++) {bL[count] = 0.0; bR[count] = 0.0; f[count] = 0.0;} for(int count = 0; count < 11; count++) {bL[count] = 0.0; bR[count] = 0.0; f[count] = 0.0;}
//this is reset: values being initialized only once. Startup values, whatever they are. //this is reset: values being initialized only once. Startup values, whatever they are.

View file

@ -65,9 +65,6 @@ private:
double bR[11]; double bR[11];
double f[11]; double f[11];
//default stuff //default stuff
uint32_t fpdL;
uint32_t fpdR;
float A; float A;
float B; float B;
@ -80,7 +77,8 @@ private:
float I; float I;
float J; float J;
//parameters. Always 0-1, and we scale/alter them elsewhere. //parameters. Always 0-1, and we scale/alter them elsewhere.
uint32_t fpdL;
uint32_t fpdR;
}; };
#endif #endif

View file

@ -77,7 +77,7 @@ void BuildATPDF::processReplacing(float **inputs, float **outputs, VstInt32 samp
inputSampleL /= 8388608.0; inputSampleL /= 8388608.0;
inputSampleR /= 8388608.0; inputSampleR /= 8388608.0;
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
//pseudorandom number updater //pseudorandom number updater
@ -162,7 +162,7 @@ void BuildATPDF::processDoubleReplacing(double **inputs, double **outputs, VstIn
inputSampleL /= 8388608.0; inputSampleL /= 8388608.0;
inputSampleR /= 8388608.0; inputSampleR /= 8388608.0;
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
//pseudorandom number updater //pseudorandom number updater
@ -175,4 +175,4 @@ void BuildATPDF::processDoubleReplacing(double **inputs, double **outputs, VstIn
*out1++; *out1++;
*out2++; *out2++;
} }
} }

View file

@ -67,6 +67,9 @@ private:
double lastSampleR; double lastSampleR;
double iirAmount; double iirAmount;
double threshold; double threshold;
uint32_t fpdL;
uint32_t fpdR;
float consoletype; float consoletype;
float drive; //parameters. Always 0-1, and we scale/alter them elsewhere. float drive; //parameters. Always 0-1, and we scale/alter them elsewhere.

View file

@ -34,6 +34,8 @@ void Channel4::processReplacing(float **inputs, float **outputs, VstInt32 sample
{ {
inputSampleL = *in1; inputSampleL = *in1;
inputSampleR = *in2; inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
if (fpFlip) if (fpFlip)
{ {
@ -136,6 +138,8 @@ void Channel4::processDoubleReplacing(double **inputs, double **outputs, VstInt3
{ {
inputSampleL = *in1; inputSampleL = *in1;
inputSampleR = *in2; inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
if (fpFlip) if (fpFlip)
{ {
@ -209,4 +213,4 @@ void Channel4::processDoubleReplacing(double **inputs, double **outputs, VstInt3
*out1++; *out1++;
*out2++; *out2++;
} }
} }

View file

@ -12,13 +12,11 @@ AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new C
Channel5::Channel5(audioMasterCallback audioMaster) : Channel5::Channel5(audioMasterCallback audioMaster) :
AudioEffectX(audioMaster, kNumPrograms, kNumParameters) AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
{ {
fpNShapeL = 0.0;
fpNShapeR = 0.0;
consoletype = 0.0; consoletype = 0.0;
drive = 0.0; drive = 0.0;
output = 1.0; output = 1.0;
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
fpNShapeL = 0.0;
fpNShapeR = 0.0;
fpFlip = true; fpFlip = true;
iirSampleLA = 0.0; iirSampleLA = 0.0;
iirSampleRA = 0.0; iirSampleRA = 0.0;

View file

@ -54,10 +54,8 @@ private:
char _programName[kVstMaxProgNameLen + 1]; char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo; std::set< std::string > _canDo;
uint32_t fpdL; double fpNShapeL;
uint32_t fpdR; double fpNShapeR;
double fpNShapeL;
double fpNShapeR;
bool fpFlip; bool fpFlip;
//default stuff //default stuff
double iirSampleLA; double iirSampleLA;

View file

@ -26,8 +26,6 @@ void Channel5::processReplacing(float **inputs, float **outputs, VstInt32 sample
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; 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;
if (fpFlip) if (fpFlip)
{ {
@ -127,8 +125,6 @@ void Channel5::processDoubleReplacing(double **inputs, double **outputs, VstInt3
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; 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;
if (fpFlip) if (fpFlip)
{ {

View file

@ -25,7 +25,7 @@ Compresaturator::Compresaturator(audioMasterCallback audioMaster) :
lastWidthR = 500; lastWidthR = 500;
padFactorR = 0; padFactorR = 0;
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX; fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
fpdR = 1.0; while (fpdR < 16386) fpdR = 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. //this is reset: values being initialized only once. Startup values, whatever they are.

View file

@ -172,10 +172,10 @@ void Compresaturator::processReplacing(float **inputs, float **outputs, VstInt32
//begin 32 bit stereo floating point dither //begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62)); inputSampleL += static_cast<int32_t>(fpdL) * 5.960464655174751e-36L * pow(2,expon+62);
frexpf((float)inputSampleR, &expon); frexpf((float)inputSampleR, &expon);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62)); inputSampleR += static_cast<int32_t>(fpdR) * 5.960464655174751e-36L * pow(2,expon+62);
//end 32 bit stereo floating point dither //end 32 bit stereo floating point dither
*out1 = inputSampleL; *out1 = inputSampleL;

View file

@ -22,9 +22,8 @@ Console4Buss::Console4Buss(audioMasterCallback audioMaster) :
gainchase = -90.0; gainchase = -90.0;
settingchase = -90.0; settingchase = -90.0;
chasespeed = 350.0; chasespeed = 350.0;
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX; fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX; fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
// TODO: uncomment canDo entries according to your plugin's capabilities // TODO: uncomment canDo entries according to your plugin's capabilities
// _canDo.insert("sendVstEvents"); // plug-in will send Vst events to Host. // _canDo.insert("sendVstEvents"); // plug-in will send Vst events to Host.

View file

@ -71,6 +71,8 @@ private:
char _programName[kVstMaxProgNameLen + 1]; char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo; std::set< std::string > _canDo;
uint32_t fpdL;
uint32_t fpdR;
double fpNShapeL; double fpNShapeL;
double fpNShapeR; double fpNShapeR;
//default stuff //default stuff
@ -79,8 +81,7 @@ private:
double gainchase; double gainchase;
double settingchase; double settingchase;
double chasespeed; double chasespeed;
uint32_t fpdL;
uint32_t fpdR;
float gain; float gain;

View file

@ -75,11 +75,11 @@ private:
double gainchase; double gainchase;
double settingchase; double settingchase;
double chasespeed; double chasespeed;
uint32_t fpdL;
uint32_t fpdR;
double fpNShapeL; double fpNShapeL;
double fpNShapeR; double fpNShapeR;
uint32_t fpdL;
uint32_t fpdR;
//default stuff //default stuff
float gain; float gain;
}; };

View file

@ -36,10 +36,10 @@ void Dark::processReplacing(float **inputs, float **outputs, VstInt32 sampleFram
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;
@ -151,10 +151,10 @@ void Dark::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sa
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;

View file

@ -41,22 +41,32 @@ void Deckwrecka::processReplacing(float **inputs, float **outputs, VstInt32 samp
bflip++; bflip++;
if (bflip < 1 || bflip > 3) bflip = 1; if (bflip < 1 || bflip > 3) bflip = 1;
randyL = (double(fpd)/UINT32_MAX); randyL = (double(fpdL)/UINT32_MAX);
randyL += (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
randyL += (double(fpd)/UINT32_MAX); randyL += (double(fpdL)/UINT32_MAX);
randyL += (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
randyL += (double(fpd)/UINT32_MAX); randyL += (double(fpdL)/UINT32_MAX);
randyL += (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
randyL += (double(fpdL)/UINT32_MAX);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
randyL += (double(fpdL)/UINT32_MAX);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
randyL += (double(fpdL)/UINT32_MAX);
randyL /= 6.0; randyL /= 6.0;
randyL *= wreck; //0 to 1 the noise, may not be needed randyL *= wreck; //0 to 1 the noise, may not be needed
//set up the noise //set up the noise
randyR = (double(fpd)/UINT32_MAX); randyR = (double(fpdR)/UINT32_MAX);
randyR += (double(fpd)/UINT32_MAX); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
randyR += (double(fpd)/UINT32_MAX); randyR += (double(fpdR)/UINT32_MAX);
randyR += (double(fpd)/UINT32_MAX); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
randyR += (double(fpd)/UINT32_MAX); randyR += (double(fpdR)/UINT32_MAX);
randyR += (double(fpd)/UINT32_MAX); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
randyR += (double(fpdR)/UINT32_MAX);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
randyR += (double(fpdR)/UINT32_MAX);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
randyR += (double(fpdR)/UINT32_MAX);
randyR /= 6.0; randyR /= 6.0;
randyR *= wreck; //0 to 1 the noise, may not be needed randyR *= wreck; //0 to 1 the noise, may not be needed
//set up the noise //set up the noise
@ -226,22 +236,32 @@ void Deckwrecka::processDoubleReplacing(double **inputs, double **outputs, VstIn
bflip++; bflip++;
if (bflip < 1 || bflip > 3) bflip = 1; if (bflip < 1 || bflip > 3) bflip = 1;
randyL = (double(fpd)/UINT32_MAX); randyL = (double(fpdL)/UINT32_MAX);
randyL += (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
randyL += (double(fpd)/UINT32_MAX); randyL += (double(fpdL)/UINT32_MAX);
randyL += (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
randyL += (double(fpd)/UINT32_MAX); randyL += (double(fpdL)/UINT32_MAX);
randyL += (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
randyL += (double(fpdL)/UINT32_MAX);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
randyL += (double(fpdL)/UINT32_MAX);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
randyL += (double(fpdL)/UINT32_MAX);
randyL /= 6.0; randyL /= 6.0;
randyL *= wreck; //0 to 1 the noise, may not be needed randyL *= wreck; //0 to 1 the noise, may not be needed
//set up the noise //set up the noise
randyR = (double(fpd)/UINT32_MAX); randyR = (double(fpdR)/UINT32_MAX);
randyR += (double(fpd)/UINT32_MAX); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
randyR += (double(fpd)/UINT32_MAX); randyR += (double(fpdR)/UINT32_MAX);
randyR += (double(fpd)/UINT32_MAX); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
randyR += (double(fpd)/UINT32_MAX); randyR += (double(fpdR)/UINT32_MAX);
randyR += (double(fpd)/UINT32_MAX); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
randyR += (double(fpdR)/UINT32_MAX);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
randyR += (double(fpdR)/UINT32_MAX);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
randyR += (double(fpdR)/UINT32_MAX);
randyR /= 6.0; randyR /= 6.0;
randyR *= wreck; //0 to 1 the noise, may not be needed randyR *= wreck; //0 to 1 the noise, may not be needed
//set up the noise //set up the noise

View file

@ -70,11 +70,11 @@ void DitherFloat::processReplacing(float **inputs, float **outputs, VstInt32 sam
//begin stereo 32 bit floating point dither //begin stereo 32 bit floating point dither
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; fpdL ^= fpdL<<13; fpdL ^= fpdL>>17; fpdL ^= fpdL<<5;
inputSampleL += (fpd*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo; inputSampleL += (fpdL*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo;
frexpf((float)inputSampleR, &expon); frexpf((float)inputSampleR, &expon);
fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; fpdR ^= fpdR<<13; fpdR ^= fpdR>>17; fpdR ^= fpdR<<5;
inputSampleR += (fpd*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo; inputSampleR += (fpdR*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo;
//end stereo 32 bit floating point dither //end stereo 32 bit floating point dither
@ -155,11 +155,11 @@ void DitherFloat::processDoubleReplacing(double **inputs, double **outputs, VstI
//begin stereo 32 bit floating point dither //begin stereo 32 bit floating point dither
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; fpdL ^= fpdL<<13; fpdL ^= fpdL>>17; fpdL ^= fpdL<<5;
inputSampleL += (fpd*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo; inputSampleL += (fpdL*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo;
frexpf((float)inputSampleR, &expon); frexpf((float)inputSampleR, &expon);
fpd ^= fpd<<13; fpd ^= fpd>>17; fpd ^= fpd<<5; fpdR ^= fpdR<<13; fpdR ^= fpdR>>17; fpdR ^= fpdR<<5;
inputSampleR += (fpd*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo; inputSampleR += (fpdR*3.4e-36l*pow(2,expon+62)* blend); //remove 'blend' for real use, it's for the demo;
//end stereo 32 bit floating point dither //end stereo 32 bit floating point dither

View file

@ -127,6 +127,9 @@ private:
double iirSampleYR; double iirSampleYR;
double iirSampleZR; double iirSampleZR;
uint32_t fpdL;
uint32_t fpdR;
float A; float A;
}; };

View file

@ -70,34 +70,36 @@ void Ditherbox::processReplacing(float **inputs, float **outputs, VstInt32 sampl
break; break;
case 2: case 2:
inputSampleL += (double(fpd)/UINT32_MAX); inputSampleL += (double(fpdL)/UINT32_MAX);
inputSampleL -= 0.5; inputSampleL -= 0.5;
inputSampleL = floor(inputSampleL); inputSampleL = floor(inputSampleL);
inputSampleR += (double(fpd)/UINT32_MAX); inputSampleR += (double(fpdR)/UINT32_MAX);
inputSampleR -= 0.5; inputSampleR -= 0.5;
inputSampleR = floor(inputSampleR); inputSampleR = floor(inputSampleR);
//flat dither //flat dither
break; break;
case 3: case 3:
inputSampleL += (double(fpd)/UINT32_MAX); inputSampleL += (double(fpdL)/UINT32_MAX);
inputSampleL += (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += (double(fpdL)/UINT32_MAX);
inputSampleL -= 1.0; inputSampleL -= 1.0;
inputSampleL = floor(inputSampleL); inputSampleL = floor(inputSampleL);
inputSampleR += (double(fpd)/UINT32_MAX); inputSampleR += (double(fpdR)/UINT32_MAX);
inputSampleR += (double(fpd)/UINT32_MAX); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += (double(fpdR)/UINT32_MAX);
inputSampleR -= 1.0; inputSampleR -= 1.0;
inputSampleR = floor(inputSampleR); inputSampleR = floor(inputSampleR);
//TPDF dither //TPDF dither
break; break;
case 4: case 4:
currentDitherL = (double(fpd)/UINT32_MAX); currentDitherL = (double(fpdL)/UINT32_MAX);
inputSampleL += currentDitherL; inputSampleL += currentDitherL;
inputSampleL -= lastSampleL; inputSampleL -= lastSampleL;
inputSampleL = floor(inputSampleL); inputSampleL = floor(inputSampleL);
lastSampleL = currentDitherL; lastSampleL = currentDitherL;
currentDitherR = (double(fpd)/UINT32_MAX); currentDitherR = (double(fpdR)/UINT32_MAX);
inputSampleR += currentDitherR; inputSampleR += currentDitherR;
inputSampleR -= lastSampleR; inputSampleR -= lastSampleR;
inputSampleR = floor(inputSampleR); inputSampleR = floor(inputSampleR);
@ -108,7 +110,7 @@ void Ditherbox::processReplacing(float **inputs, float **outputs, VstInt32 sampl
case 5: case 5:
nsL[9] = nsL[8]; nsL[8] = nsL[7]; nsL[7] = nsL[6]; nsL[6] = nsL[5]; nsL[9] = nsL[8]; nsL[8] = nsL[7]; nsL[7] = nsL[6]; nsL[6] = nsL[5];
nsL[5] = nsL[4]; nsL[4] = nsL[3]; nsL[3] = nsL[2]; nsL[2] = nsL[1]; nsL[5] = nsL[4]; nsL[4] = nsL[3]; nsL[3] = nsL[2]; nsL[2] = nsL[1];
nsL[1] = nsL[0]; nsL[0] = (double(fpd)/UINT32_MAX); nsL[1] = nsL[0]; nsL[0] = (double(fpdL)/UINT32_MAX);
currentDitherL = (nsL[0] * 0.061); currentDitherL = (nsL[0] * 0.061);
currentDitherL -= (nsL[1] * 0.11); currentDitherL -= (nsL[1] * 0.11);
@ -131,7 +133,7 @@ void Ditherbox::processReplacing(float **inputs, float **outputs, VstInt32 sampl
nsR[9] = nsR[8]; nsR[8] = nsR[7]; nsR[7] = nsR[6]; nsR[6] = nsR[5]; nsR[9] = nsR[8]; nsR[8] = nsR[7]; nsR[7] = nsR[6]; nsR[6] = nsR[5];
nsR[5] = nsR[4]; nsR[4] = nsR[3]; nsR[3] = nsR[2]; nsR[2] = nsR[1]; nsR[5] = nsR[4]; nsR[4] = nsR[3]; nsR[3] = nsR[2]; nsR[2] = nsR[1];
nsR[1] = nsR[0]; nsR[0] = (double(fpd)/UINT32_MAX); nsR[1] = nsR[0]; nsR[0] = (double(fpdR)/UINT32_MAX);
currentDitherR = (nsR[0] * 0.061); currentDitherR = (nsR[0] * 0.061);
currentDitherR -= (nsR[1] * 0.11); currentDitherR -= (nsR[1] * 0.11);
@ -156,8 +158,8 @@ void Ditherbox::processReplacing(float **inputs, float **outputs, VstInt32 sampl
break; break;
case 6: case 6:
currentDitherL = (double(fpd)/UINT32_MAX); currentDitherL = (double(fpdL)/UINT32_MAX);
currentDitherR = (double(fpd)/UINT32_MAX); currentDitherR = (double(fpdR)/UINT32_MAX);
inputSampleL += currentDitherL; inputSampleL += currentDitherL;
inputSampleR += currentDitherR; inputSampleR += currentDitherR;
@ -202,37 +204,52 @@ void Ditherbox::processReplacing(float **inputs, float **outputs, VstInt32 sampl
break; break;
case 8: case 8:
absSample = ((double(fpd)/UINT32_MAX) - 0.5); absSample = ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[0] += absSample; nsL[0] /= 2; absSample -= nsL[0]; nsL[0] += absSample; nsL[0] /= 2; absSample -= nsL[0];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[1] += absSample; nsL[1] /= 2; absSample -= nsL[1]; nsL[1] += absSample; nsL[1] /= 2; absSample -= nsL[1];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[2] += absSample; nsL[2] /= 2; absSample -= nsL[2]; nsL[2] += absSample; nsL[2] /= 2; absSample -= nsL[2];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[3] += absSample; nsL[3] /= 2; absSample -= nsL[3]; nsL[3] += absSample; nsL[3] /= 2; absSample -= nsL[3];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[4] += absSample; nsL[4] /= 2; absSample -= nsL[4]; nsL[4] += absSample; nsL[4] /= 2; absSample -= nsL[4];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[5] += absSample; nsL[5] /= 2; absSample -= nsL[5]; nsL[5] += absSample; nsL[5] /= 2; absSample -= nsL[5];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[6] += absSample; nsL[6] /= 2; absSample -= nsL[6]; nsL[6] += absSample; nsL[6] /= 2; absSample -= nsL[6];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[7] += absSample; nsL[7] /= 2; absSample -= nsL[7]; nsL[7] += absSample; nsL[7] /= 2; absSample -= nsL[7];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[8] += absSample; nsL[8] /= 2; absSample -= nsL[8]; nsL[8] += absSample; nsL[8] /= 2; absSample -= nsL[8];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[9] += absSample; nsL[9] /= 2; absSample -= nsL[9]; nsL[9] += absSample; nsL[9] /= 2; absSample -= nsL[9];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[10] += absSample; nsL[10] /= 2; absSample -= nsL[10]; nsL[10] += absSample; nsL[10] /= 2; absSample -= nsL[10];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[11] += absSample; nsL[11] /= 2; absSample -= nsL[11]; nsL[11] += absSample; nsL[11] /= 2; absSample -= nsL[11];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[12] += absSample; nsL[12] /= 2; absSample -= nsL[12]; nsL[12] += absSample; nsL[12] /= 2; absSample -= nsL[12];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[13] += absSample; nsL[13] /= 2; absSample -= nsL[13]; nsL[13] += absSample; nsL[13] /= 2; absSample -= nsL[13];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[14] += absSample; nsL[14] /= 2; absSample -= nsL[14]; nsL[14] += absSample; nsL[14] /= 2; absSample -= nsL[14];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[15] += absSample; nsL[15] /= 2; absSample -= nsL[15]; nsL[15] += absSample; nsL[15] /= 2; absSample -= nsL[15];
//install noise and then shape it //install noise and then shape it
absSample += inputSampleL; absSample += inputSampleL;
@ -249,37 +266,52 @@ void Ditherbox::processReplacing(float **inputs, float **outputs, VstInt32 sampl
//TenNines dither L //TenNines dither L
absSample = ((double(fpd)/UINT32_MAX) - 0.5); absSample = ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[0] += absSample; nsR[0] /= 2; absSample -= nsR[0]; nsR[0] += absSample; nsR[0] /= 2; absSample -= nsR[0];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[1] += absSample; nsR[1] /= 2; absSample -= nsR[1]; nsR[1] += absSample; nsR[1] /= 2; absSample -= nsR[1];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[2] += absSample; nsR[2] /= 2; absSample -= nsR[2]; nsR[2] += absSample; nsR[2] /= 2; absSample -= nsR[2];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[3] += absSample; nsR[3] /= 2; absSample -= nsR[3]; nsR[3] += absSample; nsR[3] /= 2; absSample -= nsR[3];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[4] += absSample; nsR[4] /= 2; absSample -= nsR[4]; nsR[4] += absSample; nsR[4] /= 2; absSample -= nsR[4];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[5] += absSample; nsR[5] /= 2; absSample -= nsR[5]; nsR[5] += absSample; nsR[5] /= 2; absSample -= nsR[5];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[6] += absSample; nsR[6] /= 2; absSample -= nsR[6]; nsR[6] += absSample; nsR[6] /= 2; absSample -= nsR[6];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[7] += absSample; nsR[7] /= 2; absSample -= nsR[7]; nsR[7] += absSample; nsR[7] /= 2; absSample -= nsR[7];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[8] += absSample; nsR[8] /= 2; absSample -= nsR[8]; nsR[8] += absSample; nsR[8] /= 2; absSample -= nsR[8];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[9] += absSample; nsR[9] /= 2; absSample -= nsR[9]; nsR[9] += absSample; nsR[9] /= 2; absSample -= nsR[9];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[10] += absSample; nsR[10] /= 2; absSample -= nsR[10]; nsR[10] += absSample; nsR[10] /= 2; absSample -= nsR[10];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[11] += absSample; nsR[11] /= 2; absSample -= nsR[11]; nsR[11] += absSample; nsR[11] /= 2; absSample -= nsR[11];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[12] += absSample; nsR[12] /= 2; absSample -= nsR[12]; nsR[12] += absSample; nsR[12] /= 2; absSample -= nsR[12];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[13] += absSample; nsR[13] /= 2; absSample -= nsR[13]; nsR[13] += absSample; nsR[13] /= 2; absSample -= nsR[13];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[14] += absSample; nsR[14] /= 2; absSample -= nsR[14]; nsR[14] += absSample; nsR[14] /= 2; absSample -= nsR[14];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[15] += absSample; nsR[15] /= 2; absSample -= nsR[15]; nsR[15] += absSample; nsR[15] /= 2; absSample -= nsR[15];
//install noise and then shape it //install noise and then shape it
absSample += inputSampleR; absSample += inputSampleR;
@ -303,7 +335,10 @@ void Ditherbox::processReplacing(float **inputs, float **outputs, VstInt32 sampl
if (inputSampleR < 0) inputSampleR -= 0.383; if (inputSampleR < 0) inputSampleR -= 0.383;
//adjusting to permit more information drug outta the noisefloor //adjusting to permit more information drug outta the noisefloor
contingentRnd = (((double(fpd)/UINT32_MAX)+(double(fpd)/UINT32_MAX))-1.0) * randyConstant; //produce TPDF dist, scale contingentRnd = (double(fpdL)/UINT32_MAX);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
contingentRnd += ((double(fpdL)/UINT32_MAX)-1.0);
contingentRnd *= randyConstant; //produce TPDF dist, scale
contingentRnd -= contingentErrL*omegaConstant; //include err contingentRnd -= contingentErrL*omegaConstant; //include err
absSample = fabs(inputSampleL); absSample = fabs(inputSampleL);
contingentErrL = absSample - floor(absSample); //get next err contingentErrL = absSample - floor(absSample); //get next err
@ -317,7 +352,10 @@ void Ditherbox::processReplacing(float **inputs, float **outputs, VstInt32 sampl
//Contingent Dither //Contingent Dither
inputSampleL = floor(inputSampleL); inputSampleL = floor(inputSampleL);
contingentRnd = (((double(fpd)/UINT32_MAX)+(double(fpd)/UINT32_MAX))-1.0) * randyConstant; //produce TPDF dist, scale contingentRnd = (double(fpdR)/UINT32_MAX);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
contingentRnd += ((double(fpdR)/UINT32_MAX)-1.0);
contingentRnd *= randyConstant; //produce TPDF dist, scale
contingentRnd -= contingentErrR*omegaConstant; //include err contingentRnd -= contingentErrR*omegaConstant; //include err
absSample = fabs(inputSampleR); absSample = fabs(inputSampleR);
contingentErrR = absSample - floor(absSample); //get next err contingentErrR = absSample - floor(absSample); //get next err
@ -339,11 +377,11 @@ void Ditherbox::processReplacing(float **inputs, float **outputs, VstInt32 sampl
case 10: //this one is the original Naturalize case 10: //this one is the original Naturalize
if (inputSampleL > 0) inputSampleL += (0.3333333333); if (inputSampleL > 0) inputSampleL += (0.3333333333);
if (inputSampleL < 0) inputSampleL -= (0.3333333333); if (inputSampleL < 0) inputSampleL -= (0.3333333333);
inputSampleL += (double(fpd)/UINT32_MAX)*0.6666666666; inputSampleL += (double(fpdL)/UINT32_MAX)*0.6666666666;
if (inputSampleR > 0) inputSampleR += (0.3333333333); if (inputSampleR > 0) inputSampleR += (0.3333333333);
if (inputSampleR < 0) inputSampleR -= (0.3333333333); if (inputSampleR < 0) inputSampleR -= (0.3333333333);
inputSampleR += (double(fpd)/UINT32_MAX)*0.6666666666; inputSampleR += (double(fpdR)/UINT32_MAX)*0.6666666666;
//begin L //begin L
benfordize = floor(inputSampleL); benfordize = floor(inputSampleL);
@ -900,12 +938,13 @@ void Ditherbox::processReplacing(float **inputs, float **outputs, VstInt32 sampl
if (inputSampleL > 0.0) inputSampleL = bridgerectifier; if (inputSampleL > 0.0) inputSampleL = bridgerectifier;
else inputSampleL = -bridgerectifier; else inputSampleL = -bridgerectifier;
silhouette = rand()/(double)RAND_MAX; silhouette = (double(fpdL)/UINT32_MAX);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
silhouette -= 0.5; silhouette -= 0.5;
silhouette *= 2.0; silhouette *= 2.0;
silhouette *= fabs(inputSampleL); silhouette *= fabs(inputSampleL);
smoother = rand()/(double)RAND_MAX; smoother = (double(fpdL)/UINT32_MAX);
smoother -= 0.5; smoother -= 0.5;
smoother *= 2.0; smoother *= 2.0;
smoother *= fabs(lastSampleL); smoother *= fabs(lastSampleL);
@ -930,12 +969,13 @@ void Ditherbox::processReplacing(float **inputs, float **outputs, VstInt32 sampl
if (inputSampleR > 0.0) inputSampleR = bridgerectifier; if (inputSampleR > 0.0) inputSampleR = bridgerectifier;
else inputSampleR = -bridgerectifier; else inputSampleR = -bridgerectifier;
silhouette = rand()/(double)RAND_MAX; silhouette = (double(fpdR)/UINT32_MAX);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
silhouette -= 0.5; silhouette -= 0.5;
silhouette *= 2.0; silhouette *= 2.0;
silhouette *= fabs(inputSampleR); silhouette *= fabs(inputSampleR);
smoother = rand()/(double)RAND_MAX; smoother = (double(fpdR)/UINT32_MAX);
smoother -= 0.5; smoother -= 0.5;
smoother *= 2.0; smoother *= 2.0;
smoother *= fabs(lastSampleR); smoother *= fabs(lastSampleR);
@ -965,7 +1005,7 @@ void Ditherbox::processReplacing(float **inputs, float **outputs, VstInt32 sampl
noiseShapingL += inputSampleL - drySampleL; noiseShapingL += inputSampleL - drySampleL;
noiseShapingR += inputSampleR - drySampleR; noiseShapingR += inputSampleR - drySampleR;
} }
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
//pseudorandom number updater //pseudorandom number updater
@ -1043,34 +1083,36 @@ void Ditherbox::processDoubleReplacing(double **inputs, double **outputs, VstInt
break; break;
case 2: case 2:
inputSampleL += (double(fpd)/UINT32_MAX); inputSampleL += (double(fpdL)/UINT32_MAX);
inputSampleL -= 0.5; inputSampleL -= 0.5;
inputSampleL = floor(inputSampleL); inputSampleL = floor(inputSampleL);
inputSampleR += (double(fpd)/UINT32_MAX); inputSampleR += (double(fpdR)/UINT32_MAX);
inputSampleR -= 0.5; inputSampleR -= 0.5;
inputSampleR = floor(inputSampleR); inputSampleR = floor(inputSampleR);
//flat dither //flat dither
break; break;
case 3: case 3:
inputSampleL += (double(fpd)/UINT32_MAX); inputSampleL += (double(fpdL)/UINT32_MAX);
inputSampleL += (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += (double(fpdL)/UINT32_MAX);
inputSampleL -= 1.0; inputSampleL -= 1.0;
inputSampleL = floor(inputSampleL); inputSampleL = floor(inputSampleL);
inputSampleR += (double(fpd)/UINT32_MAX); inputSampleR += (double(fpdR)/UINT32_MAX);
inputSampleR += (double(fpd)/UINT32_MAX); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += (double(fpdR)/UINT32_MAX);
inputSampleR -= 1.0; inputSampleR -= 1.0;
inputSampleR = floor(inputSampleR); inputSampleR = floor(inputSampleR);
//TPDF dither //TPDF dither
break; break;
case 4: case 4:
currentDitherL = (double(fpd)/UINT32_MAX); currentDitherL = (double(fpdL)/UINT32_MAX);
inputSampleL += currentDitherL; inputSampleL += currentDitherL;
inputSampleL -= lastSampleL; inputSampleL -= lastSampleL;
inputSampleL = floor(inputSampleL); inputSampleL = floor(inputSampleL);
lastSampleL = currentDitherL; lastSampleL = currentDitherL;
currentDitherR = (double(fpd)/UINT32_MAX); currentDitherR = (double(fpdR)/UINT32_MAX);
inputSampleR += currentDitherR; inputSampleR += currentDitherR;
inputSampleR -= lastSampleR; inputSampleR -= lastSampleR;
inputSampleR = floor(inputSampleR); inputSampleR = floor(inputSampleR);
@ -1081,7 +1123,7 @@ void Ditherbox::processDoubleReplacing(double **inputs, double **outputs, VstInt
case 5: case 5:
nsL[9] = nsL[8]; nsL[8] = nsL[7]; nsL[7] = nsL[6]; nsL[6] = nsL[5]; nsL[9] = nsL[8]; nsL[8] = nsL[7]; nsL[7] = nsL[6]; nsL[6] = nsL[5];
nsL[5] = nsL[4]; nsL[4] = nsL[3]; nsL[3] = nsL[2]; nsL[2] = nsL[1]; nsL[5] = nsL[4]; nsL[4] = nsL[3]; nsL[3] = nsL[2]; nsL[2] = nsL[1];
nsL[1] = nsL[0]; nsL[0] = (double(fpd)/UINT32_MAX); nsL[1] = nsL[0]; nsL[0] = (double(fpdL)/UINT32_MAX);
currentDitherL = (nsL[0] * 0.061); currentDitherL = (nsL[0] * 0.061);
currentDitherL -= (nsL[1] * 0.11); currentDitherL -= (nsL[1] * 0.11);
@ -1104,7 +1146,7 @@ void Ditherbox::processDoubleReplacing(double **inputs, double **outputs, VstInt
nsR[9] = nsR[8]; nsR[8] = nsR[7]; nsR[7] = nsR[6]; nsR[6] = nsR[5]; nsR[9] = nsR[8]; nsR[8] = nsR[7]; nsR[7] = nsR[6]; nsR[6] = nsR[5];
nsR[5] = nsR[4]; nsR[4] = nsR[3]; nsR[3] = nsR[2]; nsR[2] = nsR[1]; nsR[5] = nsR[4]; nsR[4] = nsR[3]; nsR[3] = nsR[2]; nsR[2] = nsR[1];
nsR[1] = nsR[0]; nsR[0] = (double(fpd)/UINT32_MAX); nsR[1] = nsR[0]; nsR[0] = (double(fpdR)/UINT32_MAX);
currentDitherR = (nsR[0] * 0.061); currentDitherR = (nsR[0] * 0.061);
currentDitherR -= (nsR[1] * 0.11); currentDitherR -= (nsR[1] * 0.11);
@ -1128,8 +1170,8 @@ void Ditherbox::processDoubleReplacing(double **inputs, double **outputs, VstInt
break; break;
case 6: case 6:
currentDitherL = (double(fpd)/UINT32_MAX); currentDitherL = (double(fpdL)/UINT32_MAX);
currentDitherR = (double(fpd)/UINT32_MAX); currentDitherR = (double(fpdR)/UINT32_MAX);
inputSampleL += currentDitherL; inputSampleL += currentDitherL;
inputSampleR += currentDitherR; inputSampleR += currentDitherR;
@ -1174,37 +1216,52 @@ void Ditherbox::processDoubleReplacing(double **inputs, double **outputs, VstInt
break; break;
case 8: case 8:
absSample = ((double(fpd)/UINT32_MAX) - 0.5); absSample = ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[0] += absSample; nsL[0] /= 2; absSample -= nsL[0]; nsL[0] += absSample; nsL[0] /= 2; absSample -= nsL[0];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[1] += absSample; nsL[1] /= 2; absSample -= nsL[1]; nsL[1] += absSample; nsL[1] /= 2; absSample -= nsL[1];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[2] += absSample; nsL[2] /= 2; absSample -= nsL[2]; nsL[2] += absSample; nsL[2] /= 2; absSample -= nsL[2];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[3] += absSample; nsL[3] /= 2; absSample -= nsL[3]; nsL[3] += absSample; nsL[3] /= 2; absSample -= nsL[3];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[4] += absSample; nsL[4] /= 2; absSample -= nsL[4]; nsL[4] += absSample; nsL[4] /= 2; absSample -= nsL[4];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[5] += absSample; nsL[5] /= 2; absSample -= nsL[5]; nsL[5] += absSample; nsL[5] /= 2; absSample -= nsL[5];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[6] += absSample; nsL[6] /= 2; absSample -= nsL[6]; nsL[6] += absSample; nsL[6] /= 2; absSample -= nsL[6];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[7] += absSample; nsL[7] /= 2; absSample -= nsL[7]; nsL[7] += absSample; nsL[7] /= 2; absSample -= nsL[7];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[8] += absSample; nsL[8] /= 2; absSample -= nsL[8]; nsL[8] += absSample; nsL[8] /= 2; absSample -= nsL[8];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[9] += absSample; nsL[9] /= 2; absSample -= nsL[9]; nsL[9] += absSample; nsL[9] /= 2; absSample -= nsL[9];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[10] += absSample; nsL[10] /= 2; absSample -= nsL[10]; nsL[10] += absSample; nsL[10] /= 2; absSample -= nsL[10];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[11] += absSample; nsL[11] /= 2; absSample -= nsL[11]; nsL[11] += absSample; nsL[11] /= 2; absSample -= nsL[11];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[12] += absSample; nsL[12] /= 2; absSample -= nsL[12]; nsL[12] += absSample; nsL[12] /= 2; absSample -= nsL[12];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[13] += absSample; nsL[13] /= 2; absSample -= nsL[13]; nsL[13] += absSample; nsL[13] /= 2; absSample -= nsL[13];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
nsL[14] += absSample; nsL[14] /= 2; absSample -= nsL[14]; nsL[14] += absSample; nsL[14] /= 2; absSample -= nsL[14];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[15] += absSample; nsL[15] /= 2; absSample -= nsL[15]; nsL[15] += absSample; nsL[15] /= 2; absSample -= nsL[15];
//install noise and then shape it //install noise and then shape it
absSample += inputSampleL; absSample += inputSampleL;
@ -1221,37 +1278,52 @@ void Ditherbox::processDoubleReplacing(double **inputs, double **outputs, VstInt
//TenNines dither L //TenNines dither L
absSample = ((double(fpd)/UINT32_MAX) - 0.5); absSample = ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[0] += absSample; nsR[0] /= 2; absSample -= nsR[0]; nsR[0] += absSample; nsR[0] /= 2; absSample -= nsR[0];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[1] += absSample; nsR[1] /= 2; absSample -= nsR[1]; nsR[1] += absSample; nsR[1] /= 2; absSample -= nsR[1];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[2] += absSample; nsR[2] /= 2; absSample -= nsR[2]; nsR[2] += absSample; nsR[2] /= 2; absSample -= nsR[2];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[3] += absSample; nsR[3] /= 2; absSample -= nsR[3]; nsR[3] += absSample; nsR[3] /= 2; absSample -= nsR[3];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[4] += absSample; nsR[4] /= 2; absSample -= nsR[4]; nsR[4] += absSample; nsR[4] /= 2; absSample -= nsR[4];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[5] += absSample; nsR[5] /= 2; absSample -= nsR[5]; nsR[5] += absSample; nsR[5] /= 2; absSample -= nsR[5];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[6] += absSample; nsR[6] /= 2; absSample -= nsR[6]; nsR[6] += absSample; nsR[6] /= 2; absSample -= nsR[6];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[7] += absSample; nsR[7] /= 2; absSample -= nsR[7]; nsR[7] += absSample; nsR[7] /= 2; absSample -= nsR[7];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[8] += absSample; nsR[8] /= 2; absSample -= nsR[8]; nsR[8] += absSample; nsR[8] /= 2; absSample -= nsR[8];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[9] += absSample; nsR[9] /= 2; absSample -= nsR[9]; nsR[9] += absSample; nsR[9] /= 2; absSample -= nsR[9];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[10] += absSample; nsR[10] /= 2; absSample -= nsR[10]; nsR[10] += absSample; nsR[10] /= 2; absSample -= nsR[10];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[11] += absSample; nsR[11] /= 2; absSample -= nsR[11]; nsR[11] += absSample; nsR[11] /= 2; absSample -= nsR[11];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[12] += absSample; nsR[12] /= 2; absSample -= nsR[12]; nsR[12] += absSample; nsR[12] /= 2; absSample -= nsR[12];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[13] += absSample; nsR[13] /= 2; absSample -= nsR[13]; nsR[13] += absSample; nsR[13] /= 2; absSample -= nsR[13];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
nsR[14] += absSample; nsR[14] /= 2; absSample -= nsR[14]; nsR[14] += absSample; nsR[14] /= 2; absSample -= nsR[14];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[15] += absSample; nsR[15] /= 2; absSample -= nsR[15]; nsR[15] += absSample; nsR[15] /= 2; absSample -= nsR[15];
//install noise and then shape it //install noise and then shape it
absSample += inputSampleR; absSample += inputSampleR;
@ -1275,7 +1347,10 @@ void Ditherbox::processDoubleReplacing(double **inputs, double **outputs, VstInt
if (inputSampleR < 0) inputSampleR -= 0.383; if (inputSampleR < 0) inputSampleR -= 0.383;
//adjusting to permit more information drug outta the noisefloor //adjusting to permit more information drug outta the noisefloor
contingentRnd = (((double(fpd)/UINT32_MAX)+(double(fpd)/UINT32_MAX))-1.0) * randyConstant; //produce TPDF dist, scale contingentRnd = (double(fpdL)/UINT32_MAX);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
contingentRnd += ((double(fpdL)/UINT32_MAX)-1.0);
contingentRnd *= randyConstant; //produce TPDF dist, scale
contingentRnd -= contingentErrL*omegaConstant; //include err contingentRnd -= contingentErrL*omegaConstant; //include err
absSample = fabs(inputSampleL); absSample = fabs(inputSampleL);
contingentErrL = absSample - floor(absSample); //get next err contingentErrL = absSample - floor(absSample); //get next err
@ -1289,7 +1364,10 @@ void Ditherbox::processDoubleReplacing(double **inputs, double **outputs, VstInt
//Contingent Dither //Contingent Dither
inputSampleL = floor(inputSampleL); inputSampleL = floor(inputSampleL);
contingentRnd = (((double(fpd)/UINT32_MAX)+(double(fpd)/UINT32_MAX))-1.0) * randyConstant; //produce TPDF dist, scale contingentRnd = (double(fpdR)/UINT32_MAX);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
contingentRnd += ((double(fpdR)/UINT32_MAX)-1.0);
contingentRnd *= randyConstant; //produce TPDF dist, scale
contingentRnd -= contingentErrR*omegaConstant; //include err contingentRnd -= contingentErrR*omegaConstant; //include err
absSample = fabs(inputSampleR); absSample = fabs(inputSampleR);
contingentErrR = absSample - floor(absSample); //get next err contingentErrR = absSample - floor(absSample); //get next err
@ -1311,11 +1389,11 @@ void Ditherbox::processDoubleReplacing(double **inputs, double **outputs, VstInt
case 10: //this one is the original Naturalize case 10: //this one is the original Naturalize
if (inputSampleL > 0) inputSampleL += (0.3333333333); if (inputSampleL > 0) inputSampleL += (0.3333333333);
if (inputSampleL < 0) inputSampleL -= (0.3333333333); if (inputSampleL < 0) inputSampleL -= (0.3333333333);
inputSampleL += (double(fpd)/UINT32_MAX)*0.6666666666; inputSampleL += (double(fpdL)/UINT32_MAX)*0.6666666666;
if (inputSampleR > 0) inputSampleR += (0.3333333333); if (inputSampleR > 0) inputSampleR += (0.3333333333);
if (inputSampleR < 0) inputSampleR -= (0.3333333333); if (inputSampleR < 0) inputSampleR -= (0.3333333333);
inputSampleR += (double(fpd)/UINT32_MAX)*0.6666666666; inputSampleR += (double(fpdR)/UINT32_MAX)*0.6666666666;
//begin L //begin L
benfordize = floor(inputSampleL); benfordize = floor(inputSampleL);
@ -1872,12 +1950,13 @@ void Ditherbox::processDoubleReplacing(double **inputs, double **outputs, VstInt
if (inputSampleL > 0.0) inputSampleL = bridgerectifier; if (inputSampleL > 0.0) inputSampleL = bridgerectifier;
else inputSampleL = -bridgerectifier; else inputSampleL = -bridgerectifier;
silhouette = rand()/(double)RAND_MAX; silhouette = (double(fpdL)/UINT32_MAX);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
silhouette -= 0.5; silhouette -= 0.5;
silhouette *= 2.0; silhouette *= 2.0;
silhouette *= fabs(inputSampleL); silhouette *= fabs(inputSampleL);
smoother = rand()/(double)RAND_MAX; smoother = (double(fpdL)/UINT32_MAX);
smoother -= 0.5; smoother -= 0.5;
smoother *= 2.0; smoother *= 2.0;
smoother *= fabs(lastSampleL); smoother *= fabs(lastSampleL);
@ -1902,12 +1981,13 @@ void Ditherbox::processDoubleReplacing(double **inputs, double **outputs, VstInt
if (inputSampleR > 0.0) inputSampleR = bridgerectifier; if (inputSampleR > 0.0) inputSampleR = bridgerectifier;
else inputSampleR = -bridgerectifier; else inputSampleR = -bridgerectifier;
silhouette = rand()/(double)RAND_MAX; silhouette = (double(fpdR)/UINT32_MAX);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
silhouette -= 0.5; silhouette -= 0.5;
silhouette *= 2.0; silhouette *= 2.0;
silhouette *= fabs(inputSampleR); silhouette *= fabs(inputSampleR);
smoother = rand()/(double)RAND_MAX; smoother = (double(fpdR)/UINT32_MAX);
smoother -= 0.5; smoother -= 0.5;
smoother *= 2.0; smoother *= 2.0;
smoother *= fabs(lastSampleR); smoother *= fabs(lastSampleR);
@ -1937,7 +2017,7 @@ void Ditherbox::processDoubleReplacing(double **inputs, double **outputs, VstInt
noiseShapingL += inputSampleL - drySampleL; noiseShapingL += inputSampleL - drySampleL;
noiseShapingR += inputSampleR - drySampleR; noiseShapingR += inputSampleR - drySampleR;
} }
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
//pseudorandom number updater //pseudorandom number updater

View file

@ -52,7 +52,9 @@ private:
std::set< std::string > _canDo; std::set< std::string > _canDo;
double bL[11]; double bL[11];
double bR[11]; double bR[11];
uint32_t fpdL;
uint32_t fpdR;
}; };

View file

@ -33,7 +33,7 @@ void DoublePaul::processReplacing(float **inputs, float **outputs, VstInt32 samp
bL[9] = bL[8]; bL[8] = bL[7]; bL[7] = bL[6]; bL[6] = bL[5]; bL[9] = bL[8]; bL[8] = bL[7]; bL[7] = bL[6]; bL[6] = bL[5];
bL[5] = bL[4]; bL[4] = bL[3]; bL[3] = bL[2]; bL[2] = bL[1]; bL[5] = bL[4]; bL[4] = bL[3]; bL[3] = bL[2]; bL[2] = bL[1];
bL[1] = bL[0]; bL[0] = (double(fpd)/UINT32_MAX); bL[1] = bL[0]; bL[0] = (double(fpdL)/UINT32_MAX);
currentDitherL = (bL[0] * 0.061); currentDitherL = (bL[0] * 0.061);
currentDitherL -= (bL[1] * 0.11); currentDitherL -= (bL[1] * 0.11);
@ -56,7 +56,7 @@ void DoublePaul::processReplacing(float **inputs, float **outputs, VstInt32 samp
bR[9] = bR[8]; bR[8] = bR[7]; bR[7] = bR[6]; bR[6] = bR[5]; bR[9] = bR[8]; bR[8] = bR[7]; bR[7] = bR[6]; bR[6] = bR[5];
bR[5] = bR[4]; bR[4] = bR[3]; bR[3] = bR[2]; bR[2] = bR[1]; bR[5] = bR[4]; bR[4] = bR[3]; bR[3] = bR[2]; bR[2] = bR[1];
bR[1] = bR[0]; bR[0] = (double(fpd)/UINT32_MAX); bR[1] = bR[0]; bR[0] = (double(fpdR)/UINT32_MAX);
currentDitherR = (bR[0] * 0.061); currentDitherR = (bR[0] * 0.061);
currentDitherR -= (bR[1] * 0.11); currentDitherR -= (bR[1] * 0.11);
@ -120,7 +120,7 @@ void DoublePaul::processDoubleReplacing(double **inputs, double **outputs, VstIn
bL[9] = bL[8]; bL[8] = bL[7]; bL[7] = bL[6]; bL[6] = bL[5]; bL[9] = bL[8]; bL[8] = bL[7]; bL[7] = bL[6]; bL[6] = bL[5];
bL[5] = bL[4]; bL[4] = bL[3]; bL[3] = bL[2]; bL[2] = bL[1]; bL[5] = bL[4]; bL[4] = bL[3]; bL[3] = bL[2]; bL[2] = bL[1];
bL[1] = bL[0]; bL[0] = (double(fpd)/UINT32_MAX); bL[1] = bL[0]; bL[0] = (double(fpdL)/UINT32_MAX);
currentDitherL = (bL[0] * 0.061); currentDitherL = (bL[0] * 0.061);
currentDitherL -= (bL[1] * 0.11); currentDitherL -= (bL[1] * 0.11);
@ -143,7 +143,7 @@ void DoublePaul::processDoubleReplacing(double **inputs, double **outputs, VstIn
bR[9] = bR[8]; bR[8] = bR[7]; bR[7] = bR[6]; bR[6] = bR[5]; bR[9] = bR[8]; bR[8] = bR[7]; bR[7] = bR[6]; bR[6] = bR[5];
bR[5] = bR[4]; bR[4] = bR[3]; bR[3] = bR[2]; bR[2] = bR[1]; bR[5] = bR[4]; bR[4] = bR[3]; bR[3] = bR[2]; bR[2] = bR[1];
bR[1] = bR[0]; bR[0] = (double(fpd)/UINT32_MAX); bR[1] = bR[0]; bR[0] = (double(fpdR)/UINT32_MAX);
currentDitherR = (bR[0] * 0.061); currentDitherR = (bR[0] * 0.061);
currentDitherR -= (bR[1] * 0.11); currentDitherR -= (bR[1] * 0.11);

View file

@ -42,7 +42,6 @@ void DubCenter::processReplacing(float **inputs, float **outputs, VstInt32 sampl
double out; double out;
double fuzz = 0.111; double fuzz = 0.111;
double wet = J; double wet = J;
double dry = 1.0-wet;
double glitch = 0.60; double glitch = 0.60;
double tempSample; double tempSample;
@ -155,7 +154,7 @@ void DubCenter::processReplacing(float **inputs, float **outputs, VstInt32 sampl
{if (WasNegative){SubOctave = !SubOctave;} WasNegative = false;} {if (WasNegative){SubOctave = !SubOctave;} WasNegative = false;}
else {WasNegative = true;} else {WasNegative = true;}
//set up polarities for sub-bass version //set up polarities for sub-bass version
randy = (double(fpd)/UINT32_MAX)*fuzz; //0 to 1 the noise, may not be needed randy = (double(fpdL)/UINT32_MAX)*fuzz; //0 to 1 the noise, may not be needed
invrandy = (1.0-randy); invrandy = (1.0-randy);
randy /= 2.0; randy /= 2.0;
//set up the noise //set up the noise
@ -326,7 +325,6 @@ void DubCenter::processDoubleReplacing(double **inputs, double **outputs, VstInt
double out; double out;
double fuzz = 0.111; double fuzz = 0.111;
double wet = J; double wet = J;
double dry = 1.0-wet;
double glitch = 0.60; double glitch = 0.60;
double tempSample; double tempSample;
@ -438,7 +436,7 @@ void DubCenter::processDoubleReplacing(double **inputs, double **outputs, VstInt
{if (WasNegative){SubOctave = !SubOctave;} WasNegative = false;} {if (WasNegative){SubOctave = !SubOctave;} WasNegative = false;}
else {WasNegative = true;} else {WasNegative = true;}
//set up polarities for sub-bass version //set up polarities for sub-bass version
randy = (double(fpd)/UINT32_MAX)*fuzz; //0 to 1 the noise, may not be needed randy = (double(fpdL)/UINT32_MAX)*fuzz; //0 to 1 the noise, may not be needed
invrandy = (1.0-randy); invrandy = (1.0-randy);
randy /= 2.0; randy /= 2.0;
//set up the noise //set up the noise

View file

@ -46,7 +46,6 @@ void DubSub::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
double out; double out;
double fuzz = 0.111; double fuzz = 0.111;
double wet = J; double wet = J;
double dry = 1.0-wet;
double glitch = 0.60; double glitch = 0.60;
double tempSampleL; double tempSampleL;
double tempSampleR; double tempSampleR;
@ -194,11 +193,11 @@ void DubSub::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
else {WasNegativeR = true;} else {WasNegativeR = true;}
//set up polarities for sub-bass version //set up polarities for sub-bass version
randyL = (double(fpd)/UINT32_MAX)*fuzz; //0 to 1 the noise, may not be needed randyL = (double(fpdL)/UINT32_MAX)*fuzz; //0 to 1 the noise, may not be needed
invrandyL = (1.0-randyL); invrandyL = (1.0-randyL);
randyL /= 2.0; randyL /= 2.0;
randyR = (double(fpd)/UINT32_MAX)*fuzz; //0 to 1 the noise, may not be needed randyR = (double(fpdR)/UINT32_MAX)*fuzz; //0 to 1 the noise, may not be needed
invrandyR = (1.0-randyR); invrandyR = (1.0-randyR);
randyR /= 2.0; randyR /= 2.0;
//set up the noise //set up the noise
@ -450,7 +449,6 @@ void DubSub::processDoubleReplacing(double **inputs, double **outputs, VstInt32
double out; double out;
double fuzz = 0.111; double fuzz = 0.111;
double wet = J; double wet = J;
double dry = 1.0-wet;
double glitch = 0.60; double glitch = 0.60;
double tempSampleL; double tempSampleL;
double tempSampleR; double tempSampleR;
@ -597,11 +595,11 @@ void DubSub::processDoubleReplacing(double **inputs, double **outputs, VstInt32
else {WasNegativeR = true;} else {WasNegativeR = true;}
//set up polarities for sub-bass version //set up polarities for sub-bass version
randyL = (double(fpd)/UINT32_MAX)*fuzz; //0 to 1 the noise, may not be needed randyL = (double(fpdL)/UINT32_MAX)*fuzz; //0 to 1 the noise, may not be needed
invrandyL = (1.0-randyL); invrandyL = (1.0-randyL);
randyL /= 2.0; randyL /= 2.0;
randyR = (double(fpd)/UINT32_MAX)*fuzz; //0 to 1 the noise, may not be needed randyR = (double(fpdR)/UINT32_MAX)*fuzz; //0 to 1 the noise, may not be needed
invrandyR = (1.0-randyR); invrandyR = (1.0-randyR);
randyR /= 2.0; randyR /= 2.0;
//set up the noise //set up the noise

View file

@ -85,6 +85,9 @@ private:
bool LataFlip; //end defining of antialiasing variables bool LataFlip; //end defining of antialiasing variables
bool RataFlip; //end defining of antialiasing variables bool RataFlip; //end defining of antialiasing variables
uint32_t fpdL;
uint32_t fpdR;
float A; float A;
}; };

View file

@ -36,15 +36,17 @@ void EdIsDim::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
mid = (inputSampleL+inputSampleR)/2.0; mid = (inputSampleL+inputSampleR)/2.0;
side = (inputSampleL-inputSampleR)/2.0; side = (inputSampleL-inputSampleR)/2.0;
//stereo 32 bit dither, made small and tidy. //begin 32 bit floating point dither
int expon; frexpf((float)mid, &expon); int expon; frexpf((float)mid, &expon);
double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
mid += (dither-fpNShapeL); fpNShapeL = dither; mid += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit floating point dither
//begin 32 bit floating point dither
frexpf((float)side, &expon); frexpf((float)side, &expon);
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
side += (dither-fpNShapeR); fpNShapeR = dither; side += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit dither //end 32 bit floating point dither
*out1 = mid; *out1 = mid;
*out2 = side; *out2 = side;
@ -86,14 +88,14 @@ void EdIsDim::processDoubleReplacing(double **inputs, double **outputs, VstInt32
side = (inputSampleL-inputSampleR)/2.0; side = (inputSampleL-inputSampleR)/2.0;
//stereo 64 bit dither, made small and tidy. //stereo 64 bit dither, made small and tidy.
int expon; frexp((double)mid, &expon); //int expon; frexpf((float)mid, &expon);
double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
dither /= 536870912.0; //needs this to scale to 64 bit zone //mid += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
mid += (dither-fpNShapeL); fpNShapeL = dither; //end 32 bit floating point dither
frexp((double)side, &expon); //begin 32 bit floating point dither
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); //frexpf((float)side, &expon);
dither /= 536870912.0; //needs this to scale to 64 bit zone fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
side += (dither-fpNShapeR); fpNShapeR = dither; //side += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 64 bit dither //end 64 bit dither
*out1 = mid; *out1 = mid;

View file

@ -258,12 +258,12 @@ void Elation::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
flip = !flip; flip = !flip;
randy = ((double(fpd)/UINT32_MAX)*0.054); randy = ((double(fpdL)/UINT32_MAX)*0.054);
outputSample = ((((inputSampleL*(1-randy))+(lastSampleL*randy))*wet)+(drySampleL*(1.0-wet))) * outlevel; outputSample = ((((inputSampleL*(1-randy))+(lastSampleL*randy))*wet)+(drySampleL*(1.0-wet))) * outlevel;
lastSampleL = inputSampleL; lastSampleL = inputSampleL;
inputSampleL = outputSample; inputSampleL = outputSample;
randy = ((double(fpd)/UINT32_MAX)*0.054); randy = ((double(fpdR)/UINT32_MAX)*0.054);
outputSample = ((((inputSampleR*(1-randy))+(lastSampleR*randy))*wet)+(drySampleR*(1.0-wet))) * outlevel; outputSample = ((((inputSampleR*(1-randy))+(lastSampleR*randy))*wet)+(drySampleR*(1.0-wet))) * outlevel;
lastSampleR = inputSampleR; lastSampleR = inputSampleR;
inputSampleR = outputSample; inputSampleR = outputSample;
@ -538,12 +538,12 @@ void Elation::processDoubleReplacing(double **inputs, double **outputs, VstInt32
flip = !flip; flip = !flip;
randy = ((double(fpd)/UINT32_MAX)*0.054); randy = ((double(fpdL)/UINT32_MAX)*0.054);
outputSample = ((((inputSampleL*(1-randy))+(lastSampleL*randy))*wet)+(drySampleL*(1.0-wet))) * outlevel; outputSample = ((((inputSampleL*(1-randy))+(lastSampleL*randy))*wet)+(drySampleL*(1.0-wet))) * outlevel;
lastSampleL = inputSampleL; lastSampleL = inputSampleL;
inputSampleL = outputSample; inputSampleL = outputSample;
randy = ((double(fpd)/UINT32_MAX)*0.054); randy = ((double(fpdR)/UINT32_MAX)*0.054);
outputSample = ((((inputSampleR*(1-randy))+(lastSampleR*randy))*wet)+(drySampleR*(1.0-wet))) * outlevel; outputSample = ((((inputSampleR*(1-randy))+(lastSampleR*randy))*wet)+(drySampleR*(1.0-wet))) * outlevel;
lastSampleR = inputSampleR; lastSampleR = inputSampleR;
inputSampleR = outputSample; inputSampleR = outputSample;

View file

@ -33,7 +33,6 @@ void ElectroHat::processReplacing(float **inputs, float **outputs, VstInt32 samp
double brighten = C; double brighten = C;
double outputlevel = D; double outputlevel = D;
double wet = E; double wet = E;
double dry = 1.0-wet;
if (deSyn == 4) {deSyn = 1; increment = 0.411; brighten = 0.87;} if (deSyn == 4) {deSyn = 1; increment = 0.411; brighten = 0.87;}
//606 preset //606 preset
@ -168,7 +167,6 @@ void ElectroHat::processDoubleReplacing(double **inputs, double **outputs, VstIn
double brighten = C; double brighten = C;
double outputlevel = D; double outputlevel = D;
double wet = E; double wet = E;
double dry = 1.0-wet;
if (deSyn == 4) {deSyn = 1; increment = 0.411; brighten = 0.87;} if (deSyn == 4) {deSyn = 1; increment = 0.411; brighten = 0.87;}
//606 preset //606 preset

View file

@ -17,7 +17,6 @@ void Energy2::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
double overallscale = 1.0; double overallscale = 1.0;
overallscale /= 44100.0; overallscale /= 44100.0;
overallscale *= getSampleRate(); overallscale *= getSampleRate();
int cycleEnd = floor(overallscale); int cycleEnd = floor(overallscale);
if (cycleEnd < 1) cycleEnd = 1; if (cycleEnd < 1) cycleEnd = 1;
if (cycleEnd > 4) cycleEnd = 4; if (cycleEnd > 4) cycleEnd = 4;
@ -660,7 +659,6 @@ void Energy2::processDoubleReplacing(double **inputs, double **outputs, VstInt32
double overallscale = 1.0; double overallscale = 1.0;
overallscale /= 44100.0; overallscale /= 44100.0;
overallscale *= getSampleRate(); overallscale *= getSampleRate();
int cycleEnd = floor(overallscale); int cycleEnd = floor(overallscale);
if (cycleEnd < 1) cycleEnd = 1; if (cycleEnd < 1) cycleEnd = 1;
if (cycleEnd > 4) cycleEnd = 4; if (cycleEnd > 4) cycleEnd = 4;

View file

@ -74,6 +74,8 @@ private:
float C; //Frequency float C; //Frequency
float D; //Dry/Wet float D; //Dry/Wet
//parameters. Always 0-1, and we scale/alter them elsewhere. //parameters. Always 0-1, and we scale/alter them elsewhere.
uint32_t fpdL;
uint32_t fpdR;
}; };
#endif #endif

View file

@ -32,7 +32,6 @@ void Floor::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra
if (iirAmount <= 0.0) iirAmount = 0.0; if (iirAmount <= 0.0) iirAmount = 0.0;
if (iirAmount > 1.0) iirAmount = 1.0; if (iirAmount > 1.0) iirAmount = 1.0;
double wet = C; double wet = C;
double dry = 1.0-wet;
while (--sampleFrames >= 0) while (--sampleFrames >= 0)
{ {
@ -257,7 +256,6 @@ void Floor::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s
if (iirAmount <= 0.0) iirAmount = 0.0; if (iirAmount <= 0.0) iirAmount = 0.0;
if (iirAmount > 1.0) iirAmount = 1.0; if (iirAmount > 1.0) iirAmount = 1.0;
double wet = C; double wet = C;
double dry = 1.0-wet;
while (--sampleFrames >= 0) while (--sampleFrames >= 0)
{ {

View file

@ -55,7 +55,7 @@ void FromTape::processReplacing(float **inputs, float **outputs, VstInt32 sample
inputSampleR *= inputgain; inputSampleR *= inputgain;
} }
randy = (double(fpd)/UINT32_MAX) * SoftenControl; //for soften randy = (double(fpdL)/UINT32_MAX) * SoftenControl; //for soften
invrandy = (1.0-randy); invrandy = (1.0-randy);
randy /= 2.0; randy /= 2.0;
//we've set up so that we dial in the amount of the alt sections (in pairs) with invrandy being the source section //we've set up so that we dial in the amount of the alt sections (in pairs) with invrandy being the source section
@ -252,7 +252,7 @@ void FromTape::processDoubleReplacing(double **inputs, double **outputs, VstInt3
inputSampleR *= inputgain; inputSampleR *= inputgain;
} }
randy = (double(fpd)/UINT32_MAX) * SoftenControl; //for soften randy = (double(fpdL)/UINT32_MAX) * SoftenControl; //for soften
invrandy = (1.0-randy); invrandy = (1.0-randy);
randy /= 2.0; randy /= 2.0;
//we've set up so that we dial in the amount of the alt sections (in pairs) with invrandy being the source section //we've set up so that we dial in the amount of the alt sections (in pairs) with invrandy being the source section

View file

@ -24,7 +24,6 @@ void HardVacuum::processReplacing(float **inputs, float **outputs, VstInt32 samp
double aura = C*3.1415926; double aura = C*3.1415926;
double out = D; double out = D;
double wet = E; double wet = E;
double dry = 1.0-wet;
double drive; double drive;
double positive; double positive;
double negative; double negative;
@ -173,7 +172,6 @@ void HardVacuum::processDoubleReplacing(double **inputs, double **outputs, VstIn
double aura = C*3.1415926; double aura = C*3.1415926;
double out = D; double out = D;
double wet = E; double wet = E;
double dry = 1.0-wet;
double drive; double drive;
double positive; double positive;
double negative; double negative;

View file

@ -53,6 +53,8 @@ private:
int Position; int Position;
bool flip; bool flip;
uint32_t fpdL;
uint32_t fpdR;
}; };
#endif #endif

View file

@ -76,7 +76,7 @@ void IronOxide5::processReplacing(float **inputs, float **outputs, VstInt32 samp
drySampleL = inputSampleL; drySampleL = inputSampleL;
drySampleR = inputSampleR; drySampleR = inputSampleR;
flutterrandy = (double(fpd)/UINT32_MAX); flutterrandy = (double(fpdL)/UINT32_MAX);
//part of flutter section //part of flutter section
//now we've got a random flutter, so we're messing with the pitch before tape effects go on //now we've got a random flutter, so we're messing with the pitch before tape effects go on
if (fstoredcount < 0 || fstoredcount > 30) {fstoredcount = 30;} if (fstoredcount < 0 || fstoredcount > 30) {fstoredcount = 30;}
@ -347,7 +347,7 @@ void IronOxide5::processReplacing(float **inputs, float **outputs, VstInt32 samp
else inputSampleR = -bridgerectifierR; else inputSampleR = -bridgerectifierR;
//second stage of overdrive to prevent overs and allow bloody loud extremeness //second stage of overdrive to prevent overs and allow bloody loud extremeness
randy = (0.55 + tempRandy + ((double(fpd)/UINT32_MAX)*tempRandy))*noise; //0 to 2 randy = (0.55 + tempRandy + ((double(fpdR)/UINT32_MAX)*tempRandy))*noise; //0 to 2
inputSampleL *= (1.0 - randy); inputSampleL *= (1.0 - randy);
inputSampleL += (prevInputSampleL*randy); inputSampleL += (prevInputSampleL*randy);
@ -471,7 +471,7 @@ void IronOxide5::processDoubleReplacing(double **inputs, double **outputs, VstIn
drySampleL = inputSampleL; drySampleL = inputSampleL;
drySampleR = inputSampleR; drySampleR = inputSampleR;
flutterrandy = (double(fpd)/UINT32_MAX); flutterrandy = (double(fpdL)/UINT32_MAX);
//part of flutter section //part of flutter section
//now we've got a random flutter, so we're messing with the pitch before tape effects go on //now we've got a random flutter, so we're messing with the pitch before tape effects go on
if (fstoredcount < 0 || fstoredcount > 30) {fstoredcount = 30;} if (fstoredcount < 0 || fstoredcount > 30) {fstoredcount = 30;}
@ -742,7 +742,7 @@ void IronOxide5::processDoubleReplacing(double **inputs, double **outputs, VstIn
else inputSampleR = -bridgerectifierR; else inputSampleR = -bridgerectifierR;
//second stage of overdrive to prevent overs and allow bloody loud extremeness //second stage of overdrive to prevent overs and allow bloody loud extremeness
randy = (0.55 + tempRandy + ((double(fpd)/UINT32_MAX)*tempRandy))*noise; //0 to 2 randy = (0.55 + tempRandy + ((double(fpdR)/UINT32_MAX)*tempRandy))*noise; //0 to 2
inputSampleL *= (1.0 - randy); inputSampleL *= (1.0 - randy);
inputSampleL += (prevInputSampleL*randy); inputSampleL += (prevInputSampleL*randy);

View file

@ -143,10 +143,10 @@ private:
int gcount; int gcount;
double fpNShapeL;
double fpNShapeR;
bool fpFlip; bool fpFlip;
//default stuff //default stuff
uint32_t fpdL;
uint32_t fpdR;
float A; float A;
float B; float B;

View file

@ -160,11 +160,11 @@ void Luxor::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra
} }
//otherwise we leave it untouched by the overdrive stuff //otherwise we leave it untouched by the overdrive stuff
randy = ((double(fpd)/UINT32_MAX)*0.031); randy = ((double(fpdL)/UINT32_MAX)*0.031);
inputSampleL = ((inputSampleL*(1-randy))+(lastSampleL*randy)) * outlevel; inputSampleL = ((inputSampleL*(1-randy))+(lastSampleL*randy)) * outlevel;
lastSampleL = inputSampleL; lastSampleL = inputSampleL;
randy = ((double(fpd)/UINT32_MAX)*0.031); randy = ((double(fpdR)/UINT32_MAX)*0.031);
inputSampleR = ((inputSampleR*(1-randy))+(lastSampleR*randy)) * outlevel; inputSampleR = ((inputSampleR*(1-randy))+(lastSampleR*randy)) * outlevel;
lastSampleR = inputSampleR; lastSampleR = inputSampleR;
@ -341,11 +341,11 @@ void Luxor::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s
} }
//otherwise we leave it untouched by the overdrive stuff //otherwise we leave it untouched by the overdrive stuff
randy = ((double(fpd)/UINT32_MAX)*0.031); randy = ((double(fpdL)/UINT32_MAX)*0.031);
inputSampleL = ((inputSampleL*(1-randy))+(lastSampleL*randy)) * outlevel; inputSampleL = ((inputSampleL*(1-randy))+(lastSampleL*randy)) * outlevel;
lastSampleL = inputSampleL; lastSampleL = inputSampleL;
randy = ((double(fpd)/UINT32_MAX)*0.031); randy = ((double(fpdR)/UINT32_MAX)*0.031);
inputSampleR = ((inputSampleR*(1-randy))+(lastSampleR*randy)) * outlevel; inputSampleR = ((inputSampleR*(1-randy))+(lastSampleR*randy)) * outlevel;
lastSampleR = inputSampleR; lastSampleR = inputSampleR;

View file

@ -37,14 +37,15 @@ void MidSide::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
mid *= midgain; mid *= midgain;
side *= sidegain; side *= sidegain;
//stereo 32 bit dither, made small and tidy. //begin 32 bit floating point dither
int expon; frexpf((float)mid, &expon); int expon; frexpf((float)mid, &expon);
double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
mid += (dither-fpNShapeL); fpNShapeL = dither; mid += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit floating point dither
frexpf((float)side, &expon); frexpf((float)side, &expon);
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
side += (dither-fpNShapeR); fpNShapeR = dither; side += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit dither //end 32 bit floating point dither
*out1 = mid; *out1 = mid;
*out2 = side; *out2 = side;
@ -87,14 +88,13 @@ void MidSide::processDoubleReplacing(double **inputs, double **outputs, VstInt32
side *= sidegain; side *= sidegain;
//stereo 64 bit dither, made small and tidy. //stereo 64 bit dither, made small and tidy.
int expon; frexp((double)mid, &expon); //int expon; frexpf((float)mid, &expon);
double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
dither /= 536870912.0; //needs this to scale to 64 bit zone //mid += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
mid += (dither-fpNShapeL); fpNShapeL = dither; //end 32 bit floating point dither
frexp((double)side, &expon); //frexpf((float)side, &expon);
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
dither /= 536870912.0; //needs this to scale to 64 bit zone //side += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
side += (dither-fpNShapeR); fpNShapeR = dither;
//end 64 bit dither //end 64 bit dither
*out1 = mid; *out1 = mid;

View file

@ -53,7 +53,8 @@ private:
double bynL[13]; double bynL[13];
double bynR[13]; double bynR[13];
uint32_t fpdL;
uint32_t fpdR;
}; };
#endif #endif

View file

@ -36,11 +36,11 @@ void NaturalizeDither::processReplacing(float **inputs, float **outputs, VstInt3
if (inputSampleL > 0) inputSampleL += (0.3333333333); if (inputSampleL > 0) inputSampleL += (0.3333333333);
if (inputSampleL < 0) inputSampleL -= (0.3333333333); if (inputSampleL < 0) inputSampleL -= (0.3333333333);
inputSampleL += (double(fpd)/UINT32_MAX)*0.6666666666; inputSampleL += (double(fpdL)/UINT32_MAX)*0.6666666666;
if (inputSampleR > 0) inputSampleR += (0.3333333333); if (inputSampleR > 0) inputSampleR += (0.3333333333);
if (inputSampleR < 0) inputSampleR -= (0.3333333333); if (inputSampleR < 0) inputSampleR -= (0.3333333333);
inputSampleR += (double(fpd)/UINT32_MAX)*0.6666666666; inputSampleR += (double(fpdR)/UINT32_MAX)*0.6666666666;
//begin L //begin L
benfordize = floor(inputSampleL); benfordize = floor(inputSampleL);
@ -238,11 +238,11 @@ void NaturalizeDither::processDoubleReplacing(double **inputs, double **outputs,
if (inputSampleL > 0) inputSampleL += (0.3333333333); if (inputSampleL > 0) inputSampleL += (0.3333333333);
if (inputSampleL < 0) inputSampleL -= (0.3333333333); if (inputSampleL < 0) inputSampleL -= (0.3333333333);
inputSampleL += (double(fpd)/UINT32_MAX)*0.6666666666; inputSampleL += (double(fpdL)/UINT32_MAX)*0.6666666666;
if (inputSampleR > 0) inputSampleR += (0.3333333333); if (inputSampleR > 0) inputSampleR += (0.3333333333);
if (inputSampleR < 0) inputSampleR -= (0.3333333333); if (inputSampleR < 0) inputSampleR -= (0.3333333333);
inputSampleR += (double(fpd)/UINT32_MAX)*0.6666666666; inputSampleR += (double(fpdR)/UINT32_MAX)*0.6666666666;
//begin L //begin L
benfordize = floor(inputSampleL); benfordize = floor(inputSampleL);

View file

@ -156,11 +156,11 @@ void Neverland::processReplacing(float **inputs, float **outputs, VstInt32 sampl
inputSampleR += (bR[33] * (0.00555223929714115 - (0.00030319367948553*fabs(bR[33])))); inputSampleR += (bR[33] * (0.00555223929714115 - (0.00030319367948553*fabs(bR[33]))));
//we apply the first samples of the Neve impulse- dynamically adjusted. //we apply the first samples of the Neve impulse- dynamically adjusted.
} }
randy = ((double(fpd)/UINT32_MAX)*0.034); randy = ((double(fpdL)/UINT32_MAX)*0.034);
inputSampleL = ((inputSampleL*(1-randy))+(lastSampleL*randy)) * outlevel; inputSampleL = ((inputSampleL*(1-randy))+(lastSampleL*randy)) * outlevel;
lastSampleL = inputSampleL; lastSampleL = inputSampleL;
randy = ((double(fpd)/UINT32_MAX)*0.034); randy = ((double(fpdR)/UINT32_MAX)*0.034);
inputSampleR = ((inputSampleR*(1-randy))+(lastSampleR*randy)) * outlevel; inputSampleR = ((inputSampleR*(1-randy))+(lastSampleR*randy)) * outlevel;
lastSampleR = inputSampleR; lastSampleR = inputSampleR;
@ -332,11 +332,11 @@ void Neverland::processDoubleReplacing(double **inputs, double **outputs, VstInt
inputSampleR += (bR[33] * (0.00555223929714115 - (0.00030319367948553*fabs(bR[33])))); inputSampleR += (bR[33] * (0.00555223929714115 - (0.00030319367948553*fabs(bR[33]))));
//we apply the first samples of the Neve impulse- dynamically adjusted. //we apply the first samples of the Neve impulse- dynamically adjusted.
} }
randy = ((double(fpd)/UINT32_MAX)*0.034); randy = ((double(fpdL)/UINT32_MAX)*0.034);
inputSampleL = ((inputSampleL*(1-randy))+(lastSampleL*randy)) * outlevel; inputSampleL = ((inputSampleL*(1-randy))+(lastSampleL*randy)) * outlevel;
lastSampleL = inputSampleL; lastSampleL = inputSampleL;
randy = ((double(fpd)/UINT32_MAX)*0.034); randy = ((double(fpdR)/UINT32_MAX)*0.034);
inputSampleR = ((inputSampleR*(1-randy))+(lastSampleR*randy)) * outlevel; inputSampleR = ((inputSampleR*(1-randy))+(lastSampleR*randy)) * outlevel;
lastSampleR = inputSampleR; lastSampleR = inputSampleR;

View file

@ -57,6 +57,8 @@ private:
double dR[5000]; double dR[5000];
int gcount; int gcount;
//default stuff //default stuff
uint32_t fpdL;
uint32_t fpdR;
float A; float A;
float B; float B;

View file

@ -43,10 +43,10 @@ void NodeDither::processReplacing(float **inputs, float **outputs, VstInt32 samp
if (gcount < 0 || gcount > 2450) {gcount = 2450;} if (gcount < 0 || gcount > 2450) {gcount = 2450;}
currentDitherL = (double(fpd)/UINT32_MAX); currentDitherL = (double(fpdL)/UINT32_MAX);
inputSampleL += currentDitherL; inputSampleL += currentDitherL;
currentDitherR = (double(fpd)/UINT32_MAX); currentDitherR = (double(fpdR)/UINT32_MAX);
inputSampleR += currentDitherR; inputSampleR += currentDitherR;
if (phase == 1) { if (phase == 1) {
@ -121,10 +121,10 @@ void NodeDither::processDoubleReplacing(double **inputs, double **outputs, VstIn
if (gcount < 0 || gcount > 2450) {gcount = 2450;} if (gcount < 0 || gcount > 2450) {gcount = 2450;}
currentDitherL = (double(fpd)/UINT32_MAX); currentDitherL = (double(fpdL)/UINT32_MAX);
inputSampleL += currentDitherL; inputSampleL += currentDitherL;
currentDitherR = (double(fpd)/UINT32_MAX); currentDitherR = (double(fpdR)/UINT32_MAX);
inputSampleR += currentDitherR; inputSampleR += currentDitherR;
if (phase == 1) { if (phase == 1) {

View file

@ -118,12 +118,12 @@ void Noise::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra
if (surgeL<fabs(inputSampleL)) if (surgeL<fabs(inputSampleL))
{ {
surgeL += (double(fpd)/UINT32_MAX)*(fabs(inputSampleL)-surgeL); surgeL += (double(fpdL)/UINT32_MAX)*(fabs(inputSampleL)-surgeL);
if (surgeL > 1.0) surgeL = 1.0; if (surgeL > 1.0) surgeL = 1.0;
} }
else else
{ {
surgeL -= ((double(fpd)/UINT32_MAX)*(surgeL-fabs(inputSampleL))*decay); surgeL -= ((double(fpdL)/UINT32_MAX)*(surgeL-fabs(inputSampleL))*decay);
if (surgeL < 0.0) surgeL = 0.0; if (surgeL < 0.0) surgeL = 0.0;
} }
@ -134,12 +134,12 @@ void Noise::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra
if (surgeR<fabs(inputSampleR)) if (surgeR<fabs(inputSampleR))
{ {
surgeR += (double(fpd)/UINT32_MAX)*(fabs(inputSampleR)-surgeR); surgeR += (double(fpdR)/UINT32_MAX)*(fabs(inputSampleR)-surgeR);
if (surgeR > 1.0) surgeR = 1.0; if (surgeR > 1.0) surgeR = 1.0;
} }
else else
{ {
surgeR -= ((double(fpd)/UINT32_MAX)*(surgeR-fabs(inputSampleR))*decay); surgeR -= ((double(fpdR)/UINT32_MAX)*(surgeR-fabs(inputSampleR))*decay);
if (surgeR < 0.0) surgeR = 0.0; if (surgeR < 0.0) surgeR = 0.0;
} }
@ -172,11 +172,13 @@ void Noise::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra
else {flipR = false;} else {flipR = false;}
} }
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
if (flipL) noiseAL += (double(fpd)/UINT32_MAX); if (flipL) noiseAL += (double(fpdL)/UINT32_MAX);
else noiseAL -= (double(fpd)/UINT32_MAX); else noiseAL -= (double(fpdL)/UINT32_MAX);
if (flipR) noiseAR += (double(fpd)/UINT32_MAX); if (flipR) noiseAR += (double(fpdR)/UINT32_MAX);
else noiseAR -= (double(fpd)/UINT32_MAX); else noiseAR -= (double(fpdR)/UINT32_MAX);
if (filterflip) if (filterflip)
{ {
@ -388,12 +390,12 @@ void Noise::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s
if (surgeL<fabs(inputSampleL)) if (surgeL<fabs(inputSampleL))
{ {
surgeL += (double(fpd)/UINT32_MAX)*(fabs(inputSampleL)-surgeL); surgeL += (double(fpdL)/UINT32_MAX)*(fabs(inputSampleL)-surgeL);
if (surgeL > 1.0) surgeL = 1.0; if (surgeL > 1.0) surgeL = 1.0;
} }
else else
{ {
surgeL -= ((double(fpd)/UINT32_MAX)*(surgeL-fabs(inputSampleL))*decay); surgeL -= ((double(fpdL)/UINT32_MAX)*(surgeL-fabs(inputSampleL))*decay);
if (surgeL < 0.0) surgeL = 0.0; if (surgeL < 0.0) surgeL = 0.0;
} }
@ -404,12 +406,12 @@ void Noise::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s
if (surgeR<fabs(inputSampleR)) if (surgeR<fabs(inputSampleR))
{ {
surgeR += (double(fpd)/UINT32_MAX)*(fabs(inputSampleR)-surgeR); surgeR += (double(fpdR)/UINT32_MAX)*(fabs(inputSampleR)-surgeR);
if (surgeR > 1.0) surgeR = 1.0; if (surgeR > 1.0) surgeR = 1.0;
} }
else else
{ {
surgeR -= ((double(fpd)/UINT32_MAX)*(surgeR-fabs(inputSampleR))*decay); surgeR -= ((double(fpdR)/UINT32_MAX)*(surgeR-fabs(inputSampleR))*decay);
if (surgeR < 0.0) surgeR = 0.0; if (surgeR < 0.0) surgeR = 0.0;
} }
@ -442,11 +444,13 @@ void Noise::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s
else {flipR = false;} else {flipR = false;}
} }
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
if (flipL) noiseAL += (double(fpd)/UINT32_MAX); if (flipL) noiseAL += (double(fpdL)/UINT32_MAX);
else noiseAL -= (double(fpd)/UINT32_MAX); else noiseAL -= (double(fpdL)/UINT32_MAX);
if (flipR) noiseAR += (double(fpd)/UINT32_MAX); if (flipR) noiseAR += (double(fpdR)/UINT32_MAX);
else noiseAR -= (double(fpd)/UINT32_MAX); else noiseAR -= (double(fpdR)/UINT32_MAX);
if (filterflip) if (filterflip)
{ {

View file

@ -55,6 +55,8 @@ private:
double bynR[13]; double bynR[13];
double noiseShapingL; double noiseShapingL;
double noiseShapingR; double noiseShapingR;
uint32_t fpdL;
uint32_t fpdR;
}; };

View file

@ -31,10 +31,10 @@ void NotJustAnotherDither::processReplacing(float **inputs, float **outputs, Vst
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;
@ -185,10 +185,10 @@ void NotJustAnotherDither::processDoubleReplacing(double **inputs, double **outp
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;

View file

@ -33,17 +33,17 @@ void PaulDither::processReplacing(float **inputs, float **outputs, VstInt32 samp
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;
//0-1 is now one bit, now we dither //0-1 is now one bit, now we dither
currentDitherL = (double(fpd)/UINT32_MAX); currentDitherL = (double(fpdL)/UINT32_MAX);
currentDitherR = (double(fpd)/UINT32_MAX); currentDitherR = (double(fpdR)/UINT32_MAX);
inputSampleL += currentDitherL; inputSampleL += currentDitherL;
inputSampleR += currentDitherR; inputSampleR += currentDitherR;
@ -69,10 +69,6 @@ void PaulDither::processReplacing(float **inputs, float **outputs, VstInt32 samp
inputSampleL /= outScale; inputSampleL /= outScale;
inputSampleR /= outScale; inputSampleR /= outScale;
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
//pseudorandom number updater
*out1 = inputSampleL; *out1 = inputSampleL;
*out2 = inputSampleR; *out2 = inputSampleR;
@ -109,17 +105,17 @@ void PaulDither::processDoubleReplacing(double **inputs, double **outputs, VstIn
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;
//0-1 is now one bit, now we dither //0-1 is now one bit, now we dither
currentDitherL = (double(fpd)/UINT32_MAX); currentDitherL = (double(fpdL)/UINT32_MAX);
currentDitherR = (double(fpd)/UINT32_MAX); currentDitherR = (double(fpdR)/UINT32_MAX);
inputSampleL += currentDitherL; inputSampleL += currentDitherL;
inputSampleR += currentDitherR; inputSampleR += currentDitherR;
@ -145,10 +141,6 @@ void PaulDither::processDoubleReplacing(double **inputs, double **outputs, VstIn
inputSampleL /= outScale; inputSampleL /= outScale;
inputSampleR /= outScale; inputSampleR /= outScale;
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
//pseudorandom number updater
*out1 = inputSampleL; *out1 = inputSampleL;
*out2 = inputSampleR; *out2 = inputSampleR;

View file

@ -46,34 +46,37 @@ void PaulWide::processReplacing(float **inputs, float **outputs, VstInt32 sample
//away from the previous one - this gives you the triangular PDF and the //away from the previous one - this gives you the triangular PDF and the
//filtering in one go :-) //filtering in one go :-)
double currentDither = (double(fpd)/UINT32_MAX); double currentDither = (double(fpdL)/UINT32_MAX);
double ditherL = currentDither; double ditherL = currentDither;
ditherL -= previousDitherL; ditherL -= previousDitherL;
previousDitherL = currentDither; previousDitherL = currentDither;
//TPDF: two 0-1 random noises //TPDF: two 0-1 random noises
currentDither = (double(fpd)/UINT32_MAX); currentDither = (double(fpdR)/UINT32_MAX);
double ditherR = currentDither; double ditherR = currentDither;
ditherR -= previousDitherR; ditherR -= previousDitherR;
previousDitherR = currentDither; previousDitherR = currentDither;
//TPDF: two 0-1 random noises //TPDF: two 0-1 random noises
if (fabs(ditherL-ditherR) < 0.5) { if (fabs(ditherL-ditherR) < 0.5) {
currentDither = (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
currentDither = (double(fpdL)/UINT32_MAX);
ditherL = currentDither; ditherL = currentDither;
ditherL -= previousDitherL; ditherL -= previousDitherL;
previousDitherL = currentDither; previousDitherL = currentDither;
} }
if (fabs(ditherL-ditherR) < 0.5) { if (fabs(ditherL-ditherR) < 0.5) {
currentDither = (double(fpd)/UINT32_MAX); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
currentDither = (double(fpdR)/UINT32_MAX);
ditherR = currentDither; ditherR = currentDither;
ditherR -= previousDitherR; ditherR -= previousDitherR;
previousDitherR = currentDither; previousDitherR = currentDither;
} }
if (fabs(ditherL-ditherR) < 0.5) { if (fabs(ditherL-ditherR) < 0.5) {
currentDither = (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
currentDither = (double(fpdL)/UINT32_MAX);
ditherL = currentDither; ditherL = currentDither;
ditherL -= previousDitherL; ditherL -= previousDitherL;
previousDitherL = currentDither; previousDitherL = currentDither;
@ -138,34 +141,37 @@ void PaulWide::processDoubleReplacing(double **inputs, double **outputs, VstInt3
//away from the previous one - this gives you the triangular PDF and the //away from the previous one - this gives you the triangular PDF and the
//filtering in one go :-) //filtering in one go :-)
double currentDither = (double(fpd)/UINT32_MAX); double currentDither = (double(fpdL)/UINT32_MAX);
double ditherL = currentDither; double ditherL = currentDither;
ditherL -= previousDitherL; ditherL -= previousDitherL;
previousDitherL = currentDither; previousDitherL = currentDither;
//TPDF: two 0-1 random noises //TPDF: two 0-1 random noises
currentDither = (double(fpd)/UINT32_MAX); currentDither = (double(fpdR)/UINT32_MAX);
double ditherR = currentDither; double ditherR = currentDither;
ditherR -= previousDitherR; ditherR -= previousDitherR;
previousDitherR = currentDither; previousDitherR = currentDither;
//TPDF: two 0-1 random noises //TPDF: two 0-1 random noises
if (fabs(ditherL-ditherR) < 0.5) { if (fabs(ditherL-ditherR) < 0.5) {
currentDither = (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
currentDither = (double(fpdL)/UINT32_MAX);
ditherL = currentDither; ditherL = currentDither;
ditherL -= previousDitherL; ditherL -= previousDitherL;
previousDitherL = currentDither; previousDitherL = currentDither;
} }
if (fabs(ditherL-ditherR) < 0.5) { if (fabs(ditherL-ditherR) < 0.5) {
currentDither = (double(fpd)/UINT32_MAX); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
currentDither = (double(fpdR)/UINT32_MAX);
ditherR = currentDither; ditherR = currentDither;
ditherR -= previousDitherR; ditherR -= previousDitherR;
previousDitherR = currentDither; previousDitherR = currentDither;
} }
if (fabs(ditherL-ditherR) < 0.5) { if (fabs(ditherL-ditherR) < 0.5) {
currentDither = (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
currentDither = (double(fpdL)/UINT32_MAX);
ditherL = currentDither; ditherL = currentDither;
ditherL -= previousDitherL; ditherL -= previousDitherL;
previousDitherL = currentDither; previousDitherL = currentDither;

View file

@ -93,8 +93,8 @@ void PhaseNudge::processReplacing(float **inputs, float **outputs, VstInt32 samp
inputSampleR *= 4.0; inputSampleR *= 4.0;
if (wet < 1.0) { if (wet < 1.0) {
inputSampleL = (drySampleL * dry)+(inputSampleL * wet); inputSampleL = (drySampleL * (1.0-wet))+(inputSampleL * wet);
inputSampleR = (drySampleR * dry)+(inputSampleR * wet); inputSampleR = (drySampleR * (1.0-wet))+(inputSampleR * wet);
} }
//begin 32 bit stereo floating point dither //begin 32 bit stereo floating point dither
@ -201,8 +201,8 @@ void PhaseNudge::processDoubleReplacing(double **inputs, double **outputs, VstIn
inputSampleR *= 4.0; inputSampleR *= 4.0;
if (wet < 1.0) { if (wet < 1.0) {
inputSampleL = (drySampleL * dry)+(inputSampleL * wet); inputSampleL = (drySampleL * (1.0-wet))+(inputSampleL * wet);
inputSampleR = (drySampleR * dry)+(inputSampleR * wet); inputSampleR = (drySampleR * (1.0-wet))+(inputSampleR * wet);
} }
//begin 64 bit stereo floating point dither //begin 64 bit stereo floating point dither

View file

@ -158,11 +158,11 @@ void Precious::processReplacing(float **inputs, float **outputs, VstInt32 sample
} }
//otherwise we leave it untouched by the overdrive stuff //otherwise we leave it untouched by the overdrive stuff
randy = ((double(fpd)/UINT32_MAX)*0.017); randy = ((double(fpdL)/UINT32_MAX)*0.017);
inputSampleL = ((inputSampleL*(1-randy))+(lastSampleL*randy)) * outlevel; inputSampleL = ((inputSampleL*(1-randy))+(lastSampleL*randy)) * outlevel;
lastSampleL = inputSampleL; lastSampleL = inputSampleL;
randy = ((double(fpd)/UINT32_MAX)*0.017); randy = ((double(fpdR)/UINT32_MAX)*0.017);
inputSampleR = ((inputSampleR*(1-randy))+(lastSampleR*randy)) * outlevel; inputSampleR = ((inputSampleR*(1-randy))+(lastSampleR*randy)) * outlevel;
lastSampleR = inputSampleR; lastSampleR = inputSampleR;
@ -337,11 +337,11 @@ void Precious::processDoubleReplacing(double **inputs, double **outputs, VstInt3
} }
//otherwise we leave it untouched by the overdrive stuff //otherwise we leave it untouched by the overdrive stuff
randy = ((double(fpd)/UINT32_MAX)*0.017); randy = ((double(fpdL)/UINT32_MAX)*0.017);
inputSampleL = ((inputSampleL*(1-randy))+(lastSampleL*randy)) * outlevel; inputSampleL = ((inputSampleL*(1-randy))+(lastSampleL*randy)) * outlevel;
lastSampleL = inputSampleL; lastSampleL = inputSampleL;
randy = ((double(fpd)/UINT32_MAX)*0.017); randy = ((double(fpdR)/UINT32_MAX)*0.017);
inputSampleR = ((inputSampleR*(1-randy))+(lastSampleR*randy)) * outlevel; inputSampleR = ((inputSampleR*(1-randy))+(lastSampleR*randy)) * outlevel;
lastSampleR = inputSampleR; lastSampleR = inputSampleR;

View file

@ -79,11 +79,11 @@ void PurestFade::processReplacing(float **inputs, float **outputs, VstInt32 samp
//begin 32 bit stereo floating point dither //begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += ((double(fpd)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62)); inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
frexpf((float)inputSampleR, &expon); frexpf((float)inputSampleR, &expon);
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += ((double(fpd)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62)); inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit stereo floating point dither //end 32 bit stereo floating point dither
*out1 = inputSampleL; *out1 = inputSampleL;
*out2 = inputSampleR; *out2 = inputSampleR;
@ -166,12 +166,12 @@ void PurestFade::processDoubleReplacing(double **inputs, double **outputs, VstIn
inputSampleR *= outputgain; inputSampleR *= outputgain;
//begin 64 bit stereo floating point dither //begin 64 bit stereo floating point dither
int expon; frexp((double)inputSampleL, &expon); //int expon; frexp((double)inputSampleL, &expon);
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += ((double(fpd)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62)); //inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
frexp((double)inputSampleR, &expon); //frexp((double)inputSampleR, &expon);
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += ((double(fpd)-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 //end 64 bit stereo floating point dither
*out1 = inputSampleL; *out1 = inputSampleL;

View file

@ -84,14 +84,14 @@ void PurestGain::processReplacing(float **inputs, float **outputs, VstInt32 samp
} else { } else {
inputSampleL *= outputgain; inputSampleL *= outputgain;
inputSampleR *= outputgain; inputSampleR *= outputgain;
//stereo 32 bit dither, made small and tidy. //begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
frexpf((float)inputSampleR, &expon); frexpf((float)inputSampleR, &expon);
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit dither //end 32 bit stereo floating point dither
*out1 = inputSampleL; *out1 = inputSampleL;
*out2 = inputSampleR; *out2 = inputSampleR;
} }
@ -174,16 +174,14 @@ void PurestGain::processDoubleReplacing(double **inputs, double **outputs, VstIn
} else { } else {
inputSampleL *= outputgain; inputSampleL *= outputgain;
inputSampleR *= outputgain; inputSampleR *= outputgain;
//stereo 64 bit dither, made small and tidy. //begin 64 bit stereo floating point dither
int expon; frexp((double)inputSampleL, &expon); //int expon; frexp((double)inputSampleL, &expon);
double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
dither /= 536870912.0; //needs this to scale to 64 bit zone //inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; //frexp((double)inputSampleR, &expon);
frexp((double)inputSampleR, &expon); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); //inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
dither /= 536870912.0; //needs this to scale to 64 bit zone //end 64 bit stereo floating point dither
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
//end 64 bit dither
*out1 = inputSampleL; *out1 = inputSampleL;
*out2 = inputSampleR; *out2 = inputSampleR;
} }

View file

@ -32,52 +32,52 @@ void PurestWarm::processReplacing(float **inputs, float **outputs, VstInt32 samp
if (inputSampleL < 0) if (inputSampleL < 0)
{ {
inputSampleL = -(sin(-inputSampleL*1.57079634)/1.57079634); inputSampleL = -(sin(-inputSampleL*1.57079634)/1.57079634);
//stereo 32 bit dither, made small and tidy. //begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
frexpf((float)inputSampleR, &expon); frexpf((float)inputSampleR, &expon);
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit dither //end 32 bit stereo floating point dither
} }
if (inputSampleR < 0) if (inputSampleR < 0)
{ {
inputSampleR = -(sin(-inputSampleR*1.57079634)/1.57079634); inputSampleR = -(sin(-inputSampleR*1.57079634)/1.57079634);
//stereo 32 bit dither, made small and tidy. //begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
frexpf((float)inputSampleR, &expon); frexpf((float)inputSampleR, &expon);
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit dither //end 32 bit stereo floating point dither
} }
} else { } else {
if (inputSampleL > 0) if (inputSampleL > 0)
{ {
inputSampleL = sin(inputSampleL*1.57079634)/1.57079634; inputSampleL = sin(inputSampleL*1.57079634)/1.57079634;
//stereo 32 bit dither, made small and tidy. //begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
frexpf((float)inputSampleR, &expon); frexpf((float)inputSampleR, &expon);
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit dither //end 32 bit stereo floating point dither
} }
if (inputSampleR > 0) if (inputSampleR > 0)
{ {
inputSampleR = sin(inputSampleR*1.57079634)/1.57079634; inputSampleR = sin(inputSampleR*1.57079634)/1.57079634;
//stereo 32 bit dither, made small and tidy. //begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
frexpf((float)inputSampleR, &expon); frexpf((float)inputSampleR, &expon);
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither; inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit dither //end 32 bit stereo floating point dither
} }
} }
//that's it. Only applies on one half of the waveform, other half is passthrough untouched. //that's it. Only applies on one half of the waveform, other half is passthrough untouched.
@ -117,60 +117,52 @@ void PurestWarm::processDoubleReplacing(double **inputs, double **outputs, VstIn
if (inputSampleL < 0) if (inputSampleL < 0)
{ {
inputSampleL = -(sin(-inputSampleL*1.57079634)/1.57079634); inputSampleL = -(sin(-inputSampleL*1.57079634)/1.57079634);
//stereo 64 bit dither, made small and tidy. //begin 64 bit stereo floating point dither
int expon; frexp((double)inputSampleL, &expon); //int expon; frexp((double)inputSampleL, &expon);
double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
dither /= 536870912.0; //needs this to scale to 64 bit zone //inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; //frexp((double)inputSampleR, &expon);
frexp((double)inputSampleR, &expon); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); //inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
dither /= 536870912.0; //needs this to scale to 64 bit zone //end 64 bit stereo floating point dither
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
//end 64 bit dither
} }
if (inputSampleR < 0) if (inputSampleR < 0)
{ {
inputSampleR = -(sin(-inputSampleR*1.57079634)/1.57079634); inputSampleR = -(sin(-inputSampleR*1.57079634)/1.57079634);
//stereo 64 bit dither, made small and tidy. //begin 64 bit stereo floating point dither
int expon; frexp((double)inputSampleL, &expon); //int expon; frexp((double)inputSampleL, &expon);
double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
dither /= 536870912.0; //needs this to scale to 64 bit zone //inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; //frexp((double)inputSampleR, &expon);
frexp((double)inputSampleR, &expon); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); //inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
dither /= 536870912.0; //needs this to scale to 64 bit zone //end 64 bit stereo floating point dither
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
//end 64 bit dither
} }
} else { } else {
if (inputSampleL > 0) if (inputSampleL > 0)
{ {
inputSampleL = sin(inputSampleL*1.57079634)/1.57079634; inputSampleL = sin(inputSampleL*1.57079634)/1.57079634;
//stereo 64 bit dither, made small and tidy. //begin 64 bit stereo floating point dither
int expon; frexp((double)inputSampleL, &expon); //int expon; frexp((double)inputSampleL, &expon);
double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
dither /= 536870912.0; //needs this to scale to 64 bit zone //inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; //frexp((double)inputSampleR, &expon);
frexp((double)inputSampleR, &expon); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); //inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
dither /= 536870912.0; //needs this to scale to 64 bit zone //end 64 bit stereo floating point dither
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
//end 64 bit dither
} }
if (inputSampleR > 0) if (inputSampleR > 0)
{ {
inputSampleR = sin(inputSampleR*1.57079634)/1.57079634; inputSampleR = sin(inputSampleR*1.57079634)/1.57079634;
//stereo 64 bit dither, made small and tidy. //begin 64 bit stereo floating point dither
int expon; frexp((double)inputSampleL, &expon); //int expon; frexp((double)inputSampleL, &expon);
double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
dither /= 536870912.0; //needs this to scale to 64 bit zone //inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
inputSampleL += (dither-fpNShapeL); fpNShapeL = dither; //frexp((double)inputSampleR, &expon);
frexp((double)inputSampleR, &expon); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62); //inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
dither /= 536870912.0; //needs this to scale to 64 bit zone //end 64 bit stereo floating point dither
inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
//end 64 bit dither
} }
} }
//that's it. Only applies on one half of the waveform, other half is passthrough untouched. //that's it. Only applies on one half of the waveform, other half is passthrough untouched.

View file

@ -29,10 +29,10 @@ void RawGlitters::processReplacing(float **inputs, float **outputs, VstInt32 sam
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;
@ -86,10 +86,10 @@ void RawGlitters::processDoubleReplacing(double **inputs, double **outputs, VstI
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;

View file

@ -30,10 +30,10 @@ void RawTimbers::processReplacing(float **inputs, float **outputs, VstInt32 samp
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
@ -89,10 +89,10 @@ void RawTimbers::processDoubleReplacing(double **inputs, double **outputs, VstIn
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;

View file

@ -74,6 +74,8 @@ private:
float gain; float gain;
double lastSampleL; double lastSampleL;
double lastSampleR; double lastSampleR;
uint32_t fpdL;
uint32_t fpdR;
}; };
#endif #endif

View file

@ -88,6 +88,9 @@ private:
double lastSampleL; double lastSampleL;
double lastSampleR; double lastSampleR;
uint32_t fpdL;
uint32_t fpdR;
float A; float A;
}; };

View file

@ -51,6 +51,8 @@ private:
double lastSampleL; double lastSampleL;
double lastSampleR; double lastSampleR;
uint32_t fpdL;
uint32_t fpdR;
}; };
#endif #endif

View file

@ -36,10 +36,8 @@ void SpatializeDither::processReplacing(float **inputs, float **outputs, VstInt3
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;
@ -51,7 +49,10 @@ void SpatializeDither::processReplacing(float **inputs, float **outputs, VstInt3
if (inputSampleR < 0) inputSampleR -= 0.383; if (inputSampleR < 0) inputSampleR -= 0.383;
//adjusting to permit more information drug outta the noisefloor //adjusting to permit more information drug outta the noisefloor
contingentRnd = (((double(fpd)/UINT32_MAX)+(double(fpd)/UINT32_MAX))-1.0) * randyConstant; //produce TPDF dist, scale contingentRnd = (double(fpdL)/UINT32_MAX);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
contingentRnd += ((double(fpdL)/UINT32_MAX)-1.0);
contingentRnd *= randyConstant; //produce TPDF dist, scale
contingentRnd -= contingentErrL*omegaConstant; //include err contingentRnd -= contingentErrL*omegaConstant; //include err
absSample = fabs(inputSampleL); absSample = fabs(inputSampleL);
contingentErrL = absSample - floor(absSample); //get next err contingentErrL = absSample - floor(absSample); //get next err
@ -65,7 +66,10 @@ void SpatializeDither::processReplacing(float **inputs, float **outputs, VstInt3
//Contingent Dither //Contingent Dither
inputSampleL = floor(inputSampleL); inputSampleL = floor(inputSampleL);
contingentRnd = (((double(fpd)/UINT32_MAX)+(double(fpd)/UINT32_MAX))-1.0) * randyConstant; //produce TPDF dist, scale contingentRnd = (double(fpdR)/UINT32_MAX);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
contingentRnd += ((double(fpdR)/UINT32_MAX)-1.0);
contingentRnd *= randyConstant; //produce TPDF dist, scale
contingentRnd -= contingentErrR*omegaConstant; //include err contingentRnd -= contingentErrR*omegaConstant; //include err
absSample = fabs(inputSampleR); absSample = fabs(inputSampleR);
contingentErrR = absSample - floor(absSample); //get next err contingentErrR = absSample - floor(absSample); //get next err
@ -131,10 +135,8 @@ void SpatializeDither::processDoubleReplacing(double **inputs, double **outputs,
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;
@ -146,7 +148,10 @@ void SpatializeDither::processDoubleReplacing(double **inputs, double **outputs,
if (inputSampleR < 0) inputSampleR -= 0.383; if (inputSampleR < 0) inputSampleR -= 0.383;
//adjusting to permit more information drug outta the noisefloor //adjusting to permit more information drug outta the noisefloor
contingentRnd = (((double(fpd)/UINT32_MAX)+(double(fpd)/UINT32_MAX))-1.0) * randyConstant; //produce TPDF dist, scale contingentRnd = (double(fpdL)/UINT32_MAX);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
contingentRnd += ((double(fpdL)/UINT32_MAX)-1.0);
contingentRnd *= randyConstant; //produce TPDF dist, scale
contingentRnd -= contingentErrL*omegaConstant; //include err contingentRnd -= contingentErrL*omegaConstant; //include err
absSample = fabs(inputSampleL); absSample = fabs(inputSampleL);
contingentErrL = absSample - floor(absSample); //get next err contingentErrL = absSample - floor(absSample); //get next err
@ -160,7 +165,10 @@ void SpatializeDither::processDoubleReplacing(double **inputs, double **outputs,
//Contingent Dither //Contingent Dither
inputSampleL = floor(inputSampleL); inputSampleL = floor(inputSampleL);
contingentRnd = (((double(fpd)/UINT32_MAX)+(double(fpd)/UINT32_MAX))-1.0) * randyConstant; //produce TPDF dist, scale contingentRnd = (double(fpdR)/UINT32_MAX);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
contingentRnd += ((double(fpdR)/UINT32_MAX)-1.0);
contingentRnd *= randyConstant; //produce TPDF dist, scale
contingentRnd -= contingentErrR*omegaConstant; //include err contingentRnd -= contingentErrR*omegaConstant; //include err
absSample = fabs(inputSampleR); absSample = fabs(inputSampleR);
contingentErrR = absSample - floor(absSample); //get next err contingentErrR = absSample - floor(absSample); //get next err

View file

@ -28,8 +28,8 @@ Srsly::Srsly(audioMasterCallback audioMaster) :
C = 1.0; C = 1.0;
D = 0.5; D = 0.5;
E = 1.0; E = 1.0;
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX; fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
fpdR = 1.0; while (fpdR < 16386) fpdR = 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. //this is reset: values being initialized only once. Startup values, whatever they are.
_canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect. _canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect.

View file

@ -68,8 +68,8 @@ private:
double biquadS3[11]; double biquadS3[11];
double biquadS5[11]; double biquadS5[11];
uint32_t fpdL; uint32_t fpdL;
uint32_t fpdR; uint32_t fpdR;
//default stuff //default stuff
float A; float A;

View file

@ -226,15 +226,15 @@ void Srsly::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra
inputSampleR = (inputSampleR * wet)+(drySampleR * (1.0-wet)); inputSampleR = (inputSampleR * wet)+(drySampleR * (1.0-wet));
} }
//begin 32 bit stereo floating point dither //begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62)); inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
frexpf((float)inputSampleR, &expon); frexpf((float)inputSampleR, &expon);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62)); inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit stereo floating point dither //end 32 bit stereo floating point dither
*out1 = inputSampleL; *out1 = inputSampleL;
*out2 = inputSampleR; *out2 = inputSampleR;
@ -464,15 +464,15 @@ void Srsly::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s
inputSampleR = (inputSampleR * wet)+(drySampleR * (1.0-wet)); inputSampleR = (inputSampleR * wet)+(drySampleR * (1.0-wet));
} }
//begin 64 bit stereo floating point dither //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; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62)); //inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
frexp((double)inputSampleR, &expon); //frexp((double)inputSampleR, &expon);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5; 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 //end 64 bit stereo floating point dither
*out1 = inputSampleL; *out1 = inputSampleL;
*out2 = inputSampleR; *out2 = inputSampleR;

View file

@ -103,6 +103,9 @@ private:
double iirSampleYR; double iirSampleYR;
double iirSampleZR; double iirSampleZR;
uint32_t fpdL;
uint32_t fpdR;
}; };
#endif #endif

View file

@ -75,11 +75,11 @@ void Surge::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra
inputSampleL *= chaseMax; inputSampleL *= chaseMax;
inputSampleL = drySampleL - (inputSampleL * intensity); inputSampleL = drySampleL - (inputSampleL * intensity);
inputSampleL = (drySampleL * dry) + (inputSampleL * wet); inputSampleL = (drySampleL * (1.0-wet)) + (inputSampleL * wet);
inputSampleR *= chaseMax; inputSampleR *= chaseMax;
inputSampleR = drySampleR - (inputSampleR * intensity); inputSampleR = drySampleR - (inputSampleR * intensity);
inputSampleR = (drySampleR * dry) + (inputSampleR * wet); inputSampleR = (drySampleR * (1.0-wet)) + (inputSampleR * wet);
//begin 32 bit stereo floating point dither //begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
@ -167,11 +167,11 @@ void Surge::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s
inputSampleL *= chaseMax; inputSampleL *= chaseMax;
inputSampleL = drySampleL - (inputSampleL * intensity); inputSampleL = drySampleL - (inputSampleL * intensity);
inputSampleL = (drySampleL * dry) + (inputSampleL * wet); inputSampleL = (drySampleL * (1.0-wet)) + (inputSampleL * wet);
inputSampleR *= chaseMax; inputSampleR *= chaseMax;
inputSampleR = drySampleR - (inputSampleR * intensity); inputSampleR = drySampleR - (inputSampleR * intensity);
inputSampleR = (drySampleR * dry) + (inputSampleR * wet); inputSampleR = (drySampleR * (1.0-wet)) + (inputSampleR * wet);
//begin 64 bit stereo floating point dither //begin 64 bit stereo floating point dither
//int expon; frexp((double)inputSampleL, &expon); //int expon; frexp((double)inputSampleL, &expon);

View file

@ -65,11 +65,11 @@ void SurgeTide::processReplacing(float **inputs, float **outputs, VstInt32 sampl
inputSampleL *= chaseC; inputSampleL *= chaseC;
inputSampleL = drySampleL - (inputSampleL * intensity); inputSampleL = drySampleL - (inputSampleL * intensity);
inputSampleL = (drySampleL * dry) + (inputSampleL * wet); inputSampleL = (drySampleL * (1.0-wet)) + (inputSampleL * wet);
inputSampleR *= chaseC; inputSampleR *= chaseC;
inputSampleR = drySampleR - (inputSampleR * intensity); inputSampleR = drySampleR - (inputSampleR * intensity);
inputSampleR = (drySampleR * dry) + (inputSampleR * wet); inputSampleR = (drySampleR * (1.0-wet)) + (inputSampleR * wet);
//begin 32 bit stereo floating point dither //begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
@ -148,11 +148,11 @@ void SurgeTide::processDoubleReplacing(double **inputs, double **outputs, VstInt
inputSampleL *= chaseC; inputSampleL *= chaseC;
inputSampleL = drySampleL - (inputSampleL * intensity); inputSampleL = drySampleL - (inputSampleL * intensity);
inputSampleL = (drySampleL * dry) + (inputSampleL * wet); inputSampleL = (drySampleL * (1.0-wet)) + (inputSampleL * wet);
inputSampleR *= chaseC; inputSampleR *= chaseC;
inputSampleR = drySampleR - (inputSampleR * intensity); inputSampleR = drySampleR - (inputSampleR * intensity);
inputSampleR = (drySampleR * dry) + (inputSampleR * wet); inputSampleR = (drySampleR * (1.0-wet)) + (inputSampleR * wet);
//begin 64 bit stereo floating point dither //begin 64 bit stereo floating point dither
//int expon; frexp((double)inputSampleL, &expon); //int expon; frexp((double)inputSampleL, &expon);

View file

@ -30,10 +30,10 @@ void TPDFDither::processReplacing(float **inputs, float **outputs, VstInt32 samp
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;
@ -42,11 +42,12 @@ void TPDFDither::processReplacing(float **inputs, float **outputs, VstInt32 samp
inputSampleL -= 1.0; inputSampleL -= 1.0;
inputSampleR -= 1.0; inputSampleR -= 1.0;
inputSampleL += (double(fpd)/UINT32_MAX); inputSampleL += (double(fpdL)/UINT32_MAX);
inputSampleR += (double(fpd)/UINT32_MAX); inputSampleR += (double(fpdR)/UINT32_MAX);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += (double(fpd)/UINT32_MAX); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += (double(fpd)/UINT32_MAX); inputSampleL += (double(fpdL)/UINT32_MAX);
inputSampleR += (double(fpdR)/UINT32_MAX);
inputSampleL = floor(inputSampleL); inputSampleL = floor(inputSampleL);
inputSampleR = floor(inputSampleR); inputSampleR = floor(inputSampleR);
@ -92,10 +93,10 @@ void TPDFDither::processDoubleReplacing(double **inputs, double **outputs, VstIn
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;
@ -104,11 +105,12 @@ void TPDFDither::processDoubleReplacing(double **inputs, double **outputs, VstIn
inputSampleL -= 1.0; inputSampleL -= 1.0;
inputSampleR -= 1.0; inputSampleR -= 1.0;
inputSampleL += (double(fpd)/UINT32_MAX); inputSampleL += (double(fpdL)/UINT32_MAX);
inputSampleR += (double(fpd)/UINT32_MAX); inputSampleR += (double(fpdR)/UINT32_MAX);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += (double(fpd)/UINT32_MAX); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += (double(fpd)/UINT32_MAX); inputSampleL += (double(fpdL)/UINT32_MAX);
inputSampleR += (double(fpdR)/UINT32_MAX);
inputSampleL = floor(inputSampleL); inputSampleL = floor(inputSampleL);
inputSampleR = floor(inputSampleR); inputSampleR = floor(inputSampleR);

View file

@ -31,40 +31,43 @@ void TPDFWide::processReplacing(float **inputs, float **outputs, VstInt32 sample
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;
//0-1 is now one bit, now we dither //0-1 is now one bit, now we dither
double ditherL = -1.0; double ditherL = -1.0;
ditherL += (double(fpd)/UINT32_MAX); ditherL += (double(fpdL)/UINT32_MAX);
ditherL += (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
ditherL += (double(fpdL)/UINT32_MAX);
//TPDF: two 0-1 random noises //TPDF: two 0-1 random noises
double ditherR = -1.0; double ditherR = -1.0;
ditherR += (double(fpd)/UINT32_MAX); ditherR += (double(fpdR)/UINT32_MAX);
ditherR += (double(fpd)/UINT32_MAX); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
ditherR += (double(fpdR)/UINT32_MAX);
//TPDF: two 0-1 random noises //TPDF: two 0-1 random noises
if (fabs(ditherL-ditherR) < 0.5) { if (fabs(ditherL-ditherR) < 0.5) {
ditherL = -1.0; ditherL = -1.0;
ditherL += (double(fpd)/UINT32_MAX); ditherL += (double(fpdL)/UINT32_MAX);
ditherL += (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
ditherL += (double(fpdL)/UINT32_MAX);
} }
if (fabs(ditherL-ditherR) < 0.5) { if (fabs(ditherL-ditherR) < 0.5) {
ditherR = -1.0; ditherR = -1.0;
ditherR += (double(fpd)/UINT32_MAX); ditherR += (double(fpdR)/UINT32_MAX);
ditherR += (double(fpd)/UINT32_MAX); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
ditherR += (double(fpdR)/UINT32_MAX);
} }
if (fabs(ditherL-ditherR) < 0.5) { if (fabs(ditherL-ditherR) < 0.5) {
ditherL = -1.0; ditherL = -1.0;
ditherL += (double(fpd)/UINT32_MAX); ditherL += (double(fpdL)/UINT32_MAX);
ditherL += (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
ditherL += (double(fpdL)/UINT32_MAX);
} }
inputSampleL = floor(inputSampleL+ditherL); inputSampleL = floor(inputSampleL+ditherL);
@ -111,40 +114,43 @@ void TPDFWide::processDoubleReplacing(double **inputs, double **outputs, VstInt3
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;
//0-1 is now one bit, now we dither //0-1 is now one bit, now we dither
double ditherL = -1.0; double ditherL = -1.0;
ditherL += (double(fpd)/UINT32_MAX); ditherL += (double(fpdL)/UINT32_MAX);
ditherL += (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
ditherL += (double(fpdL)/UINT32_MAX);
//TPDF: two 0-1 random noises //TPDF: two 0-1 random noises
double ditherR = -1.0; double ditherR = -1.0;
ditherR += (double(fpd)/UINT32_MAX); ditherR += (double(fpdR)/UINT32_MAX);
ditherR += (double(fpd)/UINT32_MAX); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
ditherR += (double(fpdR)/UINT32_MAX);
//TPDF: two 0-1 random noises //TPDF: two 0-1 random noises
if (fabs(ditherL-ditherR) < 0.5) { if (fabs(ditherL-ditherR) < 0.5) {
ditherL = -1.0; ditherL = -1.0;
ditherL += (double(fpd)/UINT32_MAX); ditherL += (double(fpdL)/UINT32_MAX);
ditherL += (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
ditherL += (double(fpdL)/UINT32_MAX);
} }
if (fabs(ditherL-ditherR) < 0.5) { if (fabs(ditherL-ditherR) < 0.5) {
ditherR = -1.0; ditherR = -1.0;
ditherR += (double(fpd)/UINT32_MAX); ditherR += (double(fpdR)/UINT32_MAX);
ditherR += (double(fpd)/UINT32_MAX); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
ditherR += (double(fpdR)/UINT32_MAX);
} }
if (fabs(ditherL-ditherR) < 0.5) { if (fabs(ditherL-ditherR) < 0.5) {
ditherL = -1.0; ditherL = -1.0;
ditherL += (double(fpd)/UINT32_MAX); ditherL += (double(fpdL)/UINT32_MAX);
ditherL += (double(fpd)/UINT32_MAX); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
ditherL += (double(fpdL)/UINT32_MAX);
} }
inputSampleL = floor(inputSampleL+ditherL); inputSampleL = floor(inputSampleL+ditherL);

View file

@ -32,17 +32,17 @@ void TapeDither::processReplacing(float **inputs, float **outputs, VstInt32 samp
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;
//0-1 is now one bit, now we dither //0-1 is now one bit, now we dither
currentDitherL = (double(fpd)/UINT32_MAX); currentDitherL = (double(fpdL)/UINT32_MAX);
currentDitherR = (double(fpd)/UINT32_MAX); currentDitherR = (double(fpdR)/UINT32_MAX);
inputSampleL += currentDitherL; inputSampleL += currentDitherL;
inputSampleR += currentDitherR; inputSampleR += currentDitherR;
@ -105,17 +105,17 @@ void TapeDither::processDoubleReplacing(double **inputs, double **outputs, VstIn
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;
//0-1 is now one bit, now we dither //0-1 is now one bit, now we dither
currentDitherL = (double(fpd)/UINT32_MAX); currentDitherL = (double(fpdL)/UINT32_MAX);
currentDitherR = (double(fpd)/UINT32_MAX); currentDitherR = (double(fpdR)/UINT32_MAX);
inputSampleL += currentDitherL; inputSampleL += currentDitherL;
inputSampleR += currentDitherR; inputSampleR += currentDitherR;

View file

@ -77,7 +77,7 @@ void ToTape5::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
drySampleR = inputSampleR; drySampleR = inputSampleR;
flutterrandy = (double(fpd)/UINT32_MAX); flutterrandy = (double(fpdL)/UINT32_MAX);
randy = flutterrandy * tempRandy; //for soften randy = flutterrandy * tempRandy; //for soften
invrandy = (1.0-randy); invrandy = (1.0-randy);
randy /= 2.0; randy /= 2.0;
@ -406,7 +406,7 @@ void ToTape5::processDoubleReplacing(double **inputs, double **outputs, VstInt32
drySampleR = inputSampleR; drySampleR = inputSampleR;
flutterrandy = (double(fpd)/UINT32_MAX); flutterrandy = (double(fpdL)/UINT32_MAX);
randy = flutterrandy * tempRandy; //for soften randy = flutterrandy * tempRandy; //for soften
invrandy = (1.0-randy); invrandy = (1.0-randy);
randy /= 2.0; randy /= 2.0;

View file

@ -66,7 +66,7 @@ void ToTape6::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
inputSampleR *= inputgain; inputSampleR *= inputgain;
} //gain cut before plugin } //gain cut before plugin
double flutterrandy = fpd / (double)UINT32_MAX; double flutterrandy = (double(fpdL)/UINT32_MAX);
//now we've got a random flutter, so we're messing with the pitch before tape effects go on //now we've got a random flutter, so we're messing with the pitch before tape effects go on
if (gcount < 0 || gcount > 499) {gcount = 499;} if (gcount < 0 || gcount > 499) {gcount = 499;}
dL[gcount] = inputSampleL; dL[gcount] = inputSampleL;
@ -400,7 +400,7 @@ void ToTape6::processDoubleReplacing(double **inputs, double **outputs, VstInt32
inputSampleR *= inputgain; inputSampleR *= inputgain;
} //gain cut before plugin } //gain cut before plugin
double flutterrandy = fpd / (double)UINT32_MAX; double flutterrandy = (double(fpdL)/UINT32_MAX);
//now we've got a random flutter, so we're messing with the pitch before tape effects go on //now we've got a random flutter, so we're messing with the pitch before tape effects go on
if (gcount < 0 || gcount > 499) {gcount = 499;} if (gcount < 0 || gcount > 499) {gcount = 499;}
dL[gcount] = inputSampleL; dL[gcount] = inputSampleL;

View file

@ -32,46 +32,59 @@ void VinylDither::processReplacing(float **inputs, float **outputs, VstInt32 sam
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpd * 1.18e-37; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpd * 1.18e-37;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;
//0-1 is now one bit, now we dither //0-1 is now one bit, now we dither
absSample = ((double(fpd)/UINT32_MAX) - 0.5); absSample = ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[0] += absSample; nsL[0] /= 2; absSample -= nsL[0]; nsL[0] += absSample; nsL[0] /= 2; absSample -= nsL[0];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[1] += absSample; nsL[1] /= 2; absSample -= nsL[1]; nsL[1] += absSample; nsL[1] /= 2; absSample -= nsL[1];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[2] += absSample; nsL[2] /= 2; absSample -= nsL[2]; nsL[2] += absSample; nsL[2] /= 2; absSample -= nsL[2];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[3] += absSample; nsL[3] /= 2; absSample -= nsL[3]; nsL[3] += absSample; nsL[3] /= 2; absSample -= nsL[3];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[4] += absSample; nsL[4] /= 2; absSample -= nsL[4]; nsL[4] += absSample; nsL[4] /= 2; absSample -= nsL[4];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[5] += absSample; nsL[5] /= 2; absSample -= nsL[5]; nsL[5] += absSample; nsL[5] /= 2; absSample -= nsL[5];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[6] += absSample; nsL[6] /= 2; absSample -= nsL[6]; nsL[6] += absSample; nsL[6] /= 2; absSample -= nsL[6];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[7] += absSample; nsL[7] /= 2; absSample -= nsL[7]; nsL[7] += absSample; nsL[7] /= 2; absSample -= nsL[7];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[8] += absSample; nsL[8] /= 2; absSample -= nsL[8]; nsL[8] += absSample; nsL[8] /= 2; absSample -= nsL[8];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[9] += absSample; nsL[9] /= 2; absSample -= nsL[9]; nsL[9] += absSample; nsL[9] /= 2; absSample -= nsL[9];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[10] += absSample; nsL[10] /= 2; absSample -= nsL[10]; nsL[10] += absSample; nsL[10] /= 2; absSample -= nsL[10];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[11] += absSample; nsL[11] /= 2; absSample -= nsL[11]; nsL[11] += absSample; nsL[11] /= 2; absSample -= nsL[11];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[12] += absSample; nsL[12] /= 2; absSample -= nsL[12]; nsL[12] += absSample; nsL[12] /= 2; absSample -= nsL[12];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[13] += absSample; nsL[13] /= 2; absSample -= nsL[13]; nsL[13] += absSample; nsL[13] /= 2; absSample -= nsL[13];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[14] += absSample; nsL[14] /= 2; absSample -= nsL[14]; nsL[14] += absSample; nsL[14] /= 2; absSample -= nsL[14];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[15] += absSample; nsL[15] /= 2; absSample -= nsL[15]; nsL[15] += absSample; nsL[15] /= 2; absSample -= nsL[15];
//install noise and then shape it //install noise and then shape it
absSample += inputSampleL; absSample += inputSampleL;
@ -87,37 +100,52 @@ void VinylDither::processReplacing(float **inputs, float **outputs, VstInt32 sam
inputSampleL = floor(absSample); inputSampleL = floor(absSample);
//TenNines dither L //TenNines dither L
absSample = ((double(fpd)/UINT32_MAX) - 0.5); absSample = ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[0] += absSample; nsR[0] /= 2; absSample -= nsR[0]; nsR[0] += absSample; nsR[0] /= 2; absSample -= nsR[0];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[1] += absSample; nsR[1] /= 2; absSample -= nsR[1]; nsR[1] += absSample; nsR[1] /= 2; absSample -= nsR[1];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[2] += absSample; nsR[2] /= 2; absSample -= nsR[2]; nsR[2] += absSample; nsR[2] /= 2; absSample -= nsR[2];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[3] += absSample; nsR[3] /= 2; absSample -= nsR[3]; nsR[3] += absSample; nsR[3] /= 2; absSample -= nsR[3];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[4] += absSample; nsR[4] /= 2; absSample -= nsR[4]; nsR[4] += absSample; nsR[4] /= 2; absSample -= nsR[4];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[5] += absSample; nsR[5] /= 2; absSample -= nsR[5]; nsR[5] += absSample; nsR[5] /= 2; absSample -= nsR[5];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[6] += absSample; nsR[6] /= 2; absSample -= nsR[6]; nsR[6] += absSample; nsR[6] /= 2; absSample -= nsR[6];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[7] += absSample; nsR[7] /= 2; absSample -= nsR[7]; nsR[7] += absSample; nsR[7] /= 2; absSample -= nsR[7];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[8] += absSample; nsR[8] /= 2; absSample -= nsR[8]; nsR[8] += absSample; nsR[8] /= 2; absSample -= nsR[8];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[9] += absSample; nsR[9] /= 2; absSample -= nsR[9]; nsR[9] += absSample; nsR[9] /= 2; absSample -= nsR[9];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[10] += absSample; nsR[10] /= 2; absSample -= nsR[10]; nsR[10] += absSample; nsR[10] /= 2; absSample -= nsR[10];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[11] += absSample; nsR[11] /= 2; absSample -= nsR[11]; nsR[11] += absSample; nsR[11] /= 2; absSample -= nsR[11];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[12] += absSample; nsR[12] /= 2; absSample -= nsR[12]; nsR[12] += absSample; nsR[12] /= 2; absSample -= nsR[12];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[13] += absSample; nsR[13] /= 2; absSample -= nsR[13]; nsR[13] += absSample; nsR[13] /= 2; absSample -= nsR[13];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[14] += absSample; nsR[14] /= 2; absSample -= nsR[14]; nsR[14] += absSample; nsR[14] /= 2; absSample -= nsR[14];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[15] += absSample; nsR[15] /= 2; absSample -= nsR[15]; nsR[15] += absSample; nsR[15] /= 2; absSample -= nsR[15];
//install noise and then shape it //install noise and then shape it
absSample += inputSampleR; absSample += inputSampleR;
@ -175,46 +203,59 @@ void VinylDither::processDoubleReplacing(double **inputs, double **outputs, VstI
{ {
double inputSampleL = *in1; double inputSampleL = *in1;
double inputSampleR = *in2; double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpd * 1.18e-43; if (fabs(inputSampleL)<1.18e-23) inputSampleL = fpdL * 1.18e-17;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; if (fabs(inputSampleR)<1.18e-23) inputSampleR = fpdR * 1.18e-17;
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpd * 1.18e-43;
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5;
inputSampleL *= scaleFactor; inputSampleL *= scaleFactor;
inputSampleR *= scaleFactor; inputSampleR *= scaleFactor;
//0-1 is now one bit, now we dither //0-1 is now one bit, now we dither
absSample = ((double(fpd)/UINT32_MAX) - 0.5); absSample = ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[0] += absSample; nsL[0] /= 2; absSample -= nsL[0]; nsL[0] += absSample; nsL[0] /= 2; absSample -= nsL[0];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[1] += absSample; nsL[1] /= 2; absSample -= nsL[1]; nsL[1] += absSample; nsL[1] /= 2; absSample -= nsL[1];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[2] += absSample; nsL[2] /= 2; absSample -= nsL[2]; nsL[2] += absSample; nsL[2] /= 2; absSample -= nsL[2];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[3] += absSample; nsL[3] /= 2; absSample -= nsL[3]; nsL[3] += absSample; nsL[3] /= 2; absSample -= nsL[3];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[4] += absSample; nsL[4] /= 2; absSample -= nsL[4]; nsL[4] += absSample; nsL[4] /= 2; absSample -= nsL[4];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[5] += absSample; nsL[5] /= 2; absSample -= nsL[5]; nsL[5] += absSample; nsL[5] /= 2; absSample -= nsL[5];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[6] += absSample; nsL[6] /= 2; absSample -= nsL[6]; nsL[6] += absSample; nsL[6] /= 2; absSample -= nsL[6];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[7] += absSample; nsL[7] /= 2; absSample -= nsL[7]; nsL[7] += absSample; nsL[7] /= 2; absSample -= nsL[7];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[8] += absSample; nsL[8] /= 2; absSample -= nsL[8]; nsL[8] += absSample; nsL[8] /= 2; absSample -= nsL[8];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[9] += absSample; nsL[9] /= 2; absSample -= nsL[9]; nsL[9] += absSample; nsL[9] /= 2; absSample -= nsL[9];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[10] += absSample; nsL[10] /= 2; absSample -= nsL[10]; nsL[10] += absSample; nsL[10] /= 2; absSample -= nsL[10];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[11] += absSample; nsL[11] /= 2; absSample -= nsL[11]; nsL[11] += absSample; nsL[11] /= 2; absSample -= nsL[11];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[12] += absSample; nsL[12] /= 2; absSample -= nsL[12]; nsL[12] += absSample; nsL[12] /= 2; absSample -= nsL[12];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[13] += absSample; nsL[13] /= 2; absSample -= nsL[13]; nsL[13] += absSample; nsL[13] /= 2; absSample -= nsL[13];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[14] += absSample; nsL[14] /= 2; absSample -= nsL[14]; nsL[14] += absSample; nsL[14] /= 2; absSample -= nsL[14];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
absSample += ((double(fpdL)/UINT32_MAX) - 0.5);
nsL[15] += absSample; nsL[15] /= 2; absSample -= nsL[15]; nsL[15] += absSample; nsL[15] /= 2; absSample -= nsL[15];
//install noise and then shape it //install noise and then shape it
absSample += inputSampleL; absSample += inputSampleL;
@ -230,37 +271,52 @@ void VinylDither::processDoubleReplacing(double **inputs, double **outputs, VstI
inputSampleL = floor(absSample); inputSampleL = floor(absSample);
//TenNines dither L //TenNines dither L
absSample = ((double(fpd)/UINT32_MAX) - 0.5); absSample = ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[0] += absSample; nsR[0] /= 2; absSample -= nsR[0]; nsR[0] += absSample; nsR[0] /= 2; absSample -= nsR[0];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[1] += absSample; nsR[1] /= 2; absSample -= nsR[1]; nsR[1] += absSample; nsR[1] /= 2; absSample -= nsR[1];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[2] += absSample; nsR[2] /= 2; absSample -= nsR[2]; nsR[2] += absSample; nsR[2] /= 2; absSample -= nsR[2];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[3] += absSample; nsR[3] /= 2; absSample -= nsR[3]; nsR[3] += absSample; nsR[3] /= 2; absSample -= nsR[3];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[4] += absSample; nsR[4] /= 2; absSample -= nsR[4]; nsR[4] += absSample; nsR[4] /= 2; absSample -= nsR[4];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[5] += absSample; nsR[5] /= 2; absSample -= nsR[5]; nsR[5] += absSample; nsR[5] /= 2; absSample -= nsR[5];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[6] += absSample; nsR[6] /= 2; absSample -= nsR[6]; nsR[6] += absSample; nsR[6] /= 2; absSample -= nsR[6];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[7] += absSample; nsR[7] /= 2; absSample -= nsR[7]; nsR[7] += absSample; nsR[7] /= 2; absSample -= nsR[7];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[8] += absSample; nsR[8] /= 2; absSample -= nsR[8]; nsR[8] += absSample; nsR[8] /= 2; absSample -= nsR[8];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[9] += absSample; nsR[9] /= 2; absSample -= nsR[9]; nsR[9] += absSample; nsR[9] /= 2; absSample -= nsR[9];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[10] += absSample; nsR[10] /= 2; absSample -= nsR[10]; nsR[10] += absSample; nsR[10] /= 2; absSample -= nsR[10];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[11] += absSample; nsR[11] /= 2; absSample -= nsR[11]; nsR[11] += absSample; nsR[11] /= 2; absSample -= nsR[11];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[12] += absSample; nsR[12] /= 2; absSample -= nsR[12]; nsR[12] += absSample; nsR[12] /= 2; absSample -= nsR[12];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[13] += absSample; nsR[13] /= 2; absSample -= nsR[13]; nsR[13] += absSample; nsR[13] /= 2; absSample -= nsR[13];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[14] += absSample; nsR[14] /= 2; absSample -= nsR[14]; nsR[14] += absSample; nsR[14] /= 2; absSample -= nsR[14];
absSample += ((double(fpd)/UINT32_MAX) - 0.5); fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
absSample += ((double(fpdR)/UINT32_MAX) - 0.5);
nsR[15] += absSample; nsR[15] /= 2; absSample -= nsR[15]; nsR[15] += absSample; nsR[15] /= 2; absSample -= nsR[15];
//install noise and then shape it //install noise and then shape it
absSample += inputSampleR; absSample += inputSampleR;

View file

@ -110,10 +110,10 @@ void VoiceOfTheStarship::processReplacing(float **inputs, float **outputs, VstIn
//it's a pure random walk that will generate DC. //it's a pure random walk that will generate DC.
} }
if (flipL) noiseAL += (double(fpd)/UINT32_MAX); if (flipL) noiseAL += (double(fpdL)/UINT32_MAX);
else noiseAL -= (double(fpd)/UINT32_MAX); else noiseAL -= (double(fpdL)/UINT32_MAX);
if (flipR) noiseAR += (double(fpd)/UINT32_MAX); if (flipR) noiseAR += (double(fpdR)/UINT32_MAX);
else noiseAR -= (double(fpd)/UINT32_MAX); else noiseAR -= (double(fpdR)/UINT32_MAX);
//here's the guts of the random walk //here's the guts of the random walk
if (filterflip) if (filterflip)
@ -300,10 +300,10 @@ void VoiceOfTheStarship::processDoubleReplacing(double **inputs, double **output
//it's a pure random walk that will generate DC. //it's a pure random walk that will generate DC.
} }
if (flipL) noiseAL += (double(fpd)/UINT32_MAX); if (flipL) noiseAL += (double(fpdL)/UINT32_MAX);
else noiseAL -= (double(fpd)/UINT32_MAX); else noiseAL -= (double(fpdL)/UINT32_MAX);
if (flipR) noiseAR += (double(fpd)/UINT32_MAX); if (flipR) noiseAR += (double(fpdR)/UINT32_MAX);
else noiseAR -= (double(fpd)/UINT32_MAX); else noiseAR -= (double(fpdR)/UINT32_MAX);
//here's the guts of the random walk //here's the guts of the random walk
if (filterflip) if (filterflip)

View file

@ -99,8 +99,8 @@ void Wider::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra
} }
count -= 1; count -= 1;
inputSampleL = (drySampleL * dry) + ((mid+side) * wet); inputSampleL = (drySampleL * (1.0-wet)) + ((mid+side) * wet);
inputSampleR = (drySampleR * dry) + ((mid-side) * wet); inputSampleR = (drySampleR * (1.0-wet)) + ((mid-side) * wet);
//begin 32 bit stereo floating point dither //begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
@ -213,8 +213,8 @@ void Wider::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s
} }
count -= 1; count -= 1;
inputSampleL = (drySampleL * dry) + ((mid+side) * wet); inputSampleL = (drySampleL * (1.0-wet)) + ((mid+side) * wet);
inputSampleR = (drySampleR * dry) + ((mid-side) * wet); inputSampleR = (drySampleR * (1.0-wet)) + ((mid-side) * wet);
//begin 64 bit stereo floating point dither //begin 64 bit stereo floating point dither
//int expon; frexp((double)inputSampleL, &expon); //int expon; frexp((double)inputSampleL, &expon);

View file

@ -82,8 +82,7 @@ private:
biq_total biq_total
}; //coefficient interpolating biquad filter, stereo }; //coefficient interpolating biquad filter, stereo
double biquad[biq_total]; double biquad[biq_total];
//double biquadC[biq_total];
//double biquadD[biq_total];
double powFactorA; double powFactorA;
double powFactorB; double powFactorB;
double inTrimA; double inTrimA;
@ -107,6 +106,7 @@ private:
}; //fixed frequency biquad filter for ultrasonics, stereo }; //fixed frequency biquad filter for ultrasonics, stereo
double fixA[fix_total]; double fixA[fix_total];
double fixB[fix_total]; double fixB[fix_total];
uint32_t fpdL; uint32_t fpdL;
uint32_t fpdR; uint32_t fpdR;
//default stuff //default stuff

View file

@ -72,8 +72,6 @@ private:
float B; float B;
float C; float C;
float D; float D;
float E; //parameters. Always 0-1, and we scale/alter them elsewhere.
}; };
#endif #endif

View file

@ -24,7 +24,8 @@ ADT::ADT(audioMasterCallback audioMaster) :
offsetB = 9001; // :D offsetB = 9001; // :D
gcount = 0; gcount = 0;
fpd = 1.0; while (fpd < 16386) fpd = rand()*UINT32_MAX; 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. //this is reset: values being initialized only once. Startup values, whatever they are.
_canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect. _canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect.

View file

@ -125,11 +125,11 @@ void ADT::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrame
//begin 32 bit stereo floating point dither //begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon); int expon; frexpf((float)inputSampleL, &expon);
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += static_cast<int32_t>(fpd) * 5.960464655174751e-36L * pow(2,expon+62); inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
frexpf((float)inputSampleR, &expon); frexpf((float)inputSampleR, &expon);
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += static_cast<int32_t>(fpd) * 5.960464655174751e-36L * pow(2,expon+62); inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit stereo floating point dither //end 32 bit stereo floating point dither
*out1 = inputSampleL; *out1 = inputSampleL;
@ -259,12 +259,12 @@ void ADT::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sam
if (output < 1.0) {inputSampleL *= output; inputSampleR *= output;} if (output < 1.0) {inputSampleL *= output; inputSampleR *= output;}
//begin 64 bit stereo floating point dither //begin 64 bit stereo floating point dither
int expon; frexp((double)inputSampleL, &expon); //int expon; frexp((double)inputSampleL, &expon);
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += static_cast<int32_t>(fpd) * 1.110223024625156e-44L * pow(2,expon+62); //inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
frexp((double)inputSampleR, &expon); //frexp((double)inputSampleR, &expon);
fpd ^= fpd << 13; fpd ^= fpd >> 17; fpd ^= fpd << 5; fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += static_cast<int32_t>(fpd) * 1.110223024625156e-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 //end 64 bit stereo floating point dither
*out1 = inputSampleL; *out1 = inputSampleL;

0
plugins/WinVST/Air2/Air2.cpp Normal file → Executable file
View file

0
plugins/WinVST/Air2/Air2.h Normal file → Executable file
View file

0
plugins/WinVST/Air2/Air2Proc.cpp Normal file → Executable file
View file

View file

@ -19,7 +19,8 @@ Apicolypse::Apicolypse(audioMasterCallback audioMaster) :
for(int count = 0; count < 34; count++) {bR[count] = 0;bL[count] = 0;} for(int count = 0; count < 34; count++) {bR[count] = 0;bL[count] = 0;}
lastSampleR = 0.0;lastSampleL = 0.0; lastSampleR = 0.0;lastSampleL = 0.0;
fpd = 1.0; while (fpd < 16386) fpd = rand()*UINT32_MAX; 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. //this is reset: values being initialized only once. Startup values, whatever they are.
_canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect. _canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect.

View file

@ -59,7 +59,8 @@ private:
double lastSampleR; double lastSampleR;
double bL[35]; double bL[35];
double lastSampleL; double lastSampleL;
uint32_t fpd; uint32_t fpdL;
uint32_t fpdR;
//default stuff //default stuff
float A; float A;

View file

@ -155,11 +155,11 @@ void Apicolypse::processReplacing(float **inputs, float **outputs, VstInt32 samp
} }
//otherwise we leave it untouched by the overdrive stuff //otherwise we leave it untouched by the overdrive stuff
randy = ((double(fpd)/UINT32_MAX)*0.033); randy = ((double(fpdL)/UINT32_MAX)*0.033);
inputSampleL = ((inputSampleL*(1-randy))+(lastSampleL*randy)) * outlevel; inputSampleL = ((inputSampleL*(1-randy))+(lastSampleL*randy)) * outlevel;
lastSampleL = inputSampleL; lastSampleL = inputSampleL;
randy = ((double(fpd)/UINT32_MAX)*0.033); randy = ((double(fpdR)/UINT32_MAX)*0.033);
inputSampleR = ((inputSampleR*(1-randy))+(lastSampleR*randy)) * outlevel; inputSampleR = ((inputSampleR*(1-randy))+(lastSampleR*randy)) * outlevel;
lastSampleR = inputSampleR; lastSampleR = inputSampleR;
@ -331,11 +331,11 @@ void Apicolypse::processDoubleReplacing(double **inputs, double **outputs, VstIn
} }
//otherwise we leave it untouched by the overdrive stuff //otherwise we leave it untouched by the overdrive stuff
randy = ((double(fpd)/UINT32_MAX)*0.033); randy = ((double(fpdL)/UINT32_MAX)*0.033);
inputSampleL = ((inputSampleL*(1-randy))+(lastSampleL*randy)) * outlevel; inputSampleL = ((inputSampleL*(1-randy))+(lastSampleL*randy)) * outlevel;
lastSampleL = inputSampleL; lastSampleL = inputSampleL;
randy = ((double(fpd)/UINT32_MAX)*0.033); randy = ((double(fpdR)/UINT32_MAX)*0.033);
inputSampleR = ((inputSampleR*(1-randy))+(lastSampleR*randy)) * outlevel; inputSampleR = ((inputSampleR*(1-randy))+(lastSampleR*randy)) * outlevel;
lastSampleR = inputSampleR; lastSampleR = inputSampleR;

View file

@ -56,6 +56,8 @@ private:
double settingchase; double settingchase;
double chasespeed; double chasespeed;
uint32_t fpdL;
uint32_t fpdR;
double fpNShapeL; double fpNShapeL;
double lastSampleAL; double lastSampleAL;
double lastSampleBL; double lastSampleBL;

View file

@ -56,6 +56,8 @@ private:
double settingchase; double settingchase;
double chasespeed; double chasespeed;
uint32_t fpdL;
uint32_t fpdR;
double fpNShapeL; double fpNShapeL;
double lastSampleAL; double lastSampleAL;
double lastSampleBL; double lastSampleBL;

0
plugins/WinVST/AutoPan/AutoPan.cpp Normal file → Executable file
View file

0
plugins/WinVST/AutoPan/AutoPan.h Normal file → Executable file
View file

Some files were not shown because too many files have changed in this diff Show more