From 966f2d253cd2ee6ce140ad68095a20a9d2b63052 Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Sun, 27 Jan 2019 21:13:54 -0500 Subject: Floating Point Dither For All --- .../PurestConsoleChannel/PurestConsoleChannel.cpp | 28 +++-------- .../PurestConsoleChannel/PurestConsoleChannel.h | 4 +- .../christopherjohnson.mode1v3 | 0 .../christopherjohnson.pbxuser | 57 +++++++++++++--------- .../christopherjohnson.perspectivev3 | 42 ++++++++-------- .../PurestConsoleChannel.xcodeproj/project.pbxproj | 0 6 files changed, 61 insertions(+), 70 deletions(-) mode change 100644 => 100755 plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.cpp mode change 100644 => 100755 plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.h mode change 100644 => 100755 plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj/christopherjohnson.mode1v3 mode change 100644 => 100755 plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj/christopherjohnson.pbxuser mode change 100644 => 100755 plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj/christopherjohnson.perspectivev3 mode change 100644 => 100755 plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj/project.pbxproj (limited to 'plugins/MacAU/PurestConsoleChannel') diff --git a/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.cpp b/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.cpp old mode 100644 new mode 100755 index 7f47b65..b418640 --- a/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.cpp +++ b/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.cpp @@ -150,9 +150,7 @@ ComponentResult PurestConsoleChannel::Initialize() //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void PurestConsoleChannel::PurestConsoleChannelKernel::Reset() { - fpNShapeA = 0.0; - fpNShapeB = 0.0; - fpFlip = true; + fpNShape = 0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -168,10 +166,6 @@ void PurestConsoleChannel::PurestConsoleChannelKernel::Process( const Float32 const Float32 *sourceP = inSourceP; Float32 *destP = inDestP; - Float32 fpTemp; - long double fpOld = 0.618033988749894848204586; //golden ratio! - long double fpNew = 1.0 - fpOld; - long double inputSample; while (nSampleFrames-- > 0) { @@ -203,20 +197,12 @@ void PurestConsoleChannel::PurestConsoleChannelKernel::Process( const Float32 inputSample = sin(inputSample); //amplitude aspect - - //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/PurestConsoleChannel/PurestConsoleChannel.h b/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.h old mode 100644 new mode 100755 index 5cf13da..0beecd1 --- a/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.h +++ b/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.h @@ -119,9 +119,7 @@ public: virtual void Reset(); private: - long double fpNShapeA; - long double fpNShapeB; - bool fpFlip; + long double fpNShape; }; }; diff --git a/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj/christopherjohnson.mode1v3 b/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj/christopherjohnson.mode1v3 old mode 100644 new mode 100755 diff --git a/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj/christopherjohnson.pbxuser b/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj/christopherjohnson.pbxuser old mode 100644 new mode 100755 index dcf6a55..44838c0 --- a/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj/christopherjohnson.pbxuser +++ b/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj/christopherjohnson.pbxuser @@ -49,18 +49,19 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 538686827; - PBXWorkspaceStateSaveDate = 538686827; + PBXPerProjectTemplateStateSaveDate = 569585667; + PBXWorkspaceStateSaveDate = 569585667; }; perUserProjectItems = { - 8B4E54B5201BB4AE00B5DC2A /* PlistBookmark */ = 8B4E54B5201BB4AE00B5DC2A /* PlistBookmark */; - 8B4E54C3201BB57400B5DC2A /* PlistBookmark */ = 8B4E54C3201BB57400B5DC2A /* PlistBookmark */; + 8B34922E2054553C00C0EF7D /* PlistBookmark */ = 8B34922E2054553C00C0EF7D /* PlistBookmark */; + 8B79267521F33079006E9731 /* PBXTextBookmark */ = 8B79267521F33079006E9731 /* PBXTextBookmark */; + 8B79267A21F3308F006E9731 /* PBXTextBookmark */ = 8B79267A21F3308F006E9731 /* PBXTextBookmark */; }; sourceControlManager = 8BD3CCB8148830B20062E48C /* Source Control */; userBuildSettings = { }; }; - 8B4E54B5201BB4AE00B5DC2A /* PlistBookmark */ = { + 8B34922E2054553C00C0EF7D /* PlistBookmark */ = { isa = PlistBookmark; fRef = 8D01CCD10486CAD60068D4B7 /* Info.plist */; fallbackIsa = PBXBookmark; @@ -68,28 +69,36 @@ kPath = ( CFBundleName, ); - name = /Users/christopherjohnson/Desktop/github/plugins/MacAU/PurestConsoleChannel/Info.plist; + name = /Users/christopherjohnson/Desktop/MacAU/PurestConsoleChannel/Info.plist; rLen = 0; rLoc = 9223372036854775808; }; - 8B4E54C3201BB57400B5DC2A /* PlistBookmark */ = { - isa = PlistBookmark; - fRef = 8D01CCD10486CAD60068D4B7 /* Info.plist */; - fallbackIsa = PBXBookmark; - isK = 0; - kPath = ( - CFBundleName, - ); - name = /Users/christopherjohnson/Desktop/github/plugins/MacAU/PurestConsoleChannel/Info.plist; + 8B79267521F33079006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* PurestConsoleChannel.cpp */; + name = "PurestConsoleChannel.cpp: 206"; + rLen = 0; + rLoc = 9532; + rType = 0; + vrLen = 213; + vrLoc = 9160; + }; + 8B79267A21F3308F006E9731 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 8BA05A660720730100365D66 /* PurestConsoleChannel.cpp */; + name = "PurestConsoleChannel.cpp: 206"; rLen = 0; - rLoc = 9223372036854775807; + rLoc = 9532; + rType = 0; + vrLen = 213; + vrLoc = 9160; }; 8BA05A660720730100365D66 /* PurestConsoleChannel.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {848, 3094}}"; - sepNavSelRange = "{9377, 56}"; - sepNavVisRange = "{7017, 2416}"; - sepNavWindowFrame = "{{545, 39}, {895, 839}}"; + sepNavIntBoundsRect = "{{0, 0}, {677, 2873}}"; + sepNavSelRange = "{9532, 0}"; + sepNavVisRange = "{9160, 213}"; + sepNavWindowFrame = "{{352, 39}, {895, 839}}"; }; }; 8BA05A690720730100365D66 /* PurestConsoleChannelVersion.h */ = { @@ -102,10 +111,10 @@ }; 8BC6025B073B072D006C4272 /* PurestConsoleChannel.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {894, 1703}}"; - sepNavSelRange = "{2920, 0}"; - sepNavVisRange = "{1797, 2033}"; - sepNavWindowFrame = "{{705, 39}, {895, 839}}"; + sepNavIntBoundsRect = "{{0, 0}, {894, 1677}}"; + sepNavSelRange = "{5033, 0}"; + sepNavVisRange = "{3380, 1763}"; + sepNavWindowFrame = "{{307, 39}, {895, 839}}"; }; }; 8BD3CCB8148830B20062E48C /* Source Control */ = { diff --git a/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj/christopherjohnson.perspectivev3 old mode 100644 new mode 100755 index f3c675f..18c4f2b --- a/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj/christopherjohnson.perspectivev3 +++ b/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj/christopherjohnson.perspectivev3 @@ -256,8 +256,6 @@ Layout - BecomeActive - ContentConfiguration PBXBottomSmartGroupGIDs @@ -325,7 +323,7 @@ 288 RubberWindowFrame - 584 203 841 654 0 0 1440 878 + 388 183 841 654 0 0 1440 878 Module PBXSmartGroupTreeModule @@ -341,7 +339,7 @@ PBXProjectModuleGUID 8BD7274A1D46E5A5000176F0 PBXProjectModuleLabel - Info.plist + PurestConsoleChannel.cpp PBXSplitModuleInNavigatorKey Split0 @@ -349,14 +347,15 @@ PBXProjectModuleGUID 8BD7274B1D46E5A5000176F0 PBXProjectModuleLabel - Info.plist + PurestConsoleChannel.cpp _historyCapacity 0 bookmark - 8B4E54C3201BB57400B5DC2A + 8B79267A21F3308F006E9731 history - 8B4E54B5201BB4AE00B5DC2A + 8B34922E2054553C00C0EF7D + 8B79267521F33079006E9731 SplitCount @@ -370,18 +369,18 @@ GeometryConfiguration Frame - {{0, 0}, {531, 229}} + {{0, 0}, {531, 126}} RubberWindowFrame - 584 203 841 654 0 0 1440 878 + 388 183 841 654 0 0 1440 878 Module PBXNavigatorGroup Proportion - 229pt + 126pt Proportion - 379pt + 482pt Tabs @@ -395,9 +394,7 @@ GeometryConfiguration Frame - {{10, 27}, {531, 352}} - RubberWindowFrame - 584 203 841 654 0 0 1440 878 + {{10, 27}, {531, 455}} Module XCDetailModule @@ -451,7 +448,9 @@ GeometryConfiguration Frame - {{10, 27}, {531, 315}} + {{10, 27}, {531, 455}} + RubberWindowFrame + 388 183 841 654 0 0 1440 878 Module PBXBuildResultsModule @@ -479,11 +478,11 @@ TableOfContents - 8B4E54C4201BB57400B5DC2A + 8B79267B21F3308F006E9731 1CA23ED40692098700951B8B - 8B4E54C5201BB57400B5DC2A + 8B79267C21F3308F006E9731 8BD7274A1D46E5A5000176F0 - 8B4E54C6201BB57400B5DC2A + 8B79267D21F3308F006E9731 1CA23EDF0692099D00951B8B 1CA23EE00692099D00951B8B 1CA23EE10692099D00951B8B @@ -656,7 +655,7 @@ StatusbarIsVisible TimeStamp - 538686836.144647 + 569585807.50112402 ToolbarConfigUserDefaultsMinorVersion 2 ToolbarDisplayMode @@ -673,11 +672,10 @@ 5 WindowOrderList - 8B4E54C7201BB57400B5DC2A - /Users/christopherjohnson/Desktop/github/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj + /Users/christopherjohnson/Desktop/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj WindowString - 584 203 841 654 0 0 1440 878 + 388 183 841 654 0 0 1440 878 WindowToolsV3 diff --git a/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj/project.pbxproj b/plugins/MacAU/PurestConsoleChannel/PurestConsoleChannel.xcodeproj/project.pbxproj old mode 100644 new mode 100755 -- cgit v1.2.3