aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/PowerSag
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/MacAU/PowerSag
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/MacAU/PowerSag')
-rwxr-xr-xplugins/MacAU/PowerSag/PowerSag.cpp28
-rwxr-xr-xplugins/MacAU/PowerSag/PowerSag.h5
-rwxr-xr-xplugins/MacAU/PowerSag/PowerSag.xcodeproj/christopherjohnson.pbxuser44
-rwxr-xr-xplugins/MacAU/PowerSag/PowerSag.xcodeproj/christopherjohnson.perspectivev335
4 files changed, 45 insertions, 67 deletions
diff --git a/plugins/MacAU/PowerSag/PowerSag.cpp b/plugins/MacAU/PowerSag/PowerSag.cpp
index 8bd8b1e..95f70d2 100755
--- a/plugins/MacAU/PowerSag/PowerSag.cpp
+++ b/plugins/MacAU/PowerSag/PowerSag.cpp
@@ -169,9 +169,7 @@ void PowerSag::PowerSagKernel::Reset()
for(int count = 0; count < 8999; count++) {d[count] = 0;}
control = 0;
gcount = 0;
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
+ fpNShape = 0.0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -193,11 +191,6 @@ void PowerSag::PowerSagKernel::Process( const Float32 *inSourceP,
Float64 thickness;
Float64 out;
Float64 bridgerectifier;
-
- Float32 fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
-
long double inputSample;
while (nSampleFrames-- > 0) {
@@ -256,20 +249,11 @@ void PowerSag::PowerSagKernel::Process( const Float32 *inSourceP,
inputSample *= clamp;
-
- //noise shaping to 32-bit floating point
- if (fpFlip) {
- fpTemp = inputSample;
- fpNShapeA = (fpNShapeA*fpOld)+((inputSample-fpTemp)*fpNew);
- inputSample += fpNShapeA;
- }
- else {
- fpTemp = inputSample;
- fpNShapeB = (fpNShapeB*fpOld)+((inputSample-fpTemp)*fpNew);
- inputSample += fpNShapeB;
- }
- fpFlip = !fpFlip;
- //end noise shaping on 32 bit output
+ //32 bit dither, made small and tidy.
+ int expon; frexpf((Float32)inputSample, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSample += (dither-fpNShape); fpNShape = dither;
+ //end 32 bit dither
*destP = inputSample;
diff --git a/plugins/MacAU/PowerSag/PowerSag.h b/plugins/MacAU/PowerSag/PowerSag.h
index c55bc36..ef594dc 100755
--- a/plugins/MacAU/PowerSag/PowerSag.h
+++ b/plugins/MacAU/PowerSag/PowerSag.h
@@ -131,10 +131,7 @@ public:
Float64 d[9000];
Float64 control;
int gcount;
-
- long double fpNShapeA;
- long double fpNShapeB;
- bool fpFlip;
+ long double fpNShape;
};
};
diff --git a/plugins/MacAU/PowerSag/PowerSag.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/PowerSag/PowerSag.xcodeproj/christopherjohnson.pbxuser
index 604cc41..e6e7e63 100755
--- a/plugins/MacAU/PowerSag/PowerSag.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacAU/PowerSag/PowerSag.xcodeproj/christopherjohnson.pbxuser
@@ -49,44 +49,44 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 528457549;
- PBXWorkspaceStateSaveDate = 528457549;
+ PBXPerProjectTemplateStateSaveDate = 569675661;
+ PBXWorkspaceStateSaveDate = 569675661;
};
perUserProjectItems = {
- 8B9D66491F7C8C32007AB60F /* PBXTextBookmark */ = 8B9D66491F7C8C32007AB60F /* PBXTextBookmark */;
- 8B9D75751F7F9F5D007AB60F /* PBXTextBookmark */ = 8B9D75751F7F9F5D007AB60F /* PBXTextBookmark */;
+ 8B792EFB21F4905E006E9731 /* PBXTextBookmark */ = 8B792EFB21F4905E006E9731 /* PBXTextBookmark */;
+ 8B792F0021F49091006E9731 /* PBXTextBookmark */ = 8B792F0021F49091006E9731 /* PBXTextBookmark */;
8BB300131EE206710016C2D8 /* PlistBookmark */ = 8BB300131EE206710016C2D8 /* PlistBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
- 8B9D66491F7C8C32007AB60F /* PBXTextBookmark */ = {
+ 8B792EFB21F4905E006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* PowerSag.cpp */;
- name = "PowerSag.cpp: 188";
+ name = "PowerSag.cpp: 186";
rLen = 0;
- rLoc = 8459;
+ rLoc = 8424;
rType = 0;
- vrLen = 573;
- vrLoc = 8121;
+ vrLen = 439;
+ vrLoc = 8244;
};
- 8B9D75751F7F9F5D007AB60F /* PBXTextBookmark */ = {
+ 8B792F0021F49091006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* PowerSag.cpp */;
- name = "PowerSag.cpp: 188";
+ name = "PowerSag.cpp: 186";
rLen = 0;
- rLoc = 8459;
+ rLoc = 8424;
rType = 0;
- vrLen = 571;
- vrLoc = 8121;
+ vrLen = 439;
+ vrLoc = 8244;
};
8BA05A660720730100365D66 /* PowerSag.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {656, 3744}}";
- sepNavSelRange = "{8459, 0}";
- sepNavVisRange = "{8121, 571}";
- sepNavWindowFrame = "{{746, 43}, {679, 835}}";
+ sepNavIntBoundsRect = "{{0, 0}, {656, 3562}}";
+ sepNavSelRange = "{8424, 0}";
+ sepNavVisRange = "{8244, 439}";
+ sepNavWindowFrame = "{{625, 43}, {679, 835}}";
};
};
8BA05A690720730100365D66 /* PowerSagVersion.h */ = {
@@ -111,10 +111,10 @@
};
8BC6025B073B072D006C4272 /* PowerSag.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {894, 1872}}";
- sepNavSelRange = "{5175, 52}";
- sepNavVisRange = "{3808, 1596}";
- sepNavWindowFrame = "{{761, 43}, {679, 835}}";
+ sepNavIntBoundsRect = "{{0, 0}, {894, 1833}}";
+ sepNavSelRange = "{5226, 0}";
+ sepNavVisRange = "{3698, 1662}";
+ sepNavWindowFrame = "{{126, 32}, {679, 835}}";
};
};
8BD3CCB8148830B20062E48C /* Source Control */ = {
diff --git a/plugins/MacAU/PowerSag/PowerSag.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/PowerSag/PowerSag.xcodeproj/christopherjohnson.perspectivev3
index b64b182..c90dcdd 100755
--- a/plugins/MacAU/PowerSag/PowerSag.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacAU/PowerSag/PowerSag.xcodeproj/christopherjohnson.perspectivev3
@@ -256,8 +256,6 @@
<key>Layout</key>
<array>
<dict>
- <key>BecomeActive</key>
- <true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBottomSmartGroupGIDs</key>
@@ -325,7 +323,7 @@
<real>288</real>
</array>
<key>RubberWindowFrame</key>
- <string>599 187 841 654 0 0 1440 878 </string>
+ <string>422 210 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -353,11 +351,11 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8B9D75751F7F9F5D007AB60F</string>
+ <string>8B792F0021F49091006E9731</string>
<key>history</key>
<array>
<string>8BB300131EE206710016C2D8</string>
- <string>8B9D66491F7C8C32007AB60F</string>
+ <string>8B792EFB21F4905E006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -371,18 +369,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {531, 202}}</string>
+ <string>{{0, 0}, {531, 188}}</string>
<key>RubberWindowFrame</key>
- <string>599 187 841 654 0 0 1440 878 </string>
+ <string>422 210 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>202pt</string>
+ <string>188pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>406pt</string>
+ <string>420pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -396,9 +394,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {531, 379}}</string>
- <key>RubberWindowFrame</key>
- <string>599 187 841 654 0 0 1440 878 </string>
+ <string>{{10, 27}, {531, 393}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -452,7 +448,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {531, 315}}</string>
+ <string>{{10, 27}, {531, 393}}</string>
+ <key>RubberWindowFrame</key>
+ <string>422 210 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -480,11 +478,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B9D75761F7F9F5D007AB60F</string>
+ <string>8B792F0121F49091006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B9D75771F7F9F5D007AB60F</string>
+ <string>8B792F0221F49091006E9731</string>
<string>8BD7274A1D46E5A5000176F0</string>
- <string>8B9D75781F7F9F5D007AB60F</string>
+ <string>8B792F0321F49091006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -657,7 +655,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>528457565.97925901</real>
+ <real>569675921.48933697</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -674,11 +672,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8B9D75791F7F9F5D007AB60F</string>
<string>/Users/christopherjohnson/Desktop/MacAU/PowerSag/PowerSag.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>599 187 841 654 0 0 1440 878 </string>
+ <string>422 210 841 654 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>