aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/Tremolo
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/Tremolo
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/Tremolo')
-rwxr-xr-xplugins/MacAU/Tremolo/Tremolo.cpp27
-rwxr-xr-xplugins/MacAU/Tremolo/Tremolo.h5
-rwxr-xr-xplugins/MacAU/Tremolo/Tremolo.xcodeproj/christopherjohnson.pbxuser53
-rwxr-xr-xplugins/MacAU/Tremolo/Tremolo.xcodeproj/christopherjohnson.perspectivev352
4 files changed, 64 insertions, 73 deletions
diff --git a/plugins/MacAU/Tremolo/Tremolo.cpp b/plugins/MacAU/Tremolo/Tremolo.cpp
index e70b244..6e1f644 100755
--- a/plugins/MacAU/Tremolo/Tremolo.cpp
+++ b/plugins/MacAU/Tremolo/Tremolo.cpp
@@ -173,9 +173,7 @@ void Tremolo::TremoloKernel::Reset()
depthAmount = 0.0;
lastSpeed = 1000.0;
lastDepth = 1000.0;
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
+ fpNShape = 0.0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -216,9 +214,6 @@ void Tremolo::TremoloKernel::Process( const Float32 *inSourceP,
Float64 out;
Float64 bridgerectifier;
Float64 offset;
- Float32 fpTemp;
- Float64 fpOld = 0.618033988749894848204586; //golden ratio!
- Float64 fpNew = 1.0 - fpOld;
while (nSampleFrames-- > 0) {
inputSample = *sourceP;
@@ -289,22 +284,12 @@ void Tremolo::TremoloKernel::Process( const Float32 *inSourceP,
//apply tremolo, apply gain boost to compensate for volume loss
inputSample = (drySample * (1-depth)) + (inputSample*depth);
- //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;
destP += inNumChannels;
sourceP += inNumChannels;
diff --git a/plugins/MacAU/Tremolo/Tremolo.h b/plugins/MacAU/Tremolo/Tremolo.h
index 38910c3..8b4204a 100755
--- a/plugins/MacAU/Tremolo/Tremolo.h
+++ b/plugins/MacAU/Tremolo/Tremolo.h
@@ -136,10 +136,7 @@ public:
Float64 lastSpeed;
Float64 lastDepth;
Float64 sweep;
- Float64 fpNShapeA;
- Float64 fpNShapeB;
- bool fpFlip;
-
+ Float64 fpNShape;
};
};
diff --git a/plugins/MacAU/Tremolo/Tremolo.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Tremolo/Tremolo.xcodeproj/christopherjohnson.pbxuser
index 822426d..4a72292 100755
--- a/plugins/MacAU/Tremolo/Tremolo.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacAU/Tremolo/Tremolo.xcodeproj/christopherjohnson.pbxuser
@@ -10,7 +10,7 @@
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
- 364,
+ 528,
20,
48,
43,
@@ -49,43 +49,54 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 528458789;
- PBXWorkspaceStateSaveDate = 528458789;
+ PBXPerProjectTemplateStateSaveDate = 569685954;
+ PBXWorkspaceStateSaveDate = 569685954;
};
perUserProjectItems = {
- 8B9D681F1F7C91BB007AB60F /* PBXTextBookmark */ = 8B9D681F1F7C91BB007AB60F /* PBXTextBookmark */;
- 8B9D76FB1F7FA435007AB60F /* PBXTextBookmark */ = 8B9D76FB1F7FA435007AB60F /* PBXTextBookmark */;
+ 8B7931EE21F4B82A006E9731 /* PBXTextBookmark */ = 8B7931EE21F4B82A006E9731 /* PBXTextBookmark */;
+ 8B7931F021F4B82A006E9731 /* PBXTextBookmark */ = 8B7931F021F4B82A006E9731 /* PBXTextBookmark */;
+ 8B7931F521F4B845006E9731 /* PBXTextBookmark */ = 8B7931F521F4B845006E9731 /* PBXTextBookmark */;
8BD8CB021DF8ECAA00CC3427 /* PBXTextBookmark */ = 8BD8CB021DF8ECAA00CC3427 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
- 8B9D681F1F7C91BB007AB60F /* PBXTextBookmark */ = {
+ 8B7931EE21F4B82A006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 8BC6025B073B072D006C4272 /* Tremolo.h */;
+ name = "Tremolo.h: 139";
+ rLen = 0;
+ rLoc = 5331;
+ rType = 0;
+ vrLen = 813;
+ vrLoc = 4630;
+ };
+ 8B7931F021F4B82A006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* Tremolo.cpp */;
- name = "Tremolo.cpp: 290";
+ name = "Tremolo.cpp: 292";
rLen = 0;
- rLoc = 12305;
+ rLoc = 12430;
rType = 0;
- vrLen = 145;
- vrLoc = 10647;
+ vrLen = 1235;
+ vrLoc = 11280;
};
- 8B9D76FB1F7FA435007AB60F /* PBXTextBookmark */ = {
+ 8B7931F521F4B845006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* Tremolo.cpp */;
- name = "Tremolo.cpp: 290";
+ name = "Tremolo.cpp: 292";
rLen = 0;
- rLoc = 12305;
+ rLoc = 12430;
rType = 0;
- vrLen = 0;
- vrLoc = 0;
+ vrLen = 1268;
+ vrLoc = 11247;
};
8BA05A660720730100365D66 /* Tremolo.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {554, 4108}}";
- sepNavSelRange = "{12305, 0}";
- sepNavVisRange = "{0, 0}";
+ sepNavIntBoundsRect = "{{0, 0}, {718, 4043}}";
+ sepNavSelRange = "{12430, 0}";
+ sepNavVisRange = "{11247, 1268}";
sepNavWindowFrame = "{{386, 39}, {1024, 839}}";
};
};
@@ -107,9 +118,9 @@
};
8BC6025B073B072D006C4272 /* Tremolo.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {922, 1885}}";
- sepNavSelRange = "{5163, 132}";
- sepNavVisRange = "{4043, 1438}";
+ sepNavIntBoundsRect = "{{0, 0}, {922, 2262}}";
+ sepNavSelRange = "{5331, 0}";
+ sepNavVisRange = "{4630, 813}";
sepNavWindowFrame = "{{469, 34}, {679, 835}}";
};
};
diff --git a/plugins/MacAU/Tremolo/Tremolo.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Tremolo/Tremolo.xcodeproj/christopherjohnson.perspectivev3
index 0be2553..832afcd 100755
--- a/plugins/MacAU/Tremolo/Tremolo.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacAU/Tremolo/Tremolo.xcodeproj/christopherjohnson.perspectivev3
@@ -225,8 +225,8 @@
<array/>
<key>PerspectiveWidths</key>
<array>
- <integer>810</integer>
- <integer>810</integer>
+ <integer>954</integer>
+ <integer>954</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>
@@ -282,7 +280,7 @@
<dict>
<key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
<array>
- <real>185</real>
+ <real>165</real>
</array>
<key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
<array>
@@ -307,7 +305,7 @@
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
- <string>{{0, 0}, {185, 428}}</string>
+ <string>{{0, 0}, {165, 635}}</string>
</dict>
<key>PBXTopSmartGroupGIDs</key>
<array/>
@@ -317,19 +315,19 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {202, 446}}</string>
+ <string>{{0, 0}, {182, 653}}</string>
<key>GroupTreeTableConfiguration</key>
<array>
<string>MainColumn</string>
- <real>185</real>
+ <real>165</real>
</array>
<key>RubberWindowFrame</key>
- <string>504 296 810 487 0 0 1440 878 </string>
+ <string>341 162 954 694 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
<key>Proportion</key>
- <string>202pt</string>
+ <string>182pt</string>
</dict>
<dict>
<key>Dock</key>
@@ -352,11 +350,12 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8B9D76FB1F7FA435007AB60F</string>
+ <string>8B7931F521F4B845006E9731</string>
<key>history</key>
<array>
<string>8BD8CB021DF8ECAA00CC3427</string>
- <string>8B9D681F1F7C91BB007AB60F</string>
+ <string>8B7931EE21F4B82A006E9731</string>
+ <string>8B7931F021F4B82A006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -370,18 +369,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {603, 32}}</string>
+ <string>{{0, 0}, {767, 469}}</string>
<key>RubberWindowFrame</key>
- <string>504 296 810 487 0 0 1440 878 </string>
+ <string>341 162 954 694 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>32pt</string>
+ <string>469pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>409pt</string>
+ <string>179pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -395,9 +394,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 382}}</string>
- <key>RubberWindowFrame</key>
- <string>504 296 810 487 0 0 1440 878 </string>
+ <string>{{10, 27}, {767, 152}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -451,7 +448,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 282}}</string>
+ <string>{{10, 27}, {767, 152}}</string>
+ <key>RubberWindowFrame</key>
+ <string>341 162 954 694 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -460,7 +459,7 @@
</dict>
</array>
<key>Proportion</key>
- <string>603pt</string>
+ <string>767pt</string>
</dict>
</array>
<key>Name</key>
@@ -479,11 +478,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B9D76FC1F7FA435007AB60F</string>
+ <string>8B7931F621F4B845006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B9D76FD1F7FA435007AB60F</string>
+ <string>8B7931F721F4B845006E9731</string>
<string>8B3ED5B51DDE654F004F9D64</string>
- <string>8B9D76FE1F7FA435007AB60F</string>
+ <string>8B7931F821F4B845006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -636,7 +635,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>528458805.46372598</real>
+ <real>569686085.74729097</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -653,11 +652,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8B9D76FF1F7FA435007AB60F</string>
<string>/Users/christopherjohnson/Desktop/MacAU/Tremolo/Tremolo.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>504 296 810 487 0 0 1440 878 </string>
+ <string>341 162 954 694 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>