aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/PDChannel
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/PDChannel
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/PDChannel')
-rwxr-xr-xplugins/MacAU/PDChannel/PDChannel.cpp28
-rwxr-xr-xplugins/MacAU/PDChannel/PDChannel.h4
-rwxr-xr-xplugins/MacAU/PDChannel/PDChannel.xcodeproj/christopherjohnson.pbxuser40
-rwxr-xr-xplugins/MacAU/PDChannel/PDChannel.xcodeproj/christopherjohnson.perspectivev340
4 files changed, 50 insertions, 62 deletions
diff --git a/plugins/MacAU/PDChannel/PDChannel.cpp b/plugins/MacAU/PDChannel/PDChannel.cpp
index d0e684f..1571b15 100755
--- a/plugins/MacAU/PDChannel/PDChannel.cpp
+++ b/plugins/MacAU/PDChannel/PDChannel.cpp
@@ -170,9 +170,7 @@ void PDChannel::PDChannelKernel::Reset()
settingchase = -90.0;
chasespeed = 350.0;
previousSample = 0.0;
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
+ fpNShape = 0.0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -189,11 +187,7 @@ void PDChannel::PDChannelKernel::Process( const Float32 *inSourceP,
Float32 *destP = inDestP;
long double overallscale = 1.0;
overallscale /= 44100.0;
- overallscale *= GetSampleRate();
- Float32 fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
-
+ overallscale *= GetSampleRate();
Float64 inputgain = GetParameter( kParam_One );
Float64 intensity = GetParameter( kParam_Two );
Float64 apply;
@@ -271,19 +265,11 @@ void PDChannel::PDChannelKernel::Process( const Float32 *inSourceP,
previousSample = sin(drySample);
//apply the sine while storing previous sample
- //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/PDChannel/PDChannel.h b/plugins/MacAU/PDChannel/PDChannel.h
index 4a793af..523f789 100755
--- a/plugins/MacAU/PDChannel/PDChannel.h
+++ b/plugins/MacAU/PDChannel/PDChannel.h
@@ -132,9 +132,7 @@ public:
Float64 settingchase;
Float64 chasespeed;
Float64 previousSample;
- long double fpNShapeA;
- long double fpNShapeB;
- bool fpFlip;
+ long double fpNShape;
};
};
diff --git a/plugins/MacAU/PDChannel/PDChannel.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/PDChannel/PDChannel.xcodeproj/christopherjohnson.pbxuser
index 6a15292..f328d19 100755
--- a/plugins/MacAU/PDChannel/PDChannel.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacAU/PDChannel/PDChannel.xcodeproj/christopherjohnson.pbxuser
@@ -49,13 +49,13 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 538696889;
- PBXWorkspaceStateSaveDate = 538696889;
+ PBXPerProjectTemplateStateSaveDate = 569652339;
+ PBXWorkspaceStateSaveDate = 569652339;
};
perUserProjectItems = {
8B4E5745201BE1DA00B5DC2A /* PlistBookmark */ = 8B4E5745201BE1DA00B5DC2A /* PlistBookmark */;
- 8B4E5746201BE1DA00B5DC2A /* PBXBookmark */ = 8B4E5746201BE1DA00B5DC2A /* PBXBookmark */;
- 8B4E5747201BE1DA00B5DC2A /* PBXTextBookmark */ = 8B4E5747201BE1DA00B5DC2A /* PBXTextBookmark */;
+ 8B792E9E21F434CF006E9731 /* PBXTextBookmark */ = 8B792E9E21F434CF006E9731 /* PBXTextBookmark */;
+ 8B792EA321F434E3006E9731 /* PBXTextBookmark */ = 8B792EA321F434E3006E9731 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
@@ -71,28 +71,34 @@
);
name = /Users/christopherjohnson/Desktop/MacAU/PDChannel/Info.plist;
rLen = 0;
- rLoc = 9223372036854775807;
+ rLoc = 9223372036854775808;
};
- 8B4E5746201BE1DA00B5DC2A /* PBXBookmark */ = {
- isa = PBXBookmark;
+ 8B792E9E21F434CF006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* PDChannel.cpp */;
+ name = "PDChannel.cpp: 241";
+ rLen = 0;
+ rLoc = 10674;
+ rType = 0;
+ vrLen = 0;
+ vrLoc = 0;
};
- 8B4E5747201BE1DA00B5DC2A /* PBXTextBookmark */ = {
+ 8B792EA321F434E3006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 8BA05A660720730100365D66 /* PDChannel.cpp */;
- name = "PDChannel.cpp: 247";
+ name = "PDChannel.cpp: 241";
rLen = 0;
- rLoc = 10826;
+ rLoc = 10674;
rType = 0;
vrLen = 0;
vrLoc = 0;
};
8BA05A660720730100365D66 /* PDChannel.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {670, 3952}}";
- sepNavSelRange = "{10826, 0}";
+ sepNavIntBoundsRect = "{{0, 0}, {328, 3796}}";
+ sepNavSelRange = "{10674, 0}";
sepNavVisRange = "{0, 0}";
- sepNavWindowFrame = "{{782, 50}, {923, 828}}";
+ sepNavWindowFrame = "{{342, 50}, {923, 828}}";
};
};
8BA05A690720730100365D66 /* PDChannelVersion.h */ = {
@@ -105,10 +111,10 @@
};
8BC6025B073B072D006C4272 /* PDChannel.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {894, 1872}}";
- sepNavSelRange = "{5191, 95}";
- sepNavVisRange = "{3760, 1692}";
- sepNavWindowFrame = "{{15, 45}, {923, 828}}";
+ sepNavIntBoundsRect = "{{0, 0}, {894, 1846}}";
+ sepNavSelRange = "{5309, 0}";
+ sepNavVisRange = "{3711, 1702}";
+ sepNavWindowFrame = "{{24, 47}, {923, 828}}";
};
};
8BD3CCB8148830B20062E48C /* Source Control */ = {
diff --git a/plugins/MacAU/PDChannel/PDChannel.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/PDChannel/PDChannel.xcodeproj/christopherjohnson.perspectivev3
index fd2188d..9a9368c 100755
--- a/plugins/MacAU/PDChannel/PDChannel.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacAU/PDChannel/PDChannel.xcodeproj/christopherjohnson.perspectivev3
@@ -225,8 +225,8 @@
<array/>
<key>PerspectiveWidths</key>
<array>
- <integer>841</integer>
- <integer>841</integer>
+ <integer>687</integer>
+ <integer>687</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>
@@ -302,7 +300,7 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
- <integer>4</integer>
+ <integer>3</integer>
<integer>2</integer>
<integer>1</integer>
<integer>0</integer>
@@ -326,7 +324,7 @@
<real>288</real>
</array>
<key>RubberWindowFrame</key>
- <string>748 122 687 476 0 0 1440 878 </string>
+ <string>528 250 687 476 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -354,11 +352,11 @@
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8B4E5747201BE1DA00B5DC2A</string>
+ <string>8B792EA321F434E3006E9731</string>
<key>history</key>
<array>
<string>8B4E5745201BE1DA00B5DC2A</string>
- <string>8B4E5746201BE1DA00B5DC2A</string>
+ <string>8B792E9E21F434CF006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -372,18 +370,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {377, 32}}</string>
+ <string>{{0, 0}, {377, 13}}</string>
<key>RubberWindowFrame</key>
- <string>748 122 687 476 0 0 1440 878 </string>
+ <string>528 250 687 476 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>32pt</string>
+ <string>13pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>398pt</string>
+ <string>417pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -397,9 +395,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {377, 371}}</string>
- <key>RubberWindowFrame</key>
- <string>748 122 687 476 0 0 1440 878 </string>
+ <string>{{10, 27}, {377, 390}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -453,7 +449,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {531, 339}}</string>
+ <string>{{10, 27}, {377, 390}}</string>
+ <key>RubberWindowFrame</key>
+ <string>528 250 687 476 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -481,11 +479,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B4E5748201BE1DA00B5DC2A</string>
+ <string>8B792EA421F434E3006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B4E5749201BE1DA00B5DC2A</string>
+ <string>8B792EA521F434E3006E9731</string>
<string>8BD7274A1D46E5A5000176F0</string>
- <string>8B4E574A201BE1DA00B5DC2A</string>
+ <string>8B792EA621F434E3006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -658,7 +656,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>538698202.06812799</real>
+ <real>569652451.32998204</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -678,7 +676,7 @@
<string>/Users/christopherjohnson/Desktop/MacAU/PDChannel/PDChannel.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>748 122 687 476 0 0 1440 878 </string>
+ <string>528 250 687 476 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>