Code: Select all
void VST_Plug_in::processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames)
{
float* out1 = outputs[0];
float* out2 = outputs[1];
float outSample = 0.0;
float frequency = 0.0;
for(int i = 0; i < sampleFrames; i++)
{
//create the sine wave output
frequency = m_frequencyTable[m_currentNote];
mSine1 = (float)sin(2.0*PI*frequency*m_time/m_sampleRate) * mGain1;
mSine2 = (float)sin(2.0*PI*frequency*m_time/m_sampleRate) * mGain2;
mSine3 = (float)sin(2.0*PI*frequency*m_time/m_sampleRate) * mGain3;
mSine4 = (float)sin(2.0*PI*frequency*m_time/m_sampleRate) * mGain4;
//multiply the sine by the velocity
outSample = mSine1 + mSine2 + mSine3 + mSine4;
outSample = (outSample * m_currentVelocity) ;
//increment the time
m_time++;
// write samples to output buffer
out1[i] = outSample;
out2[i] = outSample;
}
}