aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/PurestWarm
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/PurestWarm
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/PurestWarm')
-rwxr-xr-xplugins/MacAU/PurestWarm/PurestWarm.cpp59
-rwxr-xr-xplugins/MacAU/PurestWarm/PurestWarm.h4
-rwxr-xr-xplugins/MacAU/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.pbxuser85
-rwxr-xr-xplugins/MacAU/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.perspectivev386
4 files changed, 108 insertions, 126 deletions
diff --git a/plugins/MacAU/PurestWarm/PurestWarm.cpp b/plugins/MacAU/PurestWarm/PurestWarm.cpp
index f72cf4b..0763f84 100755
--- a/plugins/MacAU/PurestWarm/PurestWarm.cpp
+++ b/plugins/MacAU/PurestWarm/PurestWarm.cpp
@@ -173,9 +173,7 @@ ComponentResult PurestWarm::Initialize()
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void PurestWarm::PurestWarmKernel::Reset()
{
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
+ fpNShape = 0.0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -190,9 +188,6 @@ void PurestWarm::PurestWarmKernel::Process( const Float32 *inSourceP,
UInt32 nSampleFrames = inFramesToProcess;
const Float32 *sourceP = inSourceP;
Float32 *destP = inDestP;
- Float32 fpTemp;
- Float64 fpOld = 0.618033988749894848204586; //golden ratio!
- Float64 fpNew = 1.0 - fpOld;
int polarity = (int) GetParameter( kParam_One );
long double inputSample;
@@ -229,55 +224,25 @@ void PurestWarm::PurestWarmKernel::Process( const Float32 *inSourceP,
if (inputSample < 0)
{
inputSample = -(sin(-inputSample*1.57079634)/1.57079634);
- //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;
- }
- //end noise shaping on 32 bit output
- } else {
- if (fpFlip) {
- fpTemp = inputSample;
- fpNShapeA = (fpNShapeA*fpOld)+((inputSample-fpTemp)*fpNew);
- } else {
- fpTemp = inputSample;
- fpNShapeB = (fpNShapeB*fpOld)+((inputSample-fpTemp)*fpNew);
- }
+ //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
}
} else {
-
if (inputSample > 0)
{
inputSample = sin(inputSample*1.57079634)/1.57079634;
- //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;
- }
- //end noise shaping on 32 bit output
- } else {
- if (fpFlip) {
- fpTemp = inputSample;
- fpNShapeA = (fpNShapeA*fpOld)+((inputSample-fpTemp)*fpNew);
- } else {
- fpTemp = inputSample;
- fpNShapeB = (fpNShapeB*fpOld)+((inputSample-fpTemp)*fpNew);
- }
+ //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
}
}
//that's it. Only applies on one half of the waveform, other half is passthrough untouched.
- //even the floating point noise shaping to the 32 bit buss is only applied as needed.
- fpFlip = not fpFlip;
+ //even the dither to the 32 bit buss is only applied as needed.
*destP = inputSample;
diff --git a/plugins/MacAU/PurestWarm/PurestWarm.h b/plugins/MacAU/PurestWarm/PurestWarm.h
index 200035d..1cf3eef 100755
--- a/plugins/MacAU/PurestWarm/PurestWarm.h
+++ b/plugins/MacAU/PurestWarm/PurestWarm.h
@@ -129,9 +129,7 @@ public:
virtual void Reset();
private:
- Float64 fpNShapeA;
- Float64 fpNShapeB;
- bool fpFlip;
+ Float64 fpNShape;
};
};
diff --git a/plugins/MacAU/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.pbxuser
index cc141a4..2b7b35c 100755
--- a/plugins/MacAU/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacAU/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.pbxuser
@@ -3,6 +3,8 @@
089C1669FE841209C02AAC07 /* Project object */ = {
activeBuildConfigurationName = Release;
activeTarget = 8D01CCC60486CAD60068D4B7 /* PurestWarm */;
+ breakpoints = (
+ );
codeSenseManager = 8BD3CCB9148830B20062E48C /* Code sense */;
perUserDictionary = {
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
@@ -49,25 +51,54 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 532477098;
- PBXWorkspaceStateSaveDate = 532477098;
+ PBXPerProjectTemplateStateSaveDate = 569586628;
+ PBXWorkspaceStateSaveDate = 569586628;
};
perUserProjectItems = {
+ 8B7926F621F336C4006E9731 /* PBXTextBookmark */ = 8B7926F621F336C4006E9731 /* PBXTextBookmark */;
+ 8B7926F721F336C4006E9731 /* XCBuildMessageTextBookmark */ = 8B7926F721F336C4006E9731 /* XCBuildMessageTextBookmark */;
+ 8B7926F821F336C4006E9731 /* PBXTextBookmark */ = 8B7926F821F336C4006E9731 /* PBXTextBookmark */;
8BB5DDAD1FBCF48A008B4570 /* PBXTextBookmark */ = 8BB5DDAD1FBCF48A008B4570 /* PBXTextBookmark */;
- 8BB5DDAE1FBCF48A008B4570 /* PBXTextBookmark */ = 8BB5DDAE1FBCF48A008B4570 /* PBXTextBookmark */;
- 8BB5DDB01FBCF48A008B4570 /* PBXTextBookmark */ = 8BB5DDB01FBCF48A008B4570 /* PBXTextBookmark */;
- 8BB5DDC21FBCF5C0008B4570 /* PBXTextBookmark */ = 8BB5DDC21FBCF5C0008B4570 /* PBXTextBookmark */;
};
sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */;
userBuildSettings = {
};
};
+ 8B7926F621F336C4006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 8BC6025B073B072D006C4272 /* PurestWarm.h */;
+ name = "PurestWarm.h: 132";
+ rLen = 0;
+ rLoc = 5200;
+ rType = 0;
+ vrLen = 227;
+ vrLoc = 2866;
+ };
+ 8B7926F721F336C4006E9731 /* XCBuildMessageTextBookmark */ = {
+ isa = PBXTextBookmark;
+ comments = "Unused variable 'fpTemp'";
+ fRef = 8BA05A660720730100365D66 /* PurestWarm.cpp */;
+ fallbackIsa = XCBuildMessageTextBookmark;
+ rLen = 1;
+ rLoc = 190;
+ rType = 1;
+ };
+ 8B7926F821F336C4006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 8BA05A660720730100365D66 /* PurestWarm.cpp */;
+ name = "PurestWarm.cpp: 191";
+ rLen = 0;
+ rLoc = 8370;
+ rType = 0;
+ vrLen = 216;
+ vrLoc = 8263;
+ };
8BA05A660720730100365D66 /* PurestWarm.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {885, 3887}}";
- sepNavSelRange = "{10000, 1649}";
- sepNavVisRange = "{10272, 1465}";
- sepNavWindowFrame = "{{534, 57}, {932, 815}}";
+ sepNavIntBoundsRect = "{{0, 0}, {691, 3263}}";
+ sepNavSelRange = "{8370, 0}";
+ sepNavVisRange = "{8263, 216}";
+ sepNavWindowFrame = "{{316, 63}, {932, 815}}";
};
};
8BA05A670720730100365D66 /* PurestWarm.exp */ = {
@@ -95,41 +126,11 @@
vrLen = 429;
vrLoc = 2236;
};
- 8BB5DDAE1FBCF48A008B4570 /* PBXTextBookmark */ = {
- isa = PBXTextBookmark;
- fRef = 8BA05A660720730100365D66 /* PurestWarm.cpp */;
- name = "PurestWarm.cpp: 226";
- rLen = 0;
- rLoc = 9997;
- rType = 0;
- vrLen = 229;
- vrLoc = 10272;
- };
- 8BB5DDB01FBCF48A008B4570 /* PBXTextBookmark */ = {
- isa = PBXTextBookmark;
- fRef = 8BC6025B073B072D006C4272 /* PurestWarm.h */;
- name = "PurestWarm.h: 134";
- rLen = 0;
- rLoc = 5237;
- rType = 0;
- vrLen = 286;
- vrLoc = 2808;
- };
- 8BB5DDC21FBCF5C0008B4570 /* PBXTextBookmark */ = {
- isa = PBXTextBookmark;
- fRef = 8BC6025B073B072D006C4272 /* PurestWarm.h */;
- name = "PurestWarm.h: 134";
- rLen = 0;
- rLoc = 5237;
- rType = 0;
- vrLen = 285;
- vrLoc = 2808;
- };
8BC6025B073B072D006C4272 /* PurestWarm.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {761, 2119}}";
- sepNavSelRange = "{5237, 0}";
- sepNavVisRange = "{2808, 285}";
+ sepNavIntBoundsRect = "{{0, 0}, {628, 2080}}";
+ sepNavSelRange = "{5200, 0}";
+ sepNavVisRange = "{2866, 227}";
sepNavWindowFrame = "{{15, 58}, {932, 815}}";
};
};
diff --git a/plugins/MacAU/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.perspectivev3
index cfd223b..83128df 100755
--- a/plugins/MacAU/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacAU/PurestWarm/PurestWarm.xcodeproj/christopherjohnson.perspectivev3
@@ -256,8 +256,6 @@
<key>Layout</key>
<array>
<dict>
- <key>BecomeActive</key>
- <true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBottomSmartGroupGIDs</key>
@@ -300,7 +298,7 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
- <integer>4</integer>
+ <integer>3</integer>
<integer>2</integer>
<integer>1</integer>
<integer>0</integer>
@@ -324,7 +322,7 @@
<real>185</real>
</array>
<key>RubberWindowFrame</key>
- <string>616 391 810 487 0 0 1440 878 </string>
+ <string>361 361 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -340,7 +338,7 @@
<key>PBXProjectModuleGUID</key>
<string>8BB5DD7C1FBCE73D008B4570</string>
<key>PBXProjectModuleLabel</key>
- <string>PurestWarm.h</string>
+ <string>PurestWarm.cpp</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@@ -348,16 +346,16 @@
<key>PBXProjectModuleGUID</key>
<string>8BB5DD7D1FBCE73D008B4570</string>
<key>PBXProjectModuleLabel</key>
- <string>PurestWarm.h</string>
+ <string>PurestWarm.cpp</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8BB5DDC21FBCF5C0008B4570</string>
+ <string>8B7926F821F336C4006E9731</string>
<key>history</key>
<array>
<string>8BB5DDAD1FBCF48A008B4570</string>
- <string>8BB5DDAE1FBCF48A008B4570</string>
- <string>8BB5DDB01FBCF48A008B4570</string>
+ <string>8B7926F621F336C4006E9731</string>
+ <string>8B7926F721F336C4006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -371,18 +369,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {603, 117}}</string>
+ <string>{{0, 0}, {603, 102}}</string>
<key>RubberWindowFrame</key>
- <string>616 391 810 487 0 0 1440 878 </string>
+ <string>361 361 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>117pt</string>
+ <string>102pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>324pt</string>
+ <string>339pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -396,9 +394,7 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 297}}</string>
- <key>RubberWindowFrame</key>
- <string>616 391 810 487 0 0 1440 878 </string>
+ <string>{{10, 27}, {603, 312}}</string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -452,7 +448,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 31}, {603, 297}}</string>
+ <string>{{10, 27}, {603, 312}}</string>
+ <key>RubberWindowFrame</key>
+ <string>361 361 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -480,11 +478,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8BB5DDBD1FBCF4AB008B4570</string>
+ <string>8B7926F921F336C4006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8BB5DDBE1FBCF4AB008B4570</string>
+ <string>8B7926FA21F336C4006E9731</string>
<string>8BB5DD7C1FBCE73D008B4570</string>
- <string>8BB5DDBF1FBCF4AB008B4570</string>
+ <string>8B7926FB21F336C4006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -521,7 +519,7 @@
<key>Identifier</key>
<string>perspective.debug</string>
<key>IsVertical</key>
- <integer>1</integer>
+ <true/>
<key>Layout</key>
<array>
<dict>
@@ -535,12 +533,12 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {810, 0}}</string>
+ <string>{{0, 0}, {424, 270}}</string>
</dict>
<key>Module</key>
<string>PBXDebugCLIModule</string>
<key>Proportion</key>
- <string>0%</string>
+ <string>270pt</string>
</dict>
<dict>
<key>ContentConfiguration</key>
@@ -589,8 +587,6 @@
</dict>
<key>GeometryConfiguration</key>
<dict>
- <key>DebugConsoleDrawerSize</key>
- <string>{100, 120}</string>
<key>DebugConsoleVisible</key>
<string>None</string>
<key>DebugConsoleWindowFrame</key>
@@ -599,11 +595,25 @@
<string>{{200, 200}, {500, 300}}</string>
<key>Frame</key>
<string>{{0, 7}, {810, 438}}</string>
+ <key>PBXDebugSessionStackFrameViewKey</key>
+ <dict>
+ <key>DebugVariablesTableConfiguration</key>
+ <array>
+ <string>Name</string>
+ <real>120</real>
+ <string>Value</string>
+ <real>85</real>
+ <string>Summary</string>
+ <real>185</real>
+ </array>
+ <key>Frame</key>
+ <string>{{395, 0}, {415, 213}}</string>
+ </dict>
</dict>
<key>Module</key>
<string>PBXDebugSessionModule</string>
<key>Proportion</key>
- <string>443pt</string>
+ <string>438pt</string>
</dict>
</array>
<key>Name</key>
@@ -611,19 +621,27 @@
<key>ServiceClasses</key>
<array>
<string>XCModuleDock</string>
- <string>XCModuleDock</string>
<string>PBXDebugCLIModule</string>
<string>PBXDebugSessionModule</string>
- <string>XCConsole</string>
+ <string>PBXDebugProcessAndThreadModule</string>
+ <string>PBXDebugProcessViewModule</string>
+ <string>PBXDebugThreadViewModule</string>
+ <string>PBXDebugStackFrameViewModule</string>
+ <string>PBXNavigatorGroup</string>
</array>
<key>TableOfContents</key>
<array>
- <string>1CC8E6A5069209BD00BB180A</string>
- <string>1CC8E6A6069209BD00BB180A</string>
+ <string>8B7926FC21F336C4006E9731</string>
<string>1CCC7628064C1048000F2A68</string>
<string>1CCC7629064C1048000F2A68</string>
- <string>1CC8E6A7069209BD00BB180A</string>
+ <string>8B7926FD21F336C4006E9731</string>
+ <string>8B7926FE21F336C4006E9731</string>
+ <string>8B7926FF21F336C4006E9731</string>
+ <string>8B79270021F336C4006E9731</string>
+ <string>8B79270121F336C4006E9731</string>
</array>
+ <key>ToolbarConfigUserDefaultsMinorVersion</key>
+ <string>2</string>
<key>ToolbarConfiguration</key>
<string>xcode.toolbar.config.debugV3</string>
</dict>
@@ -637,7 +655,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>532477376.88819098</real>
+ <real>569587396.45455897</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -654,11 +672,11 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8BB5DDC31FBCF5C0008B4570</string>
+ <string>8B79270221F336C4006E9731</string>
<string>/Users/christopherjohnson/Desktop/MacAU/PurestWarm/PurestWarm.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>616 391 810 487 0 0 1440 878 </string>
+ <string>361 361 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>