diff options
author | Chris Johnson <jinx6568@sover.net> | 2019-01-27 21:13:54 -0500 |
---|---|---|
committer | Chris Johnson <jinx6568@sover.net> | 2019-01-27 21:13:54 -0500 |
commit | 966f2d253cd2ee6ce140ad68095a20a9d2b63052 (patch) | |
tree | b0400d95bd06512531ade6ddf55190a58b6a5623 /plugins/MacAU/HighImpact | |
parent | 0887543349dbbec0721a1fc8b1c7deba9afefa8b (diff) | |
download | airwindows-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/HighImpact')
4 files changed, 44 insertions, 63 deletions
diff --git a/plugins/MacAU/HighImpact/HighImpact.cpp b/plugins/MacAU/HighImpact/HighImpact.cpp index 91cbd6a..43ca1f5 100755 --- a/plugins/MacAU/HighImpact/HighImpact.cpp +++ b/plugins/MacAU/HighImpact/HighImpact.cpp @@ -175,9 +175,7 @@ ComponentResult HighImpact::Initialize() void HighImpact::HighImpactKernel::Reset() { lastSample = 0.0; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -201,11 +199,7 @@ void HighImpact::HighImpactKernel::Process( const Float32 *inSourceP, Float64 drySample; Float64 output = GetParameter( kParam_Two ); Float64 wet = GetParameter( kParam_Three ); - Float64 dry = 1.0-wet; - Float32 fpTemp; - Float64 fpOld = 0.618033988749894848204586; //golden ratio! - Float64 fpNew = 1.0 - fpOld; - + Float64 dry = 1.0-wet; Float64 clamp; Float64 threshold = (1.25 - out); @@ -279,19 +273,11 @@ void HighImpact::HighImpactKernel::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; sourceP += inNumChannels; diff --git a/plugins/MacAU/HighImpact/HighImpact.h b/plugins/MacAU/HighImpact/HighImpact.h index 1778590..4315822 100755 --- a/plugins/MacAU/HighImpact/HighImpact.h +++ b/plugins/MacAU/HighImpact/HighImpact.h @@ -134,9 +134,7 @@ public: private: Float64 lastSample; - Float64 fpNShapeA; - Float64 fpNShapeB; - bool fpFlip; + Float64 fpNShape; }; }; diff --git a/plugins/MacAU/HighImpact/HighImpact.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/HighImpact/HighImpact.xcodeproj/christopherjohnson.pbxuser index 95f75f7..a4ea24e 100755 --- a/plugins/MacAU/HighImpact/HighImpact.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/HighImpact/HighImpact.xcodeproj/christopherjohnson.pbxuser @@ -49,12 +49,12 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 528456515; - PBXWorkspaceStateSaveDate = 528456515; + PBXPerProjectTemplateStateSaveDate = 569649013; + PBXWorkspaceStateSaveDate = 569649013; }; perUserProjectItems = { - 8B9D65211F7C8934007AB60F /* PBXTextBookmark */ = 8B9D65211F7C8934007AB60F /* PBXTextBookmark */; - 8B9D74781F7F9B7D007AB60F /* PBXTextBookmark */ = 8B9D74781F7F9B7D007AB60F /* PBXTextBookmark */; + 8B792D4B21F427D4006E9731 /* PBXTextBookmark */ = 8B792D4B21F427D4006E9731 /* PBXTextBookmark */; + 8B792D5021F427E4006E9731 /* PBXTextBookmark */ = 8B792D5021F427E4006E9731 /* PBXTextBookmark */; 8BD4F5C21E6E137800288155 /* PBXTextBookmark */ = 8BD4F5C21E6E137800288155 /* PBXTextBookmark */; 8BD4F5C31E6E137800288155 /* PBXTextBookmark */ = 8BD4F5C31E6E137800288155 /* PBXTextBookmark */; }; @@ -62,32 +62,32 @@ userBuildSettings = { }; }; - 8B9D65211F7C8934007AB60F /* PBXTextBookmark */ = { + 8B792D4B21F427D4006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* HighImpact.cpp */; - name = "HighImpact.cpp: 201"; + name = "HighImpact.cpp: 199"; rLen = 0; - rLoc = 9245; + rLoc = 9210; rType = 0; - vrLen = 504; - vrLoc = 7848; + vrLen = 584; + vrLoc = 7867; }; - 8B9D74781F7F9B7D007AB60F /* PBXTextBookmark */ = { + 8B792D5021F427E4006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* HighImpact.cpp */; - name = "HighImpact.cpp: 201"; + name = "HighImpact.cpp: 199"; rLen = 0; - rLoc = 9245; + rLoc = 9210; rType = 0; - vrLen = 485; + vrLen = 584; vrLoc = 7867; }; 8BA05A660720730100365D66 /* HighImpact.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {670, 3978}}"; - sepNavSelRange = "{9245, 0}"; - sepNavVisRange = "{7867, 485}"; - sepNavWindowFrame = "{{283, 58}, {1145, 812}}"; + sepNavIntBoundsRect = "{{0, 0}, {670, 3887}}"; + sepNavSelRange = "{9210, 0}"; + sepNavVisRange = "{7867, 584}"; + sepNavWindowFrame = "{{178, 66}, {1145, 812}}"; }; }; 8BA05A670720730100365D66 /* HighImpact.exp */ = { @@ -107,9 +107,9 @@ }; 8BC6025B073B072D006C4272 /* HighImpact.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {824, 1898}}"; - sepNavSelRange = "{5304, 0}"; - sepNavVisRange = "{2715, 570}"; + sepNavIntBoundsRect = "{{0, 0}, {876, 1859}}"; + sepNavSelRange = "{5347, 0}"; + sepNavVisRange = "{3845, 1610}"; sepNavWindowFrame = "{{15, 39}, {923, 837}}"; }; }; diff --git a/plugins/MacAU/HighImpact/HighImpact.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/HighImpact/HighImpact.xcodeproj/christopherjohnson.perspectivev3 index 8773219..a53e030 100755 --- a/plugins/MacAU/HighImpact/HighImpact.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/HighImpact/HighImpact.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>589 316 810 487 0 0 1440 878 </string> + <string>493 322 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -352,12 +350,12 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B9D74781F7F9B7D007AB60F</string> + <string>8B792D5021F427E4006E9731</string> <key>history</key> <array> <string>8BD4F5C21E6E137800288155</string> <string>8BD4F5C31E6E137800288155</string> - <string>8B9D65211F7C8934007AB60F</string> + <string>8B792D4B21F427D4006E9731</string> </array> </dict> <key>SplitCount</key> @@ -371,18 +369,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 253}}</string> + <string>{{0, 0}, {603, 244}}</string> <key>RubberWindowFrame</key> - <string>589 316 810 487 0 0 1440 878 </string> + <string>493 322 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>253pt</string> + <string>244pt</string> </dict> <dict> <key>Proportion</key> - <string>188pt</string> + <string>197pt</string> <key>Tabs</key> <array> <dict> @@ -396,9 +394,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 161}}</string> - <key>RubberWindowFrame</key> - <string>589 316 810 487 0 0 1440 878 </string> + <string>{{10, 27}, {603, 170}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -452,7 +448,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 414}}</string> + <string>{{10, 27}, {603, 170}}</string> + <key>RubberWindowFrame</key> + <string>493 322 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -480,11 +478,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B9D74791F7F9B7D007AB60F</string> + <string>8B792D5121F427E4006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B9D747A1F7F9B7D007AB60F</string> + <string>8B792D5221F427E4006E9731</string> <string>8B753F071E4027BF00347157</string> - <string>8B9D747B1F7F9B7D007AB60F</string> + <string>8B792D5321F427E4006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -637,7 +635,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>528456573.47978503</real> + <real>569649124.25200295</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -654,11 +652,10 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B9D747C1F7F9B7D007AB60F</string> <string>/Users/christopherjohnson/Desktop/MacAU/HighImpact/HighImpact.xcodeproj</string> </array> <key>WindowString</key> - <string>589 316 810 487 0 0 1440 878 </string> + <string>493 322 810 487 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |