aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/DeRez
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/MacVST/DeRez
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/MacVST/DeRez')
-rwxr-xr-xplugins/MacVST/DeRez/DeRez.xcodeproj/christopherjohnson.pbxuser71
-rwxr-xr-xplugins/MacVST/DeRez/DeRez.xcodeproj/christopherjohnson.perspectivev334
-rwxr-xr-xplugins/MacVST/DeRez/source/DeRez.cpp7
-rwxr-xr-xplugins/MacVST/DeRez/source/DeRez.h7
-rwxr-xr-xplugins/MacVST/DeRez/source/DeRezProc.cpp62
5 files changed, 80 insertions, 101 deletions
diff --git a/plugins/MacVST/DeRez/DeRez.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/DeRez/DeRez.xcodeproj/christopherjohnson.pbxuser
index 70ab1db..570f388 100755
--- a/plugins/MacVST/DeRez/DeRez.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacVST/DeRez/DeRez.xcodeproj/christopherjohnson.pbxuser
@@ -49,13 +49,14 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 553892432;
- PBXWorkspaceStateSaveDate = 553892432;
+ PBXPerProjectTemplateStateSaveDate = 569734376;
+ PBXWorkspaceStateSaveDate = 569734376;
};
perUserProjectItems = {
+ 8B7932CA21F4FB37006E9731 /* PBXTextBookmark */ = 8B7932CA21F4FB37006E9731 /* PBXTextBookmark */;
+ 8B7932CC21F4FB37006E9731 /* PBXTextBookmark */ = 8B7932CC21F4FB37006E9731 /* PBXTextBookmark */;
+ 8B7937B821F574F6006E9731 /* PBXTextBookmark */ = 8B7937B821F574F6006E9731 /* PBXTextBookmark */;
8BB8B70521039BF400751000 /* PBXTextBookmark */ = 8BB8B70521039BF400751000 /* PBXTextBookmark */;
- 8BB8B70721039BF400751000 /* PBXTextBookmark */ = 8BB8B70721039BF400751000 /* PBXTextBookmark */;
- 8BB8B7932103BA6200751000 /* PBXTextBookmark */ = 8BB8B7932103BA6200751000 /* PBXTextBookmark */;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
@@ -63,25 +64,25 @@
};
2407DEB6089929BA00EB68BF /* DeRez.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {848, 1820}}";
- sepNavSelRange = "{3400, 0}";
- sepNavVisRange = "{2754, 2017}";
+ sepNavIntBoundsRect = "{{0, 0}, {554, 1833}}";
+ sepNavSelRange = "{0, 0}";
+ sepNavVisRange = "{0, 119}";
sepNavWindowFrame = "{{48, 47}, {895, 831}}";
};
};
245463B80991757100464AD3 /* DeRez.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {866, 988}}";
- sepNavSelRange = "{2648, 0}";
- sepNavVisRange = "{410, 2279}";
+ sepNavIntBoundsRect = "{{0, 0}, {866, 949}}";
+ sepNavSelRange = "{2439, 0}";
+ sepNavVisRange = "{361, 2262}";
sepNavWindowFrame = "{{20, 47}, {895, 831}}";
};
};
24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {838, 19864}}";
+ sepNavIntBoundsRect = "{{0, 0}, {838, 19851}}";
sepNavSelRange = "{10616, 0}";
- sepNavVisRange = "{10459, 280}";
+ sepNavVisRange = "{10579, 157}";
sepNavWindowFrame = "{{15, 42}, {895, 831}}";
};
};
@@ -107,35 +108,45 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
- 8BB8B70521039BF400751000 /* PBXTextBookmark */ = {
+ 8B7932CA21F4FB37006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
- fRef = 24D8286F09A914000093AEF8 /* DeRezProc.cpp */;
- name = "DeRezProc.cpp: 71";
+ fRef = 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */;
+ name = "audioeffectx.cpp: 307";
rLen = 0;
- rLoc = 2818;
+ rLoc = 10616;
rType = 0;
- vrLen = 286;
- vrLoc = 2669;
+ vrLen = 157;
+ vrLoc = 10579;
};
- 8BB8B70721039BF400751000 /* PBXTextBookmark */ = {
+ 8B7932CC21F4FB37006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
- fRef = 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */;
- name = "audioeffectx.cpp: 307";
+ fRef = 2407DEB6089929BA00EB68BF /* DeRez.cpp */;
+ name = "DeRez.cpp: 1";
rLen = 0;
- rLoc = 10616;
+ rLoc = 0;
rType = 0;
- vrLen = 280;
- vrLoc = 10459;
+ vrLen = 167;
+ vrLoc = 0;
};
- 8BB8B7932103BA6200751000 /* PBXTextBookmark */ = {
+ 8B7937B821F574F6006E9731 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
- fRef = 24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */;
- name = "audioeffectx.cpp: 307";
+ fRef = 2407DEB6089929BA00EB68BF /* DeRez.cpp */;
+ name = "DeRez.cpp: 1";
rLen = 0;
- rLoc = 10616;
+ rLoc = 0;
+ rType = 0;
+ vrLen = 119;
+ vrLoc = 0;
+ };
+ 8BB8B70521039BF400751000 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 24D8286F09A914000093AEF8 /* DeRezProc.cpp */;
+ name = "DeRezProc.cpp: 71";
+ rLen = 0;
+ rLoc = 2818;
rType = 0;
- vrLen = 280;
- vrLoc = 10459;
+ vrLen = 286;
+ vrLoc = 2669;
};
8D01CCC60486CAD60068D4B7 /* DeRez */ = {
activeExec = 0;
diff --git a/plugins/MacVST/DeRez/DeRez.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/DeRez/DeRez.xcodeproj/christopherjohnson.perspectivev3
index 9e76dbc..50aea9f 100755
--- a/plugins/MacVST/DeRez/DeRez.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacVST/DeRez/DeRez.xcodeproj/christopherjohnson.perspectivev3
@@ -323,7 +323,7 @@
<real>185</real>
</array>
<key>RubberWindowFrame</key>
- <string>10 338 810 487 0 0 1440 878 </string>
+ <string>396 274 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -339,7 +339,7 @@
<key>PBXProjectModuleGUID</key>
<string>8B0237581D42B1C400E1E8C8</string>
<key>PBXProjectModuleLabel</key>
- <string>audioeffectx.cpp</string>
+ <string>DeRez.cpp</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@@ -347,15 +347,16 @@
<key>PBXProjectModuleGUID</key>
<string>8B0237591D42B1C400E1E8C8</string>
<key>PBXProjectModuleLabel</key>
- <string>audioeffectx.cpp</string>
+ <string>DeRez.cpp</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>8BB8B7932103BA6200751000</string>
+ <string>8B7937B821F574F6006E9731</string>
<key>history</key>
<array>
<string>8BB8B70521039BF400751000</string>
- <string>8BB8B70721039BF400751000</string>
+ <string>8B7932CA21F4FB37006E9731</string>
+ <string>8B7932CC21F4FB37006E9731</string>
</array>
</dict>
<key>SplitCount</key>
@@ -369,18 +370,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {603, 102}}</string>
+ <string>{{0, 0}, {603, 69}}</string>
<key>RubberWindowFrame</key>
- <string>10 338 810 487 0 0 1440 878 </string>
+ <string>396 274 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>102pt</string>
+ <string>69pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>339pt</string>
+ <string>372pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -394,9 +395,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 312}}</string>
+ <string>{{10, 27}, {603, 345}}</string>
<key>RubberWindowFrame</key>
- <string>10 338 810 487 0 0 1440 878 </string>
+ <string>396 274 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -478,11 +479,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8BB8B7942103BA6200751000</string>
+ <string>8B7937B921F574F6006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8BB8B7952103BA6200751000</string>
+ <string>8B7937BA21F574F6006E9731</string>
<string>8B0237581D42B1C400E1E8C8</string>
- <string>8BB8B7962103BA6200751000</string>
+ <string>8B7937BB21F574F6006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -635,7 +636,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>553892450.74727702</real>
+ <real>569734390.87989402</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -652,11 +653,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8BB8B7972103BA6200751000</string>
<string>/Users/christopherjohnson/Desktop/MacVST/DeRez/DeRez.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>10 338 810 487 0 0 1440 878 </string>
+ <string>396 274 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>
diff --git a/plugins/MacVST/DeRez/source/DeRez.cpp b/plugins/MacVST/DeRez/source/DeRez.cpp
index 404127a..cb9b514 100755
--- a/plugins/MacVST/DeRez/source/DeRez.cpp
+++ b/plugins/MacVST/DeRez/source/DeRez.cpp
@@ -23,11 +23,8 @@ DeRez::DeRez(audioMasterCallback audioMaster) :
incrementA = 0.0;
incrementB = 0.0;
- fpNShapeLA = 0.0;
- fpNShapeLB = 0.0;
- fpNShapeRA = 0.0;
- fpNShapeRB = 0.0;
- fpFlip = true;
+ fpNShapeL = 0.0;
+ fpNShapeR = 0.0;
//this is reset: values being initialized only once. Startup values, whatever they are.
_canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect.
diff --git a/plugins/MacVST/DeRez/source/DeRez.h b/plugins/MacVST/DeRez/source/DeRez.h
index 89338e8..8ebdcd9 100755
--- a/plugins/MacVST/DeRez/source/DeRez.h
+++ b/plugins/MacVST/DeRez/source/DeRez.h
@@ -53,11 +53,8 @@ private:
char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo;
- long double fpNShapeLA;
- long double fpNShapeLB;
- long double fpNShapeRA;
- long double fpNShapeRB;
- bool fpFlip;
+ long double fpNShapeL;
+ long double fpNShapeR;
//default stuff
double lastSampleL;
diff --git a/plugins/MacVST/DeRez/source/DeRezProc.cpp b/plugins/MacVST/DeRez/source/DeRezProc.cpp
index 247a364..cbe42d5 100755
--- a/plugins/MacVST/DeRez/source/DeRezProc.cpp
+++ b/plugins/MacVST/DeRez/source/DeRezProc.cpp
@@ -17,8 +17,6 @@ void DeRez::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
double targetA = pow(A,3)+0.0005;
if (targetA > 1.0) targetA = 1.0;
@@ -132,26 +130,14 @@ void DeRez::processReplacing(float **inputs, float **outputs, VstInt32 sampleFra
lastSampleL = drySampleL;
lastSampleR = drySampleR;
- //noise shaping to 32-bit floating point
- float fpTemp;
- if (fpFlip) {
- fpTemp = inputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLA;
- fpTemp = inputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRA;
- }
- else {
- fpTemp = inputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLB;
- fpTemp = inputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRB;
- }
- fpFlip = !fpFlip;
- //end noise shaping on 32 bit output
+ //stereo 32 bit dither, made small and tidy.
+ int expon; frexpf((float)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexpf((float)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 32 bit dither
*out1 = inputSampleL;
*out2 = inputSampleR;
@@ -173,8 +159,6 @@ void DeRez::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
double targetA = pow(A,3)+0.0005;
if (targetA > 1.0) targetA = 1.0;
@@ -288,26 +272,16 @@ void DeRez::processDoubleReplacing(double **inputs, double **outputs, VstInt32 s
lastSampleL = drySampleL;
lastSampleR = drySampleR;
- //noise shaping to 64-bit floating point
- double fpTemp;
- if (fpFlip) {
- fpTemp = inputSampleL;
- fpNShapeLA = (fpNShapeLA*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLA;
- fpTemp = inputSampleR;
- fpNShapeRA = (fpNShapeRA*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRA;
- }
- else {
- fpTemp = inputSampleL;
- fpNShapeLB = (fpNShapeLB*fpOld)+((inputSampleL-fpTemp)*fpNew);
- inputSampleL += fpNShapeLB;
- fpTemp = inputSampleR;
- fpNShapeRB = (fpNShapeRB*fpOld)+((inputSampleR-fpTemp)*fpNew);
- inputSampleR += fpNShapeRB;
- }
- fpFlip = !fpFlip;
- //end noise shaping on 64 bit output
+ //stereo 64 bit dither, made small and tidy.
+ int expon; frexp((double)inputSampleL, &expon);
+ long double dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ dither /= 536870912.0; //needs this to scale to 64 bit zone
+ inputSampleL += (dither-fpNShapeL); fpNShapeL = dither;
+ frexp((double)inputSampleR, &expon);
+ dither = (rand()/(RAND_MAX*7.737125245533627e+25))*pow(2,expon+62);
+ dither /= 536870912.0; //needs this to scale to 64 bit zone
+ inputSampleR += (dither-fpNShapeR); fpNShapeR = dither;
+ //end 64 bit dither
*out1 = inputSampleL;
*out2 = inputSampleR;