Probably a simple answer to this, but I can’t seem to find it. When using the code below to do some super simple panning, when a channel reaches hard left or hard right, there is still a very small audio output on the opposite channel still. Debugging shows that the value for currentSample drifts between 0 and -0. Any suggestions? C
const float currentSample = (float) std::sin (currentAngle);
buffer->addSample (leftChannel, sampleIndex, currentSample * (1.0f - pan));
buffer->addSample (rightChannel, sampleIndex, currentSample * pan);;
void AudioEngine::panLeft()
{
if (pan > 0)
{
pan -= 0.1;
}
if (pan > 0 && pan < 0.1)
{
pan = 0;
}
}