void pdsp::Sampler::process_audio( const float* pitchModBuffer, const float* triggerBuffer, const float* &selectBuffer, int &selectState, const float* &startBuffer, int& startState, int bufferSize)noexcept{ float* outputBuffer = getOutputBufferToFill(output); if(pitchModAR){ // vect_calculateIncrement(outputBuffer, pitchModBuffer, incBase * sample->fileSampleRate, bufferSize); //in this way is always correct even with oversample } for(int n=0; n<bufferSize; ++n){ if(triggerAR){ if(checkTrigger(triggerBuffer[n])){ selectSample(selectBuffer, selectState, startBuffer, startState, n, bufferSize); } } if(pitchModAR){ inc = outputBuffer[n]; //we have the calculated pitchs inside outputbuffer } int readIndex_int = static_cast<int>(readIndex); if(readIndex_int>=0 && readIndex_int < sample->length){ outputBuffer[n] = interpolatorShell.interpolator->interpolate(sample->buffer[sample->mono], readIndex, sample->length); }else{ outputBuffer[n] = 0.0f; } readIndex += inc*direction; } positionMeter.store(readIndex*positionDivider); }
void pdsp::Sampler::process_once( const float* pitchModBuffer)noexcept{ if(pitchModChange){ vect_calculateIncrement(&inc, pitchModBuffer, incBase * sample->fileSampleRate, 1); //in this way is always correct even with oversample } }
float pdsp::PitchToFreq::formula(const float &x) noexcept { float fc; vect_calculateIncrement(&fc, &x, freqCalculationMultiplier , 1); //vect_pitchToFreq(&fc, &x, 1); return fc; }
float pdsp::PitchToFreq::eval(float value){ float fc; vect_calculateIncrement(&fc, &value, freqCalculationMultiplier , 1); //vect_pitchToFreq(&fc, &x, 1); return fc; }
void pdsp::PitchToFreq::formulaAudioRate(float* &output, const float* &input, const int &bufferSize) noexcept { vect_calculateIncrement(output, input, freqCalculationMultiplier, bufferSize); //vect_pitchToFreq(output, input, bufferSize); }
float pdsp::PitchToFreq::eval(float value){ //return powf(2.0f, value) * freqCalculationMultiplier; float fc; vect_calculateIncrement(&fc, &value, freqCalculationMultiplier , 1); return fc; }