Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void mdaDither::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
- {
- float o = offs, w = wlen, wi = 1.0f / wlen; //DC offset, word length & inverse
- float *inarray[NUM_CHANS];
- float temparray[NUM_CHANS];
- float *outarray[NUM_CHANS];
- for (int i = 0; i < NUM_CHANS; i++)
- {
- inarray[i] = inputs[i];
- outarray[i] = outputs[i];
- --inarray[i];
- --outarray[i];
- }
- while(--sampleFrames >= 0)
- {
- for (int i = 0; i < NUM_CHANS; i++)
- {
- temparray[i] = *++inarray[i] + o; //apply offset, somehow this is needed
- if (temparray[i]<0.0f) temparray[i] -= wi; //(VstInt32) truncates towards zero!
- temparray[i] = wi * (float)(VstInt32)(w * temparray[i]); //truncate
- *++outarray[i] = temparray[i] * gain; //apply shift
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement