aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/PDBuss
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/PDBuss
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/PDBuss')
-rwxr-xr-xplugins/MacVST/PDBuss/PDBuss.xcodeproj/christopherjohnson.pbxuser20
-rwxr-xr-xplugins/MacVST/PDBuss/PDBuss.xcodeproj/christopherjohnson.perspectivev326
-rwxr-xr-xplugins/MacVST/PDBuss/source/PDBuss.cpp7
-rwxr-xr-xplugins/MacVST/PDBuss/source/PDBuss.h7
-rwxr-xr-xplugins/MacVST/PDBuss/source/PDBussProc.cpp62
5 files changed, 45 insertions, 77 deletions
diff --git a/plugins/MacVST/PDBuss/PDBuss.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/PDBuss/PDBuss.xcodeproj/christopherjohnson.pbxuser
index 1d8c78b..37b5241 100755
--- a/plugins/MacVST/PDBuss/PDBuss.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacVST/PDBuss/PDBuss.xcodeproj/christopherjohnson.pbxuser
@@ -49,12 +49,12 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 538696868;
- PBXWorkspaceStateSaveDate = 538696868;
+ PBXPerProjectTemplateStateSaveDate = 569770752;
+ PBXWorkspaceStateSaveDate = 569770752;
};
perUserProjectItems = {
- 8B4E5710201BE13900B5DC2A /* PBXTextBookmark */ = 8B4E5710201BE13900B5DC2A /* PBXTextBookmark */;
8B4E574B201BE1E100B5DC2A /* PBXTextBookmark */ = 8B4E574B201BE1E100B5DC2A /* PBXTextBookmark */;
+ 8B793D7821F60308006E9731 /* PBXTextBookmark */ = 8B793D7821F60308006E9731 /* PBXTextBookmark */;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
@@ -62,9 +62,9 @@
};
2407DEB6089929BA00EB68BF /* PDBuss.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {554, 1742}}";
+ sepNavIntBoundsRect = "{{0, 0}, {554, 1820}}";
sepNavSelRange = "{2794, 0}";
- sepNavVisRange = "{2616, 272}";
+ sepNavVisRange = "{2688, 198}";
sepNavWindowFrame = "{{337, 47}, {895, 831}}";
};
};
@@ -106,7 +106,7 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
- 8B4E5710201BE13900B5DC2A /* PBXTextBookmark */ = {
+ 8B4E574B201BE1E100B5DC2A /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2407DEB6089929BA00EB68BF /* PDBuss.cpp */;
name = "PDBuss.cpp: 85";
@@ -116,15 +116,15 @@
vrLen = 272;
vrLoc = 2616;
};
- 8B4E574B201BE1E100B5DC2A /* PBXTextBookmark */ = {
+ 8B793D7821F60308006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2407DEB6089929BA00EB68BF /* PDBuss.cpp */;
- name = "PDBuss.cpp: 85";
+ name = "PDBuss.cpp: 83";
rLen = 0;
rLoc = 2794;
rType = 0;
- vrLen = 272;
- vrLoc = 2616;
+ vrLen = 198;
+ vrLoc = 2688;
};
8D01CCC60486CAD60068D4B7 /* PDBuss */ = {
activeExec = 0;
diff --git a/plugins/MacVST/PDBuss/PDBuss.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/PDBuss/PDBuss.xcodeproj/christopherjohnson.perspectivev3
index 419ed77..2dcefe9 100755
--- a/plugins/MacVST/PDBuss/PDBuss.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacVST/PDBuss/PDBuss.xcodeproj/christopherjohnson.perspectivev3
@@ -351,10 +351,10 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8B4E574B201BE1E100B5DC2A</string>
+ <string>8B793D7821F60308006E9731</string>
<key>history</key>
<array>
- <string>8B4E5710201BE13900B5DC2A</string>
+ <string>8B4E574B201BE1E100B5DC2A</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>27 370 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,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 282}}</string>
+ <string>{{10, 27}, {603, 297}}</string>
+ <key>RubberWindowFrame</key>
+ <string>27 370 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -448,8 +450,6 @@
<dict>
<key>Frame</key>
<string>{{10, 27}, {603, 282}}</string>
- <key>RubberWindowFrame</key>
- <string>27 370 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -477,11 +477,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B4E574C201BE1E100B5DC2A</string>
+ <string>8B793D7921F60308006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B4E574D201BE1E100B5DC2A</string>
+ <string>8B793D7A21F60308006E9731</string>
<string>8B0237581D42B1C400E1E8C8</string>
- <string>8B4E574E201BE1E100B5DC2A</string>
+ <string>8B793D7B21F60308006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -634,7 +634,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>538698209.87022996</real>
+ <real>569770760.80971301</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -651,7 +651,7 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>/Users/christopherjohnson/Desktop/PDBuss/PDBuss.xcodeproj</string>
+ <string>/Users/christopherjohnson/Desktop/MacVST/PDBuss/PDBuss.xcodeproj</string>
</array>
<key>WindowString</key>
<string>27 370 810 487 0 0 1440 878 </string>
diff --git a/plugins/MacVST/PDBuss/source/PDBuss.cpp b/plugins/MacVST/PDBuss/source/PDBuss.cpp
index 323d8cf..8b31d8b 100755
--- a/plugins/MacVST/PDBuss/source/PDBuss.cpp
+++ b/plugins/MacVST/PDBuss/source/PDBuss.cpp
@@ -21,11 +21,8 @@ PDBuss::PDBuss(audioMasterCallback audioMaster) :
previousSampleL = 0.0;
previousSampleR = 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/PDBuss/source/PDBuss.h b/plugins/MacVST/PDBuss/source/PDBuss.h
index 5c7a504..3e6d9b8 100755
--- a/plugins/MacVST/PDBuss/source/PDBuss.h
+++ b/plugins/MacVST/PDBuss/source/PDBuss.h
@@ -53,11 +53,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
double gainchase;
double settingchase;
diff --git a/plugins/MacVST/PDBuss/source/PDBussProc.cpp b/plugins/MacVST/PDBuss/source/PDBussProc.cpp
index c099057..6da8fa0 100755
--- a/plugins/MacVST/PDBuss/source/PDBussProc.cpp
+++ b/plugins/MacVST/PDBuss/source/PDBussProc.cpp
@@ -13,9 +13,6 @@ void PDBuss::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
float* in2 = inputs[1];
float* out1 = outputs[0];
float* out2 = outputs[1];
- float fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
double inputgain = A;
double intensity = B;
@@ -122,25 +119,14 @@ void PDBuss::processReplacing(float **inputs, float **outputs, VstInt32 sampleFr
previousSampleR = sin(drySampleR);
//apply the sine while storing previous sample
- //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;
@@ -158,9 +144,6 @@ void PDBuss::processDoubleReplacing(double **inputs, double **outputs, VstInt32
double* in2 = inputs[1];
double* out1 = outputs[0];
double* out2 = outputs[1];
- double fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
double inputgain = A;
double intensity = B;
@@ -267,25 +250,16 @@ void PDBuss::processDoubleReplacing(double **inputs, double **outputs, VstInt32
previousSampleR = sin(drySampleR);
//apply the sine while storing previous sample
- //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;