Hello, so what is the difference between the maxiOsc class sinewave method and the JUCE tutorial on building a sinewave,
how does the maxiOsc class goes about making the wave?
//This is a sinewave oscillator
output=sin (phase*(TWOPI));
if ( phase >= 1.0 ) phase -= 1.0;
phase += (1./(maxiSettings::sampleRate/(frequency)));
return(output);
}
void updateAngleDelta()
{
auto cyclesPerSample = frequencySlider.getValue() / currentSampleRate; // [2]
angleDelta = cyclesPerSample * 2.0 * MathConstants<double>::pi; // [3]
}
void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) override
{
auto level = 0.125f;
auto* leftBuffer = bufferToFill.buffer->getWritePointer (0, bufferToFill.startSample);
auto* rightBuffer = bufferToFill.buffer->getWritePointer (1, bufferToFill.startSample);
for (auto sample = 0; sample < bufferToFill.numSamples; ++sample)
{
auto currentSample = (float) std::sin (currentAngle);
currentAngle += angleDelta;
leftBuffer[sample] = currentSample * level;
rightBuffer[sample] = currentSample * level;
}
}