aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/Lowpass
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/Lowpass
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/Lowpass')
-rwxr-xr-xplugins/MacAU/Lowpass/Lowpass.cpp25
-rwxr-xr-xplugins/MacAU/Lowpass/Lowpass.h3
-rwxr-xr-xplugins/MacAU/Lowpass/Lowpass.xcodeproj/christopherjohnson.pbxuser24
-rwxr-xr-xplugins/MacAU/Lowpass/Lowpass.xcodeproj/christopherjohnson.perspectivev339
4 files changed, 38 insertions, 53 deletions
diff --git a/plugins/MacAU/Lowpass/Lowpass.cpp b/plugins/MacAU/Lowpass/Lowpass.cpp
index 234b763..f727829 100755
--- a/plugins/MacAU/Lowpass/Lowpass.cpp
+++ b/plugins/MacAU/Lowpass/Lowpass.cpp
@@ -176,8 +176,7 @@ void Lowpass::LowpassKernel::Reset()
{
iirSampleA = 0.0;
iirSampleB = 0.0;
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
+ fpNShape = 0.0;
fpFlip = true;
}
@@ -205,9 +204,6 @@ void Lowpass::LowpassKernel::Process( const Float32 *inSourceP,
Float64 offset;
Float64 inputSample;
Float64 outputSample;
- Float32 fpTemp;
- Float64 fpOld = 0.618033988749894848204586; //golden ratio!
- Float64 fpNew = 1.0 - fpOld;
iirAmount += (iirAmount * tight * tight);
if (tight > 0) tight /= 1.5;
@@ -262,20 +258,13 @@ void Lowpass::LowpassKernel::Process( const Float32 *inSourceP,
}
if (wet < 1.0) outputSample = (outputSample * wet) + (inputSample * dry);
-
- //noise shaping to 32-bit floating point
- if (fpFlip) {
- fpTemp = outputSample;
- fpNShapeA = (fpNShapeA*fpOld)+((outputSample-fpTemp)*fpNew);
- outputSample += fpNShapeA;
- }
- else {
- fpTemp = outputSample;
- fpNShapeB = (fpNShapeB*fpOld)+((outputSample-fpTemp)*fpNew);
- outputSample += 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 = outputSample;
sourceP += inNumChannels;
diff --git a/plugins/MacAU/Lowpass/Lowpass.h b/plugins/MacAU/Lowpass/Lowpass.h
index 695a116..cf12e75 100755
--- a/plugins/MacAU/Lowpass/Lowpass.h
+++ b/plugins/MacAU/Lowpass/Lowpass.h
@@ -133,8 +133,7 @@ public:
private:
Float64 iirSampleA;
Float64 iirSampleB;
- long double fpNShapeA;
- long double fpNShapeB;
+ long double fpNShape;
bool fpFlip;
};
};
diff --git a/plugins/MacAU/Lowpass/Lowpass.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Lowpass/Lowpass.xcodeproj/christopherjohnson.pbxuser
index f5f0bfd..badd1c8 100755
--- a/plugins/MacAU/Lowpass/Lowpass.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacAU/Lowpass/Lowpass.xcodeproj/christopherjohnson.pbxuser
@@ -49,14 +49,14 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 528456837;
- PBXWorkspaceStateSaveDate = 528456837;
+ PBXPerProjectTemplateStateSaveDate = 569650365;
+ PBXWorkspaceStateSaveDate = 569650365;
};
perUserProjectItems = {
8B22B12A1DB18F4E0075D7AA /* PBXTextBookmark */ = 8B22B12A1DB18F4E0075D7AA /* PBXTextBookmark */;
8B22B12B1DB18F4E0075D7AA /* PBXTextBookmark */ = 8B22B12B1DB18F4E0075D7AA /* PBXTextBookmark */;
- 8B9D65961F7C8AEB007AB60F /* PBXTextBookmark */ = 8B9D65961F7C8AEB007AB60F /* PBXTextBookmark */;
- 8B9D74E11F7F9CD5007AB60F /* PBXTextBookmark */ = 8B9D74E11F7F9CD5007AB60F /* PBXTextBookmark */;
+ 8B792DE821F42D38006E9731 /* PBXTextBookmark */ = 8B792DE821F42D38006E9731 /* PBXTextBookmark */;
+ 8B792DED21F42D64006E9731 /* PBXTextBookmark */ = 8B792DED21F42D64006E9731 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
@@ -82,7 +82,7 @@
vrLen = 672;
vrLoc = 7641;
};
- 8B9D65961F7C8AEB007AB60F /* PBXTextBookmark */ = {
+ 8B792DE821F42D38006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* Lowpass.h */;
name = "Lowpass.h: 134";
@@ -92,21 +92,21 @@
vrLen = 647;
vrLoc = 2906;
};
- 8B9D74E11F7F9CD5007AB60F /* PBXTextBookmark */ = {
+ 8B792DED21F42D64006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BC6025B073B072D006C4272 /* Lowpass.h */;
name = "Lowpass.h: 134";
rLen = 44;
rLoc = 5247;
rType = 0;
- vrLen = 647;
+ vrLen = 379;
vrLoc = 2906;
};
8BA05A660720730100365D66 /* Lowpass.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {964, 3770}}";
- sepNavSelRange = "{9874, 0}";
- sepNavVisRange = "{9374, 2090}";
+ sepNavIntBoundsRect = "{{0, 0}, {964, 3796}}";
+ sepNavSelRange = "{11986, 0}";
+ sepNavVisRange = "{10557, 1517}";
sepNavWindowFrame = "{{418, 133}, {903, 692}}";
};
};
@@ -128,9 +128,9 @@
};
8BC6025B073B072D006C4272 /* Lowpass.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {824, 2080}}";
+ sepNavIntBoundsRect = "{{0, 0}, {824, 1911}}";
sepNavSelRange = "{5247, 44}";
- sepNavVisRange = "{2906, 647}";
+ sepNavVisRange = "{2906, 379}";
sepNavWindowFrame = "{{15, 54}, {895, 819}}";
};
};
diff --git a/plugins/MacAU/Lowpass/Lowpass.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Lowpass/Lowpass.xcodeproj/christopherjohnson.perspectivev3
index 77c2c6b..1791e2f 100755
--- a/plugins/MacAU/Lowpass/Lowpass.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacAU/Lowpass/Lowpass.xcodeproj/christopherjohnson.perspectivev3
@@ -225,8 +225,8 @@
<array/>
<key>PerspectiveWidths</key>
<array>
- <integer>-1</integer>
- <integer>-1</integer>
+ <integer>810</integer>
+ <integer>810</integer>
</array>
<key>Perspectives</key>
<array>
@@ -256,8 +256,6 @@
<key>Layout</key>
<array>
<dict>
- <key>BecomeActive</key>
- <true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBottomSmartGroupGIDs</key>
@@ -324,7 +322,7 @@
<real>185</real>
</array>
<key>RubberWindowFrame</key>
- <string>548 245 810 487 0 0 1440 878 </string>
+ <string>445 250 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -352,12 +350,12 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8B9D74E11F7F9CD5007AB60F</string>
+ <string>8B792DED21F42D64006E9731</string>
<key>history</key>
<array>
<string>8B22B12A1DB18F4E0075D7AA</string>
<string>8B22B12B1DB18F4E0075D7AA</string>
- <string>8B9D65961F7C8AEB007AB60F</string>
+ <string>8B792DE821F42D38006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -371,18 +369,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {603, 325}}</string>
+ <string>{{0, 0}, {603, 146}}</string>
<key>RubberWindowFrame</key>
- <string>548 245 810 487 0 0 1440 878 </string>
+ <string>445 250 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>325pt</string>
+ <string>146pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>116pt</string>
+ <string>295pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -396,9 +394,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 89}}</string>
- <key>RubberWindowFrame</key>
- <string>548 245 810 487 0 0 1440 878 </string>
+ <string>{{10, 27}, {603, 95}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -452,7 +448,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 414}}</string>
+ <string>{{10, 27}, {603, 268}}</string>
+ <key>RubberWindowFrame</key>
+ <string>445 250 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -480,11 +478,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B9D74E21F7F9CD5007AB60F</string>
+ <string>8B792DEE21F42D64006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B9D74E31F7F9CD5007AB60F</string>
+ <string>8B792DEF21F42D64006E9731</string>
<string>8B48C3411DAAD496009A0ADD</string>
- <string>8B9D74E41F7F9CD5007AB60F</string>
+ <string>8B792DF021F42D64006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -637,7 +635,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>528456917.709867</real>
+ <real>569650532.61439598</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -654,11 +652,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8B9D74E51F7F9CD5007AB60F</string>
<string>/Users/christopherjohnson/Desktop/MacAU/Lowpass/Lowpass.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>548 245 810 487 0 0 1440 878 </string>
+ <string>445 250 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>