Hi,
Ive not used the AudioVisualiserComponent class before and Im trying to visualise the waveform of an LFO rather than the over all signal from the buffer in the process block. Ive gone about this by creating a separate audio buffer and while looping through the individual samples setting them to the value of the LFO. Outside the sample loop Im then passing the LFO buffer to my instance of the AudioVisualiserComponent class (lfoScope) using the pushBuffer() method. To begin with this displays the waveform but then it being to glitch before ceasing to draw the waveform entirely.
would anyone be able to point out where exactly Im going wrong?
Heres the code from my process block
void Lfo_visulizerAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages)
{
juce::ScopedNoDenormals noDenormals;
auto totalNumInputChannels = getTotalNumInputChannels();
auto totalNumOutputChannels = getTotalNumOutputChannels();
auto lfoBufferSampleLen = lfoBuffer.getNumSamples();
for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
buffer.clear (i, 0, buffer.getNumSamples());
for (int sample = 0; sample < lfoBufferSampleLen; ++sample)
{
step += rate / getSampleRate();
float lfoVal = sin(2 * M_PI * step);
lfoBuffer.setSample(0, sample, lfoVal);
}
lfoScope.pushBuffer(lfoBuffer);
}
Ive set the the number of channels of lfoScope to 1, setRepaintRate to 30 and setBufferSize to 512.
Rate is currently set to 1.
Thanks in advance.
P