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/Noise | |
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/Noise')
-rwxr-xr-x | plugins/MacAU/Noise/Noise.cpp | 30 | ||||
-rwxr-xr-x | plugins/MacAU/Noise/Noise.h | 4 | ||||
-rwxr-xr-x | plugins/MacAU/Noise/Noise.xcodeproj/christopherjohnson.pbxuser | 20 | ||||
-rwxr-xr-x | plugins/MacAU/Noise/Noise.xcodeproj/christopherjohnson.perspectivev3 | 26 |
4 files changed, 31 insertions, 49 deletions
diff --git a/plugins/MacAU/Noise/Noise.cpp b/plugins/MacAU/Noise/Noise.cpp index b528b4b..15ca903 100755 --- a/plugins/MacAU/Noise/Noise.cpp +++ b/plugins/MacAU/Noise/Noise.cpp @@ -209,9 +209,7 @@ void Noise::NoiseKernel::Reset() flip = false; filterflip = false; for(int count = 0; count < 11; count++) {b[count] = 0.0; f[count] = 0.0;} - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -311,10 +309,6 @@ void Noise::NoiseKernel::Process( const Float32 *inSourceP, f[9] /= overallscale; //and now it's neatly scaled, too - Float32 fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - while (nSampleFrames-- > 0) { inputSample = *sourceP; if (inputSample<1.2e-38 && -inputSample<1.2e-38) { @@ -359,8 +353,8 @@ void Noise::NoiseKernel::Process( const Float32 *inSourceP, invcutoff = 1.0 - cutoff; //set up modified cutoff - flip = not flip; - filterflip = not filterflip; + flip = !flip; + filterflip = !filterflip; quadratic -= 1; if (quadratic < 0) { @@ -428,19 +422,11 @@ void Noise::NoiseKernel::Process( const Float32 *inSourceP, inputSample -= correctionSample; //applying the distance calculation to both the dry AND the noise output to blend them - //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/Noise/Noise.h b/plugins/MacAU/Noise/Noise.h index 7d0a6d7..452a603 100755 --- a/plugins/MacAU/Noise/Noise.h +++ b/plugins/MacAU/Noise/Noise.h @@ -152,9 +152,7 @@ public: bool filterflip; Float64 b[11]; Float64 f[11]; - Float64 fpNShapeA; - Float64 fpNShapeB; - bool fpFlip; + long double fpNShape; }; }; diff --git a/plugins/MacAU/Noise/Noise.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Noise/Noise.xcodeproj/christopherjohnson.pbxuser index 5aa8db5..fd77959 100755 --- a/plugins/MacAU/Noise/Noise.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/Noise/Noise.xcodeproj/christopherjohnson.pbxuser @@ -49,8 +49,8 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 538271590; - PBXWorkspaceStateSaveDate = 538271590; + PBXPerProjectTemplateStateSaveDate = 569651243; + PBXWorkspaceStateSaveDate = 569651243; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { @@ -58,10 +58,10 @@ }; 8BA05A660720730100365D66 /* Noise.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {934, 6162}}"; - sepNavSelRange = "{17598, 1}"; - sepNavVisRange = "{16371, 1511}"; - sepNavWindowFrame = "{{449, 62}, {981, 816}}"; + sepNavIntBoundsRect = "{{0, 0}, {934, 5928}}"; + sepNavSelRange = "{13301, 0}"; + sepNavVisRange = "{10580, 1962}"; + sepNavWindowFrame = "{{302, 62}, {981, 816}}"; }; }; 8BA05A680720730100365D66 /* Noise.r */ = { @@ -82,10 +82,10 @@ }; 8BC6025B073B072D006C4272 /* Noise.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {934, 1911}}"; - sepNavSelRange = "{3042, 0}"; - sepNavVisRange = "{1672, 2009}"; - sepNavWindowFrame = "{{763, 62}, {981, 816}}"; + sepNavIntBoundsRect = "{{0, 0}, {934, 2223}}"; + sepNavSelRange = "{5824, 0}"; + sepNavVisRange = "{4614, 1330}"; + sepNavWindowFrame = "{{459, 62}, {981, 816}}"; }; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { diff --git a/plugins/MacAU/Noise/Noise.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Noise/Noise.xcodeproj/christopherjohnson.perspectivev3 index bc7c41e..3d7c6a5 100755 --- a/plugins/MacAU/Noise/Noise.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/Noise/Noise.xcodeproj/christopherjohnson.perspectivev3 @@ -225,8 +225,8 @@ <array/> <key>PerspectiveWidths</key> <array> - <integer>-1</integer> - <integer>-1</integer> + <integer>810</integer> + <integer>810</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> @@ -324,7 +322,7 @@ <real>185</real> </array> <key>RubberWindowFrame</key> - <string>614 382 810 487 0 0 1440 878 </string> + <string>455 339 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -363,7 +361,7 @@ <key>Frame</key> <string>{{0, 0}, {603, 0}}</string> <key>RubberWindowFrame</key> - <string>614 382 810 487 0 0 1440 878 </string> + <string>455 339 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> @@ -387,8 +385,6 @@ <dict> <key>Frame</key> <string>{{10, 27}, {603, 414}}</string> - <key>RubberWindowFrame</key> - <string>614 382 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -442,7 +438,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 31}, {603, 297}}</string> + <string>{{10, 27}, {603, 414}}</string> + <key>RubberWindowFrame</key> + <string>455 339 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -470,11 +468,11 @@ </array> <key>TableOfContents</key> <array> - <string>8BA11D6C20155F6900D31247</string> + <string>8B792E4721F430DD006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8BA11D6D20155F6900D31247</string> + <string>8B792E4821F430DD006E9731</string> <string>8B6FC0582010B87E003CA5F7</string> - <string>8BA11D6E20155F6900D31247</string> + <string>8B792E4921F430DD006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -627,7 +625,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>538274889.58884597</real> + <real>569651421.60977602</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -647,7 +645,7 @@ <string>/Users/christopherjohnson/Desktop/MacAU/Noise/Noise.xcodeproj</string> </array> <key>WindowString</key> - <string>614 382 810 487 0 0 1440 878 </string> + <string>455 339 810 487 0 0 1440 878 </string> <key>WindowToolsV3</key> <array> <dict> |