aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacVST/Density
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/Density
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/Density')
-rwxr-xr-xplugins/MacVST/Density/Density.xcodeproj/christopherjohnson.pbxuser72
-rwxr-xr-xplugins/MacVST/Density/Density.xcodeproj/christopherjohnson.perspectivev347
-rwxr-xr-xplugins/MacVST/Density/Density.xcodeproj/project.pbxproj4
-rwxr-xr-xplugins/MacVST/Density/source/Density.cpp7
-rwxr-xr-xplugins/MacVST/Density/source/Density.h9
-rwxr-xr-xplugins/MacVST/Density/source/DensityProc.cpp64
6 files changed, 114 insertions, 89 deletions
diff --git a/plugins/MacVST/Density/Density.xcodeproj/christopherjohnson.pbxuser b/plugins/MacVST/Density/Density.xcodeproj/christopherjohnson.pbxuser
index 514aca1..86b1d22 100755
--- a/plugins/MacVST/Density/Density.xcodeproj/christopherjohnson.pbxuser
+++ b/plugins/MacVST/Density/Density.xcodeproj/christopherjohnson.pbxuser
@@ -2,7 +2,7 @@
{
089C1669FE841209C02AAC07 /* Project object */ = {
activeBuildConfigurationName = Release;
- activeTarget = 8D01CCC60486CAD60068D4B7 /* AudioUnit */;
+ activeTarget = 8D01CCC60486CAD60068D4B7 /* Density */;
codeSenseManager = 8B02375F1D42B1C400E1E8C8 /* Code sense */;
perUserDictionary = {
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
@@ -49,8 +49,14 @@
PBXFileDataSource_Warnings_ColumnID,
);
};
- PBXPerProjectTemplateStateSaveDate = 528459901;
- PBXWorkspaceStateSaveDate = 528459901;
+ PBXPerProjectTemplateStateSaveDate = 569734277;
+ PBXWorkspaceStateSaveDate = 569734277;
+ };
+ perUserProjectItems = {
+ 8B79379F21F574D1006E9731 /* PBXTextBookmark */ = 8B79379F21F574D1006E9731 /* PBXTextBookmark */;
+ 8B7937A021F574D1006E9731 /* PBXTextBookmark */ = 8B7937A021F574D1006E9731 /* PBXTextBookmark */;
+ 8B7937A121F574D1006E9731 /* PBXTextBookmark */ = 8B7937A121F574D1006E9731 /* PBXTextBookmark */;
+ 8B7937A221F574D1006E9731 /* PBXTextBookmark */ = 8B7937A221F574D1006E9731 /* PBXTextBookmark */;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
@@ -58,17 +64,17 @@
};
2407DEB6089929BA00EB68BF /* Density.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {848, 2054}}";
- sepNavSelRange = "{505, 0}";
- sepNavVisRange = "{0, 1934}";
+ sepNavIntBoundsRect = "{{0, 0}, {719, 1989}}";
+ sepNavSelRange = "{631, 0}";
+ sepNavVisRange = "{322, 786}";
sepNavWindowFrame = "{{545, 36}, {895, 831}}";
};
};
245463B80991757100464AD3 /* Density.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {866, 1001}}";
- sepNavSelRange = "{2548, 85}";
- sepNavVisRange = "{425, 2333}";
+ sepNavIntBoundsRect = "{{0, 0}, {866, 962}}";
+ sepNavSelRange = "{2579, 0}";
+ sepNavVisRange = "{2169, 536}";
sepNavWindowFrame = "{{593, 47}, {895, 831}}";
};
};
@@ -82,9 +88,9 @@
};
24D8286F09A914000093AEF8 /* DensityProc.cpp */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {848, 4602}}";
- sepNavSelRange = "{7190, 0}";
- sepNavVisRange = "{7245, 2459}";
+ sepNavIntBoundsRect = "{{0, 0}, {684, 4225}}";
+ sepNavSelRange = "{8807, 0}";
+ sepNavVisRange = "{8744, 275}";
sepNavWindowFrame = "{{545, 39}, {895, 831}}";
};
};
@@ -102,7 +108,47 @@
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
- 8D01CCC60486CAD60068D4B7 /* AudioUnit */ = {
+ 8B79379F21F574D1006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 24D8286F09A914000093AEF8 /* DensityProc.cpp */;
+ name = "DensityProc.cpp: 240";
+ rLen = 0;
+ rLoc = 8807;
+ rType = 0;
+ vrLen = 275;
+ vrLoc = 8744;
+ };
+ 8B7937A021F574D1006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 2407DEB6089929BA00EB68BF /* Density.cpp */;
+ name = "Density.cpp: 23";
+ rLen = 0;
+ rLoc = 631;
+ rType = 0;
+ vrLen = 786;
+ vrLoc = 322;
+ };
+ 8B7937A121F574D1006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 245463B80991757100464AD3 /* Density.h */;
+ name = "Density.h: 1";
+ rLen = 0;
+ rLoc = 0;
+ rType = 0;
+ vrLen = 446;
+ vrLoc = 0;
+ };
+ 8B7937A221F574D1006E9731 /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 245463B80991757100464AD3 /* Density.h */;
+ name = "Density.h: 65";
+ rLen = 0;
+ rLoc = 2579;
+ rType = 0;
+ vrLen = 536;
+ vrLoc = 2169;
+ };
+ 8D01CCC60486CAD60068D4B7 /* Density */ = {
activeExec = 0;
};
}
diff --git a/plugins/MacVST/Density/Density.xcodeproj/christopherjohnson.perspectivev3 b/plugins/MacVST/Density/Density.xcodeproj/christopherjohnson.perspectivev3
index 3decba3..26b67da 100755
--- a/plugins/MacVST/Density/Density.xcodeproj/christopherjohnson.perspectivev3
+++ b/plugins/MacVST/Density/Density.xcodeproj/christopherjohnson.perspectivev3
@@ -256,8 +256,6 @@
<key>Layout</key>
<array>
<dict>
- <key>BecomeActive</key>
- <true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBottomSmartGroupGIDs</key>
@@ -300,7 +298,7 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
- <integer>6</integer>
+ <integer>7</integer>
<integer>4</integer>
<integer>0</integer>
</array>
@@ -323,7 +321,7 @@
<real>185</real>
</array>
<key>RubberWindowFrame</key>
- <string>612 109 810 487 0 0 1440 878 </string>
+ <string>374 322 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@@ -334,12 +332,14 @@
<key>Dock</key>
<array>
<dict>
+ <key>BecomeActive</key>
+ <true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXProjectModuleGUID</key>
<string>8B0237581D42B1C400E1E8C8</string>
<key>PBXProjectModuleLabel</key>
- <string></string>
+ <string>Density.h</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@@ -347,7 +347,17 @@
<key>PBXProjectModuleGUID</key>
<string>8B0237591D42B1C400E1E8C8</string>
<key>PBXProjectModuleLabel</key>
- <string></string>
+ <string>Density.h</string>
+ <key>_historyCapacity</key>
+ <integer>0</integer>
+ <key>bookmark</key>
+ <string>8B7937A221F574D1006E9731</string>
+ <key>history</key>
+ <array>
+ <string>8B79379F21F574D1006E9731</string>
+ <string>8B7937A021F574D1006E9731</string>
+ <string>8B7937A121F574D1006E9731</string>
+ </array>
</dict>
<key>SplitCount</key>
<string>1</string>
@@ -360,18 +370,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{0, 0}, {603, 0}}</string>
+ <string>{{0, 0}, {603, 331}}</string>
<key>RubberWindowFrame</key>
- <string>612 109 810 487 0 0 1440 878 </string>
+ <string>374 322 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
- <string>0pt</string>
+ <string>331pt</string>
</dict>
<dict>
<key>Proportion</key>
- <string>441pt</string>
+ <string>110pt</string>
<key>Tabs</key>
<array>
<dict>
@@ -386,8 +396,6 @@
<dict>
<key>Frame</key>
<string>{{10, 27}, {603, 414}}</string>
- <key>RubberWindowFrame</key>
- <string>612 109 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@@ -441,7 +449,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
- <string>{{10, 27}, {603, 363}}</string>
+ <string>{{10, 27}, {603, 83}}</string>
+ <key>RubberWindowFrame</key>
+ <string>374 322 810 487 0 0 1440 878 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@@ -469,11 +479,11 @@
</array>
<key>TableOfContents</key>
<array>
- <string>8B9D79111F7FA891007AB60F</string>
+ <string>8B7937A321F574D1006E9731</string>
<string>1CA23ED40692098700951B8B</string>
- <string>8B9D79121F7FA891007AB60F</string>
+ <string>8B7937A421F574D1006E9731</string>
<string>8B0237581D42B1C400E1E8C8</string>
- <string>8B9D79131F7FA891007AB60F</string>
+ <string>8B7937A521F574D1006E9731</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@@ -626,7 +636,7 @@
<key>StatusbarIsVisible</key>
<true/>
<key>TimeStamp</key>
- <real>528459921.00240701</real>
+ <real>569734353.80657697</real>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
<key>ToolbarDisplayMode</key>
@@ -643,11 +653,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
- <string>8B9D79141F7FA891007AB60F</string>
<string>/Users/christopherjohnson/Desktop/MacVST/Density/Density.xcodeproj</string>
</array>
<key>WindowString</key>
- <string>612 109 810 487 0 0 1440 878 </string>
+ <string>374 322 810 487 0 0 1440 878 </string>
<key>WindowToolsV3</key>
<array>
<dict>
diff --git a/plugins/MacVST/Density/Density.xcodeproj/project.pbxproj b/plugins/MacVST/Density/Density.xcodeproj/project.pbxproj
index 649faa8..929f8f7 100755
--- a/plugins/MacVST/Density/Density.xcodeproj/project.pbxproj
+++ b/plugins/MacVST/Density/Density.xcodeproj/project.pbxproj
@@ -1894,7 +1894,7 @@
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
- 8D01CCC60486CAD60068D4B7 /* AudioUnit */ = {
+ 8D01CCC60486CAD60068D4B7 /* Density */ = {
isa = PBXNativeTarget;
buildConfigurationList = 24BEAAED08919AE700E695F9 /* Build configuration list for PBXNativeTarget "Density" */;
buildPhases = (
@@ -1947,7 +1947,7 @@
);
projectRoot = "";
targets = (
- 8D01CCC60486CAD60068D4B7 /* AudioUnit */,
+ 8D01CCC60486CAD60068D4B7 /* Density */,
);
};
/* End PBXProject section */
diff --git a/plugins/MacVST/Density/source/Density.cpp b/plugins/MacVST/Density/source/Density.cpp
index 1ecafde..bac4fb2 100755
--- a/plugins/MacVST/Density/source/Density.cpp
+++ b/plugins/MacVST/Density/source/Density.cpp
@@ -20,12 +20,9 @@ Density::Density(audioMasterCallback audioMaster) :
iirSampleBL = 0.0;
iirSampleAR = 0.0;
iirSampleBR = 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/Density/source/Density.h b/plugins/MacVST/Density/source/Density.h
index 377d25d..b634c44 100755
--- a/plugins/MacVST/Density/source/Density.h
+++ b/plugins/MacVST/Density/source/Density.h
@@ -55,17 +55,14 @@ 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 iirSampleAL;
double iirSampleBL;
double iirSampleAR;
double iirSampleBR;
-
+ bool fpFlip;
float A;
float B;
float C;
diff --git a/plugins/MacVST/Density/source/DensityProc.cpp b/plugins/MacVST/Density/source/DensityProc.cpp
index 1e968c7..f229a9d 100755
--- a/plugins/MacVST/Density/source/DensityProc.cpp
+++ b/plugins/MacVST/Density/source/DensityProc.cpp
@@ -26,9 +26,6 @@ void Density::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
double out = fabs(density);
density = density * fabs(density);
double count;
- float fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
long double inputSampleL;
long double inputSampleR;
@@ -95,6 +92,7 @@ void Density::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
inputSampleR -= iirSampleBR;
}
//highpass section
+ fpFlip = !fpFlip;
count = density;
while (count > 1.0)
@@ -150,25 +148,14 @@ void Density::processReplacing(float **inputs, float **outputs, VstInt32 sampleF
//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 = 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;
@@ -199,9 +186,6 @@ void Density::processDoubleReplacing(double **inputs, double **outputs, VstInt32
double out = fabs(density);
density = density * fabs(density);
double count;
- double fpTemp;
- long double fpOld = 0.618033988749894848204586; //golden ratio!
- long double fpNew = 1.0 - fpOld;
long double inputSampleL;
long double inputSampleR;
@@ -268,6 +252,7 @@ void Density::processDoubleReplacing(double **inputs, double **outputs, VstInt32
inputSampleR -= iirSampleBR;
}
//highpass section
+ fpFlip = !fpFlip;
count = density;
while (count > 1.0)
@@ -323,25 +308,16 @@ void Density::processDoubleReplacing(double **inputs, double **outputs, VstInt32
//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 64-bit floating point
- 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;