aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/CStrip
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/CStrip
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/CStrip')
-rwxr-xr-xplugins/MacAU/CStrip/CStrip.cpp27
-rwxr-xr-xplugins/MacAU/CStrip/CStrip.h4
-rwxr-xr-xplugins/MacAU/CStrip/CStrip.xcodeproj/christopherjohnson.pbxuser62
-rwxr-xr-xplugins/MacAU/CStrip/CStrip.xcodeproj/christopherjohnson.perspectivev335
4 files changed, 57 insertions, 71 deletions
diff --git a/plugins/MacAU/CStrip/CStrip.cpp b/plugins/MacAU/CStrip/CStrip.cpp
index 78b3c31..494d6b5 100755
--- a/plugins/MacAU/CStrip/CStrip.cpp
+++ b/plugins/MacAU/CStrip/CStrip.cpp
@@ -257,9 +257,7 @@ ComponentResult CStrip::Initialize()
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void CStrip::CStripKernel::Reset()
{
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
+ fpNShape = 0.0;
lastSample = 0.0;
last2Sample = 0.0;
@@ -347,9 +345,8 @@ void CStrip::CStripKernel::Process( const Float32 *inSourceP,
overallscale = GetSampleRate();
compscale = compscale * overallscale;
//compscale is the one that's 1 or something like 2.2 for 96K rates
- Float32 fpTemp;
- Float64 fpOld = 0.618033988749894848204586; //golden ratio!
- Float64 fpNew = 1.0 - fpOld;
+ long double fpOld = 0.618033988749894848204586; //golden ratio!
+ long double fpNew = 1.0 - fpOld;
Float64 inputSample;
Float64 highSample = 0.0;
@@ -767,19 +764,11 @@ void CStrip::CStripKernel::Process( const Float32 *inSourceP,
//built in output trim and dry/wet if desired
if (outputgain != 1.0) inputSample *= outputgain;
- //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 = not 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/CStrip/CStrip.h b/plugins/MacAU/CStrip/CStrip.h
index 750ef35..f12b4c8 100755
--- a/plugins/MacAU/CStrip/CStrip.h
+++ b/plugins/MacAU/CStrip/CStrip.h
@@ -162,9 +162,7 @@ public:
virtual void Reset();
private:
- Float64 fpNShapeA;
- Float64 fpNShapeB;
- bool fpFlip;
+ Float64 fpNShape;
Float64 lastSample;
Float64 last2Sample;
diff --git a/plugins/MacAU/CStrip/CStrip.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/CStrip/CStrip.xcodeproj/christopherjohnson.pbxuser
index 22fd68a..d0297d0 100755
--- a/plugins/MacAU/CStrip/CStrip.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacAU/CStrip/CStrip.xcodeproj/christopherjohnson.pbxuser
@@ -49,23 +49,43 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 559506724;
- PBXWorkspaceStateSaveDate = 559506724;
+ PBXPerProjectTemplateStateSaveDate = 569595746;
+ PBXWorkspaceStateSaveDate = 569595746;
};
perUserProjectItems = {
- 8BE626742159682E00E4E476 /* PBXTextBookmark */ = 8BE626742159682E00E4E476 /* PBXTextBookmark */;
- 8BE626752159682E00E4E476 /* PBXTextBookmark */ = 8BE626752159682E00E4E476 /* PBXTextBookmark */;
+ 8B792A1221F357B8006E9731 /* PBXTextBookmark */ = 8B792A1221F357B8006E9731 /* PBXTextBookmark */;
+ 8B792A1C21F357E5006E9731 /* PBXTextBookmark */ = 8B792A1C21F357E5006E9731 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
+ 8B792A1221F357B8006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 8BC6025B073B072D006C4272 /* CStrip.h */;
+ name = "CStrip.h: 167";
+ rLen = 45;
+ rLoc = 6671;
+ rType = 0;
+ vrLen = 136;
+ vrLoc = 6648;
+ };
+ 8B792A1C21F357E5006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 8BC6025B073B072D006C4272 /* CStrip.h */;
+ name = "CStrip.h: 167";
+ rLen = 45;
+ rLoc = 6671;
+ rType = 0;
+ vrLen = 136;
+ vrLoc = 6648;
+ };
8BA05A660720730100365D66 /* CStrip.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {989, 10972}}";
- sepNavSelRange = "{12483, 39}";
- sepNavVisRange = "{16317, 1951}";
- sepNavWindowFrame = "{{618, 70}, {1036, 808}}";
+ sepNavIntBoundsRect = "{{0, 0}, {989, 10543}}";
+ sepNavSelRange = "{14732, 0}";
+ sepNavVisRange = "{13582, 1981}";
+ sepNavWindowFrame = "{{305, 65}, {1036, 808}}";
};
};
8BA05A680720730100365D66 /* CStrip.r */ = {
@@ -86,9 +106,9 @@
};
8BC6025B073B072D006C4272 /* CStrip.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {803, 3445}}";
- sepNavSelRange = "{6708, 45}";
- sepNavVisRange = "{6648, 121}";
+ sepNavIntBoundsRect = "{{0, 0}, {554, 3289}}";
+ sepNavSelRange = "{6671, 45}";
+ sepNavVisRange = "{6648, 136}";
sepNavWindowFrame = "{{686, 40}, {754, 805}}";
};
};
@@ -106,26 +126,6 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
- 8BE626742159682E00E4E476 /* PBXTextBookmark */ = {
- isa = PBXTextBookmark;
- fRef = 8BC6025B073B072D006C4272 /* CStrip.h */;
- name = "CStrip.h: 169";
- rLen = 45;
- rLoc = 6708;
- rType = 0;
- vrLen = 121;
- vrLoc = 6648;
- };
- 8BE626752159682E00E4E476 /* PBXTextBookmark */ = {
- isa = PBXTextBookmark;
- fRef = 8BC6025B073B072D006C4272 /* CStrip.h */;
- name = "CStrip.h: 169";
- rLen = 45;
- rLoc = 6708;
- rType = 0;
- vrLen = 121;
- vrLoc = 6648;
- };
8D01CCC60486CAD60068D4B7 /* CStrip */ = {
activeExec = 0;
};
diff --git a/plugins/MacAU/CStrip/CStrip.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/CStrip/CStrip.xcodeproj/christopherjohnson.perspectivev3
index 02abfef..045b469 100755
--- a/plugins/MacAU/CStrip/CStrip.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacAU/CStrip/CStrip.xcodeproj/christopherjohnson.perspectivev3
@@ -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>619 317 810 487 0 0 1440 878 </string>
+ <string>471 312 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -352,10 +350,10 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8BE626752159682E00E4E476</string>
+ <string>8B792A1C21F357E5006E9731</string>
<key>history</key>
<array>
- <string>8BE626742159682E00E4E476</string>
+ <string>8B792A1221F357B8006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -369,18 +367,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {603, 132}}</string>
+ <string>{{0, 0}, {603, 117}}</string>
<key>RubberWindowFrame</key>
- <string>619 317 810 487 0 0 1440 878 </string>
+ <string>471 312 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>
@@ -394,9 +392,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 282}}</string>
- <key>RubberWindowFrame</key>
- <string>619 317 810 487 0 0 1440 878 </string>
+ <string>{{10, 27}, {603, 297}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -450,7 +446,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 414}}</string>
+ <string>{{10, 27}, {603, 297}}</string>
+ <key>RubberWindowFrame</key>
+ <string>471 312 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -478,11 +476,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8BE626762159682E00E4E476</string>
+ <string>8B792A1D21F357E5006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8BE626772159682E00E4E476</string>
+ <string>8B792A1E21F357E5006E9731</string>
<string>8BB5DCD21FBCB6E7008B4570</string>
- <string>8BE626782159682E00E4E476</string>
+ <string>8B792A1F21F357E5006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -635,7 +633,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>559507502.89647996</real>
+ <real>569595877.85073602</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -652,10 +650,11 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
+ <string>8B792A2021F357E5006E9731</string>
<string>/Users/christopherjohnson/Desktop/MacAU/CStrip/CStrip.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>619 317 810 487 0 0 1440 878 </string>
+ <string>471 312 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>