aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/Melt
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/Melt
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/Melt')
-rwxr-xr-xplugins/MacAU/Melt/Melt.cpp28
-rwxr-xr-xplugins/MacAU/Melt/Melt.h4
-rwxr-xr-xplugins/MacAU/Melt/Melt.xcodeproj/christopherjohnson.pbxuser40
-rwxr-xr-xplugins/MacAU/Melt/Melt.xcodeproj/christopherjohnson.perspectivev335
4 files changed, 43 insertions, 64 deletions
diff --git a/plugins/MacAU/Melt/Melt.cpp b/plugins/MacAU/Melt/Melt.cpp
index 8da35b4..eaca93d 100755
--- a/plugins/MacAU/Melt/Melt.cpp
+++ b/plugins/MacAU/Melt/Melt.cpp
@@ -189,10 +189,7 @@ void Melt::MeltKernel::Reset()
stepCount = 0;
slowCount = 0;
gcount = 0;
-
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
+ fpNShape = 0.0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -245,10 +242,6 @@ void Melt::MeltKernel::Process( const Float32 *inSourceP,
minTap[28] = floor(109 * depthA); maxTap[28] = floor(109 * depthB);
minTap[29] = floor(113 * depthA); maxTap[29] = floor(113 * depthB);
minTap[30] = floor(117 * depthA); maxTap[30] = floor(117 * depthB);
-
- Float32 fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
long double drySample;
long double inputSample;
@@ -370,20 +363,11 @@ void Melt::MeltKernel::Process( const Float32 *inSourceP,
//nice little output stage template: if we have another scale of floating point
//number, we really don't want to meaninglessly multiply that by 1.0.
-
- //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/Melt/Melt.h b/plugins/MacAU/Melt/Melt.h
index b8e7122..4473fb5 100755
--- a/plugins/MacAU/Melt/Melt.h
+++ b/plugins/MacAU/Melt/Melt.h
@@ -145,9 +145,7 @@ public:
Float32 scalefactor;
int gcount;
//we're using 32 bit because we want to build some truncation into the tails to noise them.
- long double fpNShapeA;
- long double fpNShapeB;
- bool fpFlip;
+ long double fpNShape;
};
};
diff --git a/plugins/MacAU/Melt/Melt.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Melt/Melt.xcodeproj/christopherjohnson.pbxuser
index 608567f..0973f73 100755
--- a/plugins/MacAU/Melt/Melt.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacAU/Melt/Melt.xcodeproj/christopherjohnson.pbxuser
@@ -49,14 +49,14 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 528456926;
- PBXWorkspaceStateSaveDate = 528456926;
+ PBXPerProjectTemplateStateSaveDate = 569650600;
+ PBXWorkspaceStateSaveDate = 569650600;
};
perUserProjectItems = {
8B3483971E27D980007B1BF6 /* PlistBookmark */ = 8B3483971E27D980007B1BF6 /* PlistBookmark */;
8B4296221E6DCF55007D8787 /* PBXTextBookmark */ = 8B4296221E6DCF55007D8787 /* PBXTextBookmark */;
- 8B9D65A91F7C8B27007AB60F /* PBXTextBookmark */ = 8B9D65A91F7C8B27007AB60F /* PBXTextBookmark */;
- 8B9D74F01F7F9D02007AB60F /* PBXTextBookmark */ = 8B9D74F01F7F9D02007AB60F /* PBXTextBookmark */;
+ 8B792DFF21F42E3C006E9731 /* PBXTextBookmark */ = 8B792DFF21F42E3C006E9731 /* PBXTextBookmark */;
+ 8B792E0421F42E5D006E9731 /* PBXTextBookmark */ = 8B792E0421F42E5D006E9731 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
@@ -84,48 +84,48 @@
vrLen = 354;
vrLoc = 5375;
};
- 8B9D65A91F7C8B27007AB60F /* PBXTextBookmark */ = {
+ 8B792DFF21F42E3C006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A690720730100365D66 /* MeltVersion.h */;
name = "MeltVersion.h: 56";
rLen = 0;
rLoc = 2913;
rType = 0;
- vrLen = 326;
- vrLoc = 2595;
+ vrLen = 274;
+ vrLoc = 2647;
};
- 8B9D74F01F7F9D02007AB60F /* PBXTextBookmark */ = {
+ 8B792E0421F42E5D006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A690720730100365D66 /* MeltVersion.h */;
name = "MeltVersion.h: 56";
rLen = 0;
rLoc = 2913;
rType = 0;
- vrLen = 300;
- vrLoc = 2621;
+ vrLen = 274;
+ vrLoc = 2647;
};
8BA05A660720730100365D66 /* Melt.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {880, 4914}}";
- sepNavSelRange = "{12007, 0}";
- sepNavVisRange = "{11242, 2563}";
- sepNavWindowFrame = "{{516, 41}, {923, 837}}";
+ sepNavIntBoundsRect = "{{0, 0}, {876, 5252}}";
+ sepNavSelRange = "{16035, 0}";
+ sepNavVisRange = "{14613, 1510}";
+ sepNavWindowFrame = "{{351, 41}, {923, 837}}";
};
};
8BA05A690720730100365D66 /* MeltVersion.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {824, 793}}";
+ sepNavIntBoundsRect = "{{0, 0}, {824, 832}}";
sepNavSelRange = "{2913, 0}";
- sepNavVisRange = "{2621, 300}";
+ sepNavVisRange = "{2647, 274}";
sepNavWindowFrame = "{{15, 39}, {923, 837}}";
};
};
8BC6025B073B072D006C4272 /* Melt.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {894, 2041}}";
- sepNavSelRange = "{5375, 185}";
- sepNavVisRange = "{2703, 1607}";
- sepNavWindowFrame = "{{780, 30}, {923, 837}}";
+ sepNavIntBoundsRect = "{{0, 0}, {894, 2028}}";
+ sepNavSelRange = "{5681, 0}";
+ sepNavVisRange = "{4205, 1578}";
+ sepNavWindowFrame = "{{358, 41}, {923, 837}}";
};
};
8BD3CCB8148830B20062E48C /* Source Control */ = {
diff --git a/plugins/MacAU/Melt/Melt.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Melt/Melt.xcodeproj/christopherjohnson.perspectivev3
index a3708e3..09058db 100755
--- a/plugins/MacAU/Melt/Melt.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacAU/Melt/Melt.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 164 841 654 0 0 1440 878 </string>
+ <string>461 194 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -353,12 +351,12 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8B9D74F01F7F9D02007AB60F</string>
+ <string>8B792E0421F42E5D006E9731</string>
<key>history</key>
<array>
<string>8B3483971E27D980007B1BF6</string>
<string>8B4296221E6DCF55007D8787</string>
- <string>8B9D65A91F7C8B27007AB60F</string>
+ <string>8B792DFF21F42E3C006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -372,18 +370,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {531, 216}}</string>
+ <string>{{0, 0}, {531, 202}}</string>
<key>RubberWindowFrame</key>
- <string>599 164 841 654 0 0 1440 878 </string>
+ <string>461 194 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>216pt</string>
+ <string>202pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>392pt</string>
+ <string>406pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -397,9 +395,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {531, 365}}</string>
- <key>RubberWindowFrame</key>
- <string>599 164 841 654 0 0 1440 878 </string>
+ <string>{{10, 27}, {531, 379}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -453,7 +449,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {531, 315}}</string>
+ <string>{{10, 27}, {531, 379}}</string>
+ <key>RubberWindowFrame</key>
+ <string>461 194 841 654 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -481,11 +479,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B9D74F11F7F9D02007AB60F</string>
+ <string>8B792E0521F42E5D006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B9D74F21F7F9D02007AB60F</string>
+ <string>8B792E0621F42E5D006E9731</string>
<string>8BD7274A1D46E5A5000176F0</string>
- <string>8B9D74F31F7F9D02007AB60F</string>
+ <string>8B792E0721F42E5D006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -658,7 +656,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>528456962.27142799</real>
+ <real>569650781.22719395</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -675,11 +673,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8B9D74F41F7F9D02007AB60F</string>
<string>/Users/christopherjohnson/Desktop/MacAU/Melt/Melt.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>599 164 841 654 0 0 1440 878 </string>
+ <string>461 194 841 654 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>