aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/PurestWarm
diff options
context:
space:
mode:
authorChris Johnson <jinx6568@sover.net>2019-01-27 21:13:54 -0500
committerChris Johnson <jinx6568@sover.net>2019-01-27 21:13:54 -0500
commit966f2d253cd2ee6ce140ad68095a20a9d2b63052 (patch)
treeb0400d95bd06512531ade6ddf55190a58b6a5623 /plugins/MacVST/PurestWarm
parent0887543349dbbec0721a1fc8b1c7deba9afefa8b (diff)
downloadairwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.tar.gz
airwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.tar.bz2
airwindows-lv2-port-966f2d253cd2ee6ce140ad68095a20a9d2b63052.zip
Floating Point Dither For All
Diffstat (limited to 'plugins/MacVST/PurestWarm')
-rwxr-xr-xplugins/MacVST/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.pbxuser24
-rwxr-xr-xplugins/MacVST/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.perspectivev321
-rwxr-xr-xplugins/MacVST/PurestWarm/source/PurestWarm.cpp7
-rwxr-xr-xplugins/MacVST/PurestWarm/source/PurestWarm.h7
-rwxr-xr-xplugins/MacVST/PurestWarm/source/PurestWarmProc.cpp242
5 files changed, 100 insertions, 201 deletions
diff --git a/plugins/MacVST/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.pbxuser
index d3ee7f1..f6f6607 100755
--- a/plugins/MacVST/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacVST/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.pbxuser
@@ -49,12 +49,12 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 532825574;
- PBXWorkspaceStateSaveDate = 532825574;
+ PBXPerProjectTemplateStateSaveDate = 569771412;
+ PBXWorkspaceStateSaveDate = 569771412;
};
perUserProjectItems = {
- 8B2C4C211FC246470023028A /* PBXTextBookmark */ = 8B2C4C211FC246470023028A /* PBXTextBookmark */;
8B2C4C221FC246470023028A /* PBXTextBookmark */ = 8B2C4C221FC246470023028A /* PBXTextBookmark */;
+ 8B793EFC21F605B1006E9731 /* PBXTextBookmark */ = 8B793EFC21F605B1006E9731 /* PBXTextBookmark */;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
@@ -86,9 +86,9 @@
};
24D8286F09A914000093AEF8 /* PurestWarmProc.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {684, 4498}}";
+ sepNavIntBoundsRect = "{{0, 0}, {677, 3367}}";
sepNavSelRange = "{8348, 0}";
- sepNavVisRange = "{1656, 322}";
+ sepNavVisRange = "{1663, 324}";
sepNavWindowFrame = "{{40, 47}, {895, 831}}";
};
};
@@ -106,25 +106,25 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
- 8B2C4C211FC246470023028A /* PBXTextBookmark */ = {
+ 8B2C4C221FC246470023028A /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 24D8286F09A914000093AEF8 /* PurestWarmProc.cpp */;
name = "PurestWarmProc.cpp: 246";
rLen = 0;
rLoc = 8348;
rType = 0;
- vrLen = 339;
- vrLoc = 1684;
+ vrLen = 322;
+ vrLoc = 1656;
};
- 8B2C4C221FC246470023028A /* PBXTextBookmark */ = {
+ 8B793EFC21F605B1006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 24D8286F09A914000093AEF8 /* PurestWarmProc.cpp */;
- name = "PurestWarmProc.cpp: 246";
+ name = "PurestWarmProc.cpp: 212";
rLen = 0;
rLoc = 8348;
rType = 0;
- vrLen = 322;
- vrLoc = 1656;
+ vrLen = 324;
+ vrLoc = 1663;
};
8D01CCC60486CAD60068D4B7 /* PurestWarm */ = {
activeExec = 0;
diff --git a/plugins/MacVST/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.perspectivev3
index a787ecd..c7c8a82 100755
--- a/plugins/MacVST/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacVST/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.perspectivev3
@@ -351,10 +351,10 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8B2C4C221FC246470023028A</string>
+ <string>8B793EFC21F605B1006E9731</string>
<key>history</key>
<array>
- <string>8B2C4C211FC246470023028A</string>
+ <string>8B2C4C221FC246470023028A</string>
</array>
</dict>
<key>SplitCount</key>
@@ -368,18 +368,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {603, 132}}</string>
+ <string>{{0, 0}, {603, 117}}</string>
<key>RubberWindowFrame</key>
<string>168 216 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>132pt</string>
+ <string>117pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>309pt</string>
+ <string>324pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -393,7 +393,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 282}}</string>
+ <string>{{10, 27}, {603, 297}}</string>
<key>RubberWindowFrame</key>
<string>168 216 810 487 0 0 1440 878 </string>
</dict>
@@ -477,11 +477,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B2C4C231FC246470023028A</string>
+ <string>8B793EFD21F605B1006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B2C4C241FC246470023028A</string>
+ <string>8B793EFE21F605B1006E9731</string>
<string>8B0237581D42B1C400E1E8C8</string>
- <string>8B2C4C251FC246470023028A</string>
+ <string>8B793EFF21F605B1006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -634,7 +634,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>532825671.66727102</real>
+ <real>569771441.44578099</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -651,7 +651,6 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8B2C4C261FC246470023028A</string>
<string>/Users/christopherjohnson/Desktop/MacVST/PurestWarm/PurestWarm.xcodeproj</string>
</array>
<key>WindowString</key>
diff --git a/plugins/MacVST/PurestWarm/source/PurestWarm.cpp b/plugins/MacVST/PurestWarm/source/PurestWarm.cpp
index 475e845..eeee37b 100755
--- a/plugins/MacVST/PurestWarm/source/PurestWarm.cpp
+++ b/plugins/MacVST/PurestWarm/source/PurestWarm.cpp
@@ -13,11 +13,8 @@ PurestWarm::PurestWarm(audioMasterCallback audioMaster) :
AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
{
A = 0.0;
- fpNShapeLA = 0.0;
- fpNShapeLB = 0.0;
- fpNShapeRA = 0.0;
- fpNShapeRB = 0.0;
- fpFlip = true;
+ fpNShapeL = 0.0;
+ fpNShapeR = 0.0;
//this is reset: values being initialized only once. Startup values, whatever they are.
_canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect.
diff --git a/plugins/MacVST/PurestWarm/source/PurestWarm.h b/plugins/MacVST/PurestWarm/source/PurestWarm.h
index c67a91e..98bb0ce 100755
--- a/plugins/MacVST/PurestWarm/source/PurestWarm.h
+++ b/plugins/MacVST/PurestWarm/source/PurestWarm.h
@@ -52,11 +52,8 @@ private:
char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo;
- long double fpNShapeLA;
- long double fpNShapeLB;
- long double fpNShapeRA;
- long double fpNShapeRB;
- bool fpFlip;
+ long double fpNShapeL;
+ long double fpNShapeR;
//default stuff
float A;
diff --git a/plugins/MacVST/PurestWarm/source/PurestWarmProc.cpp b/plugins/MacVST/PurestWarm/source/PurestWarmProc.cpp
index b5a5070..101c931 100755
--- a/plugins/MacVST/PurestWarm/source/PurestWarmProc.cpp
+++ b/plugins/MacVST/PurestWarm/source/PurestWarmProc.cpp
@@ -14,9 +14,6 @@ void PurestWarm::processReplacing(float **inputs, float **outputs, VstInt32 samp
float* out1 = outputs[0];
float* out2 = outputs[1];
- float fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
int polarity = (int) ( A * 1.999 );
@@ -71,103 +68,55 @@ void PurestWarm::processReplacing(float **inputs, float **outputs, VstInt32 samp
if (inputSampleL < 0)
{
inputSampleL = -(sin(-inputSampleL*1.57079634)/1.57079634);
- //noise shaping to 32-bit floating point
- if (fpFlip) {
- fpTemp = inputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLA;
- } else {
- fpTemp = inputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLB;
- }
- } else {
- if (fpFlip) {
- fpTemp = inputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew);
- } else {
- fpTemp = inputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew);
- }
+ //stereo 32 bit dither, made small and tidy.
+ int expon; frexpf((float)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexpf((float)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 32 bit dither
}
-
if (inputSampleR < 0)
{
inputSampleR = -(sin(-inputSampleR*1.57079634)/1.57079634);
- //noise shaping to 32-bit floating point
- if (fpFlip) {
- fpTemp = inputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRA;
- } else {
- fpTemp = inputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRB;
- }
- } else {
- if (fpFlip) {
- fpTemp = inputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew);
- } else {
- fpTemp = inputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew);
- }
+ //stereo 32 bit dither, made small and tidy.
+ int expon; frexpf((float)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexpf((float)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 32 bit dither
}
-
} else {
-
if (inputSampleL > 0)
{
inputSampleL = sin(inputSampleL*1.57079634)/1.57079634;
- //noise shaping to 32-bit floating point
- if (fpFlip) {
- fpTemp = inputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLA;
- } else {
- fpTemp = inputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLB;
- }
- } else {
- if (fpFlip) {
- fpTemp = inputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew);
- } else {
- fpTemp = inputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew);
- }
- }
+ //stereo 32 bit dither, made small and tidy.
+ int expon; frexpf((float)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexpf((float)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 32 bit dither
+ }
if (inputSampleR > 0)
{
inputSampleR = sin(inputSampleR*1.57079634)/1.57079634;
- //noise shaping to 32-bit floating point
- if (fpFlip) {
- fpTemp = inputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRA;
- } else {
- fpTemp = inputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRB;
- }
- } else {
- if (fpFlip) {
- fpTemp = inputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew);
- } else {
- fpTemp = inputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew);
- }
- }
-
+ //stereo 32 bit dither, made small and tidy.
+ int expon; frexpf((float)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexpf((float)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 32 bit dither
+ }
}
//that's it. Only applies on one half of the waveform, other half is passthrough untouched.
- //even the floating point noise shaping to the 32 bit buss is only applied as needed.
-
- fpFlip = !fpFlip;
- //end noise shaping on 32 bit output
*out1 = inputSampleL;
*out2 = inputSampleR;
@@ -186,9 +135,6 @@ void PurestWarm::processDoubleReplacing(double **inputs, double **outputs, VstIn
double* out1 = outputs[0];
double* out2 = outputs[1];
- double fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
int polarity = (int) ( A * 1.999 );
@@ -243,103 +189,63 @@ void PurestWarm::processDoubleReplacing(double **inputs, double **outputs, VstIn
if (inputSampleL < 0)
{
inputSampleL = -(sin(-inputSampleL*1.57079634)/1.57079634);
- //noise shaping to 64-bit floating point
- if (fpFlip) {
- fpTemp = inputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLA;
- } else {
- fpTemp = inputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLB;
- }
- } else {
- if (fpFlip) {
- fpTemp = inputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew);
- } else {
- fpTemp = inputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew);
- }
+ //stereo 64 bit dither, made small and tidy.
+ int expon; frexp((double)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ dither /= 536870912.0; //needs this to scale to 64 bit zone
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexp((double)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ dither /= 536870912.0; //needs this to scale to 64 bit zone
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 64 bit dither
}
if (inputSampleR < 0)
{
inputSampleR = -(sin(-inputSampleR*1.57079634)/1.57079634);
- //noise shaping to 64-bit floating point
- if (fpFlip) {
- fpTemp = inputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRA;
- } else {
- fpTemp = inputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRB;
- }
- } else {
- if (fpFlip) {
- fpTemp = inputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew);
- } else {
- fpTemp = inputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew);
- }
+ //stereo 64 bit dither, made small and tidy.
+ int expon; frexp((double)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ dither /= 536870912.0; //needs this to scale to 64 bit zone
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexp((double)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ dither /= 536870912.0; //needs this to scale to 64 bit zone
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 64 bit dither
}
-
} else {
-
if (inputSampleL > 0)
{
inputSampleL = sin(inputSampleL*1.57079634)/1.57079634;
- //noise shaping to 64-bit floating point
- if (fpFlip) {
- fpTemp = inputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLA;
- } else {
- fpTemp = inputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLB;
- }
- } else {
- if (fpFlip) {
- fpTemp = inputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew);
- } else {
- fpTemp = inputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew);
- }
+ //stereo 64 bit dither, made small and tidy.
+ int expon; frexp((double)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ dither /= 536870912.0; //needs this to scale to 64 bit zone
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexp((double)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ dither /= 536870912.0; //needs this to scale to 64 bit zone
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 64 bit dither
}
-
if (inputSampleR > 0)
{
inputSampleR = sin(inputSampleR*1.57079634)/1.57079634;
- //noise shaping to 64-bit floating point
- if (fpFlip) {
- fpTemp = inputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRA;
- } else {
- fpTemp = inputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRB;
- }
- } else {
- if (fpFlip) {
- fpTemp = inputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew);
- } else {
- fpTemp = inputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew);
- }
+ //stereo 64 bit dither, made small and tidy.
+ int expon; frexp((double)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ dither /= 536870912.0; //needs this to scale to 64 bit zone
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexp((double)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ dither /= 536870912.0; //needs this to scale to 64 bit zone
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 64 bit dither
}
-
}
//that's it. Only applies on one half of the waveform, other half is passthrough untouched.
- //even the floating point noise shaping to the 32 bit buss is only applied as needed.
-
- fpFlip = !fpFlip;
- //end noise shaping on 64 bit output
*out1 = inputSampleL;
*out2 = inputSampleR;