ok, thanks for the help.
Is the JUCE AudioVisualiser class what you're looking for?
http://www.juce.com/doc/classAudioVisualiserComponent
You can see it in action in the JUCE demo, I use it whenever I want to display an audio signal.
Yes, the AudioVisualiserComponent is a ready-to-use scrolling waveform display. This is something else than an oscilloscope. Sorry, there was apparently some confusion about the terminilogy here!
This is a scrolling waveform display:
This is an oscilloscope:

AudioVizualiser is used only for waveform audio and oscilloscope is something different.
Timur explained well the difference between them.
What I was looking for was an oscilloscope.
Thanks. ;)
I also had trouble with audioDeviceIOCallback distorting the sound, but then I looked at AudioLiveScrollingDisplay.h in the Juce Demo and noticed that it is important to clear any unused channel data. So it works great now with this change:
void audioDeviceIOCallback (const float** inputChannelData,
int numInputChannels,
float** outputChannelData,
int numOutputChannels,
int numSamples) override
{
// show the waveform in the oscilloscpe
audioOscilloscope.pushBuffer(*outputChannelData, numSamples);
// We need to clear the output buffers before returning, in case they're full of junk..
for (int j = 0; j < numOutputChannels; ++j)
{
if (float* outputChannel = outputChannelData[j])
{
zeromem (outputChannel, sizeof (float) * (size_t) numSamples);
}
}
}
