aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/MacAU/VoiceOfTheStarship/VoiceOfTheStarship.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MacAU/VoiceOfTheStarship/VoiceOfTheStarship.cpp')
-rwxr-xr-xplugins/MacAU/VoiceOfTheStarship/VoiceOfTheStarship.cpp25
1 files changed, 6 insertions, 19 deletions
diff --git a/plugins/MacAU/VoiceOfTheStarship/VoiceOfTheStarship.cpp b/plugins/MacAU/VoiceOfTheStarship/VoiceOfTheStarship.cpp
index e89cc53..cfc6806 100755
--- a/plugins/MacAU/VoiceOfTheStarship/VoiceOfTheStarship.cpp
+++ b/plugins/MacAU/VoiceOfTheStarship/VoiceOfTheStarship.cpp
@@ -175,9 +175,7 @@ void VoiceOfTheStarship::VoiceOfTheStarshipKernel::Reset()
filterflip = false;
for(int count = 0; count < 11; count++) {b[count] = 0.0; f[count] = 0.0;}
lastAlgorithm = 0;
- fpNShapeA = 0.0;
- fpNShapeB = 0.0;
- fpFlip = true;
+ fpNShape = 0.0;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -259,9 +257,6 @@ void VoiceOfTheStarship::VoiceOfTheStarshipKernel::Process( const Float32 *inS
Float64 rumbletrim = sqrt(lowcut);
//this among other things is just to give volume compensation
Float64 inputSample;
- Float32 fpTemp;
- Float64 fpOld = 0.618033988749894848204586; //golden ratio!
- Float64 fpNew = 1.0 - fpOld;
while (nSampleFrames-- > 0) {
inputSample = *sourceP;
@@ -323,19 +318,11 @@ void VoiceOfTheStarship::VoiceOfTheStarshipKernel::Process( const Float32 *inS
flip = !flip;
filterflip = !filterflip;
- //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;
sourceP += inNumChannels;