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/Loud | |
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/Loud')
-rwxr-xr-x | plugins/MacAU/Loud/Loud.cpp | 25 | ||||
-rwxr-xr-x | plugins/MacAU/Loud/Loud.h | 4 | ||||
-rwxr-xr-x | plugins/MacAU/Loud/Loud.xcodeproj/christopherjohnson.pbxuser | 44 | ||||
-rwxr-xr-x | plugins/MacAU/Loud/Loud.xcodeproj/christopherjohnson.perspectivev3 | 29 |
4 files changed, 42 insertions, 60 deletions
diff --git a/plugins/MacAU/Loud/Loud.cpp b/plugins/MacAU/Loud/Loud.cpp index 3d954d6..8be40d2 100755 --- a/plugins/MacAU/Loud/Loud.cpp +++ b/plugins/MacAU/Loud/Loud.cpp @@ -175,9 +175,7 @@ ComponentResult Loud::Initialize() void Loud::LoudKernel::Reset() { lastSample = 0.0; - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -196,9 +194,6 @@ void Loud::LoudKernel::Process( const Float32 *inSourceP, overallscale /= 44100.0; overallscale *= GetSampleRate(); Float64 boost = pow(GetParameter( kParam_One )+1.0,5); - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - Float32 fpTemp; Float64 output = GetParameter( kParam_Two ); Float64 wet = GetParameter( kParam_Three ); @@ -267,19 +262,11 @@ void Loud::LoudKernel::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. - - 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/Loud/Loud.h b/plugins/MacAU/Loud/Loud.h index 4f15994..289716f 100755 --- a/plugins/MacAU/Loud/Loud.h +++ b/plugins/MacAU/Loud/Loud.h @@ -134,9 +134,7 @@ public: private: Float64 lastSample; - Float64 fpNShapeA; - Float64 fpNShapeB; - bool fpFlip; + Float64 fpNShape; }; }; diff --git a/plugins/MacAU/Loud/Loud.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/Loud/Loud.xcodeproj/christopherjohnson.pbxuser index 987043f..77ce748 100755 --- a/plugins/MacAU/Loud/Loud.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/Loud/Loud.xcodeproj/christopherjohnson.pbxuser @@ -49,37 +49,37 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 547640834; - PBXWorkspaceStateSaveDate = 547640834; + PBXPerProjectTemplateStateSaveDate = 569650197; + PBXWorkspaceStateSaveDate = 569650197; }; perUserProjectItems = { - 8B904D5820A4584C008CBAD8 /* PBXTextBookmark */ = 8B904D5820A4584C008CBAD8 /* PBXTextBookmark */; - 8B904D5920A4584C008CBAD8 /* PBXTextBookmark */ = 8B904D5920A4584C008CBAD8 /* PBXTextBookmark */; + 8B792DD221F42C71006E9731 /* PBXTextBookmark */ = 8B792DD221F42C71006E9731 /* PBXTextBookmark */; + 8B792DD721F42C90006E9731 /* PBXTextBookmark */ = 8B792DD721F42C90006E9731 /* PBXTextBookmark */; 8B9F0C141EB4035300D3B900 /* PBXTextBookmark */ = 8B9F0C141EB4035300D3B900 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B904D5820A4584C008CBAD8 /* PBXTextBookmark */ = { + 8B792DD221F42C71006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* Loud.cpp */; - name = "Loud.cpp: 237"; + name = "Loud.cpp: 232"; rLen = 983; - rLoc = 10671; + rLoc = 10520; rType = 0; - vrLen = 140; - vrLoc = 9658; + vrLen = 0; + vrLoc = 0; }; - 8B904D5920A4584C008CBAD8 /* PBXTextBookmark */ = { + 8B792DD721F42C90006E9731 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 8BA05A660720730100365D66 /* Loud.cpp */; - name = "Loud.cpp: 237"; + name = "Loud.cpp: 232"; rLen = 983; - rLoc = 10671; + rLoc = 10520; rType = 0; - vrLen = 140; - vrLoc = 9658; + vrLen = 0; + vrLoc = 0; }; 8B9F0C141EB4035300D3B900 /* PBXTextBookmark */ = { isa = PBXTextBookmark; @@ -93,10 +93,10 @@ }; 8BA05A660720730100365D66 /* Loud.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {691, 3809}}"; - sepNavSelRange = "{10671, 983}"; - sepNavVisRange = "{9658, 140}"; - sepNavWindowFrame = "{{477, 66}, {1145, 812}}"; + sepNavIntBoundsRect = "{{0, 0}, {554, 3718}}"; + sepNavSelRange = "{10520, 983}"; + sepNavVisRange = "{0, 0}"; + sepNavWindowFrame = "{{92, 66}, {1145, 812}}"; }; }; 8BA05A670720730100365D66 /* Loud.exp */ = { @@ -117,10 +117,10 @@ }; 8BC6025B073B072D006C4272 /* Loud.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1006, 1898}}"; - sepNavSelRange = "{2999, 121}"; - sepNavVisRange = "{3795, 1551}"; - sepNavWindowFrame = "{{89, -6}, {1053, 839}}"; + sepNavIntBoundsRect = "{{0, 0}, {1006, 1846}}"; + sepNavSelRange = "{5199, 0}"; + sepNavVisRange = "{3721, 1588}"; + sepNavWindowFrame = "{{89, 39}, {1053, 839}}"; }; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { diff --git a/plugins/MacAU/Loud/Loud.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/Loud/Loud.xcodeproj/christopherjohnson.perspectivev3 index 2b8deb6..fc5744d 100755 --- a/plugins/MacAU/Loud/Loud.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/Loud/Loud.xcodeproj/christopherjohnson.perspectivev3 @@ -256,8 +256,6 @@ <key>Layout</key> <array> <dict> - <key>BecomeActive</key> - <true/> <key>ContentConfiguration</key> <dict> <key>PBXBottomSmartGroupGIDs</key> @@ -352,11 +350,11 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>8B904D5920A4584C008CBAD8</string> + <string>8B792DD721F42C90006E9731</string> <key>history</key> <array> <string>8B9F0C141EB4035300D3B900</string> - <string>8B904D5820A4584C008CBAD8</string> + <string>8B792DD221F42C71006E9731</string> </array> </dict> <key>SplitCount</key> @@ -370,18 +368,18 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {603, 51}}</string> + <string>{{0, 0}, {603, 32}}</string> <key>RubberWindowFrame</key> <string>337 373 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>51pt</string> + <string>32pt</string> </dict> <dict> <key>Proportion</key> - <string>390pt</string> + <string>409pt</string> <key>Tabs</key> <array> <dict> @@ -395,9 +393,7 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 363}}</string> - <key>RubberWindowFrame</key> - <string>337 373 810 487 0 0 1440 878 </string> + <string>{{10, 27}, {603, 382}}</string> </dict> <key>Module</key> <string>XCDetailModule</string> @@ -451,7 +447,9 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{10, 27}, {603, 414}}</string> + <string>{{10, 27}, {603, 382}}</string> + <key>RubberWindowFrame</key> + <string>337 373 810 487 0 0 1440 878 </string> </dict> <key>Module</key> <string>PBXBuildResultsModule</string> @@ -479,11 +477,11 @@ </array> <key>TableOfContents</key> <array> - <string>8B904D5A20A4584C008CBAD8</string> + <string>8B792DD821F42C90006E9731</string> <string>1CA23ED40692098700951B8B</string> - <string>8B904D5B20A4584C008CBAD8</string> + <string>8B792DD921F42C90006E9731</string> <string>8BDB26991EAA805E001F42B2</string> - <string>8B904D5C20A4584C008CBAD8</string> + <string>8B792DDA21F42C90006E9731</string> <string>1CA23EDF0692099D00951B8B</string> <string>1CA23EE00692099D00951B8B</string> <string>1CA23EE10692099D00951B8B</string> @@ -636,7 +634,7 @@ <key>StatusbarIsVisible</key> <true/> <key>TimeStamp</key> - <real>547641420.42251396</real> + <real>569650320.319924</real> <key>ToolbarConfigUserDefaultsMinorVersion</key> <string>2</string> <key>ToolbarDisplayMode</key> @@ -653,7 +651,6 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>8B904D5D20A4584C008CBAD8</string> <string>/Users/christopherjohnson/Desktop/MacAU/Loud/Loud.xcodeproj</string> </array> <key>WindowString</key> |