aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/ButterComp
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/ButterComp
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/ButterComp')
-rwxr-xr-xplugins/MacVST/ButterComp/ButterComp.xcodeproj/christopherjohnson.pbxuser34
-rwxr-xr-xplugins/MacVST/ButterComp/ButterComp.xcodeproj/christopherjohnson.perspectivev330
-rwxr-xr-xplugins/MacVST/ButterComp/source/ButterComp.cpp7
-rwxr-xr-xplugins/MacVST/ButterComp/source/ButterComp.h7
-rwxr-xr-xplugins/MacVST/ButterComp/source/ButterCompProc.cpp62
5 files changed, 57 insertions, 83 deletions
diff --git a/plugins/MacVST/ButterComp/ButterComp.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/ButterComp/ButterComp.xcodeproj/christopherjohnson.pbxuser
index 00c7e3d..4e51591 100755
--- a/plugins/MacVST/ButterComp/ButterComp.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacVST/ButterComp/ButterComp.xcodeproj/christopherjohnson.pbxuser
@@ -49,14 +49,14 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 559962503;
- PBXWorkspaceStateSaveDate = 559962503;
+ PBXPerProjectTemplateStateSaveDate = 569718696;
+ PBXWorkspaceStateSaveDate = 569718696;
};
perUserProjectItems = {
8B42FD78216053420092969A /* PBXTextBookmark */ = 8B42FD78216053420092969A /* PBXTextBookmark */;
8B42FDE121605A6A0092969A /* PBXTextBookmark */ = 8B42FDE121605A6A0092969A /* PBXTextBookmark */;
- 8B42FDE221605A6A0092969A /* PBXBookmark */ = 8B42FDE221605A6A0092969A /* PBXBookmark */;
8B42FDE321605A6A0092969A /* PBXTextBookmark */ = 8B42FDE321605A6A0092969A /* PBXTextBookmark */;
+ 8B7934D121F537BA006E9731 /* PBXTextBookmark */ = 8B7934D121F537BA006E9731 /* PBXTextBookmark */;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
@@ -72,9 +72,9 @@
};
245463B80991757100464AD3 /* ButterComp.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {866, 910}}";
+ sepNavIntBoundsRect = "{{0, 0}, {554, 1079}}";
sepNavSelRange = "{2665, 0}";
- sepNavVisRange = "{2626, 65}";
+ sepNavVisRange = "{2626, 64}";
sepNavWindowFrame = "{{545, 47}, {895, 831}}";
};
};
@@ -88,9 +88,9 @@
};
24D8286F09A914000093AEF8 /* ButterCompProc.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {848, 5499}}";
- sepNavSelRange = "{11857, 0}";
- sepNavVisRange = "{11491, 1545}";
+ sepNavIntBoundsRect = "{{0, 0}, {848, 5070}}";
+ sepNavSelRange = "{0, 0}";
+ sepNavVisRange = "{10841, 1686}";
sepNavWindowFrame = "{{545, 47}, {895, 831}}";
};
};
@@ -125,12 +125,8 @@
rLen = 0;
rLoc = 12160;
rType = 0;
- vrLen = 83;
- vrLoc = 13577;
- };
- 8B42FDE221605A6A0092969A /* PBXBookmark */ = {
- isa = PBXBookmark;
- fRef = 245463B80991757100464AD3 /* ButterComp.h */;
+ vrLen = 0;
+ vrLoc = 12527;
};
8B42FDE321605A6A0092969A /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
@@ -142,6 +138,16 @@
vrLen = 65;
vrLoc = 2626;
};
+ 8B7934D121F537BA006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 245463B80991757100464AD3 /* ButterComp.h */;
+ name = "ButterComp.h: 67";
+ rLen = 0;
+ rLoc = 2665;
+ rType = 0;
+ vrLen = 64;
+ vrLoc = 2626;
+ };
8D01CCC60486CAD60068D4B7 /* ButterComp */ = {
activeExec = 0;
};
diff --git a/plugins/MacVST/ButterComp/ButterComp.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/ButterComp/ButterComp.xcodeproj/christopherjohnson.perspectivev3
index 240ab99..5148f75 100755
--- a/plugins/MacVST/ButterComp/ButterComp.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacVST/ButterComp/ButterComp.xcodeproj/christopherjohnson.perspectivev3
@@ -323,7 +323,7 @@
<real>185</real>
</array>
<key>RubberWindowFrame</key>
- <string>630 353 810 487 0 0 1440 878 </string>
+ <string>544 355 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -351,12 +351,12 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8B42FDE321605A6A0092969A</string>
+ <string>8B7934D121F537BA006E9731</string>
<key>history</key>
<array>
<string>8B42FD78216053420092969A</string>
<string>8B42FDE121605A6A0092969A</string>
- <string>8B42FDE221605A6A0092969A</string>
+ <string>8B42FDE321605A6A0092969A</string>
</array>
</dict>
<key>SplitCount</key>
@@ -370,18 +370,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {603, 69}}</string>
+ <string>{{0, 0}, {603, 51}}</string>
<key>RubberWindowFrame</key>
- <string>630 353 810 487 0 0 1440 878 </string>
+ <string>544 355 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>69pt</string>
+ <string>51pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>372pt</string>
+ <string>390pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -395,9 +395,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 345}}</string>
+ <string>{{10, 27}, {603, 363}}</string>
<key>RubberWindowFrame</key>
- <string>630 353 810 487 0 0 1440 878 </string>
+ <string>544 355 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -479,11 +479,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B42FDE421605A6A0092969A</string>
+ <string>8B7934D221F537BA006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B42FDE521605A6A0092969A</string>
+ <string>8B7934D321F537BA006E9731</string>
<string>8B0237581D42B1C400E1E8C8</string>
- <string>8B42FDE621605A6A0092969A</string>
+ <string>8B7934D421F537BA006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -636,7 +636,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>559962730.75885105</real>
+ <real>569718714.80265605</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -653,11 +653,11 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8B42FDE721605A6A0092969A</string>
+ <string>8B7934D521F537BA006E9731</string>
<string>/Users/christopherjohnson/Desktop/MacVST/ButterComp/ButterComp.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>630 353 810 487 0 0 1440 878 </string>
+ <string>544 355 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>
diff --git a/plugins/MacVST/ButterComp/source/ButterComp.cpp b/plugins/MacVST/ButterComp/source/ButterComp.cpp
index e6a33f7..b3123e2 100755
--- a/plugins/MacVST/ButterComp/source/ButterComp.cpp
+++ b/plugins/MacVST/ButterComp/source/ButterComp.cpp
@@ -26,11 +26,8 @@ ButterComp::ButterComp(audioMasterCallback audioMaster) :
controlBnegR = 1.0;
targetposR = 1.0;
targetnegR = 1.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/ButterComp/source/ButterComp.h b/plugins/MacVST/ButterComp/source/ButterComp.h
index af6df66..5c9862b 100755
--- a/plugins/MacVST/ButterComp/source/ButterComp.h
+++ b/plugins/MacVST/ButterComp/source/ButterComp.h
@@ -65,11 +65,8 @@ private:
double controlBnegR;
double targetposR;
double targetnegR;
- 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/ButterComp/source/ButterCompProc.cpp b/plugins/MacVST/ButterComp/source/ButterCompProc.cpp
index ea52946..d87030c 100755
--- a/plugins/MacVST/ButterComp/source/ButterCompProc.cpp
+++ b/plugins/MacVST/ButterComp/source/ButterCompProc.cpp
@@ -17,9 +17,6 @@ void ButterComp::processReplacing(float **inputs, float **outputs, VstInt32 samp
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
- float fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
double inputposL;
double inputnegL;
@@ -181,25 +178,14 @@ void ButterComp::processReplacing(float **inputs, float **outputs, VstInt32 samp
inputSampleR = (inputSampleR * wet) + (drySampleR * dry);
}
- //noise shaping to 32-bit floating point
- if (fpFlip) {
- fpTemp = inputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLA;
- fpTemp = inputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRA;
- }
- else {
- fpTemp = inputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLB;
- fpTemp = inputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRB;
- }
- fpFlip = !fpFlip;
- //end noise shaping on 32 bit output
+ //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
*out1 = inputSampleL;
*out2 = inputSampleR;
@@ -221,9 +207,6 @@ void ButterComp::processDoubleReplacing(double **inputs, double **outputs, VstIn
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
- double fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
double inputposL;
double inputnegL;
@@ -385,25 +368,16 @@ void ButterComp::processDoubleReplacing(double **inputs, double **outputs, VstIn
inputSampleR = (inputSampleR * wet) + (drySampleR * dry);
}
- //noise shaping to 64-bit floating point
- if (fpFlip) {
- fpTemp = inputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLA;
- fpTemp = inputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRA;
- }
- else {
- fpTemp = inputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLB;
- fpTemp = inputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRB;
- }
- fpFlip = !fpFlip;
- //end noise shaping on 64 bit output
+ //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
*out1 = inputSampleL;
*out2 = inputSampleR;