Neighbour components paint interference


#1

Hi i’m new to this forum and also to the JUCE framework and community. I’m graduating this year in my Audiovisual Systems Engineering degree and i’m currently working on my final project, wich is a pluguin for analysing a chain of external pluguins. So in my plugin you can see in the same window the magnitude change, the phase change and other (i think) usefull indicators as a waveform display and spectrum and level meter.
I’ve explored in depth the examples that the projucer comes with, the audioplugin example de audio plugin host and the FFT viewer, all of them helped me a lot in all the devoloping process.

Now i’m finally lying down all of my components in the main editor window, and the results are really good except from one little thing.
One of my components is a vectorscoope, wich plots the lissajous figure for the incomping blocks, i’ve also implemented a ring buffer to paint the past blocks in order to smoth out the visualitzation. But when i do this ( the painting of the past samples ) in my neighbour component (the spectrum analyser) i get a weird interference. I know that the interference is straight related to the original signal, becouse it changes if the excitation signal is noise, a pure tone or a musical signal.

Some screenshots:

ant the chunk of code that creates it is:

` for (int j = historysamples - 1; j > 0; j–){

		float opacity = 1 /(j + 1.0f);

		g.setColour(Colours::grey);
		g.setOpacity(opacity);

		float X = (width / 2) - (HistoryBufferPreX[i][j] * scaleFactor);
		float Y = (height / 2) - (HistoryBufferPreY[i][j] * scaleFactor);

		g.setPixel(X,Y);

		opacity = 1 / (float)(j + 1.0f);

		g.setColour(Colour::fromRGB(112, 255, 131));
		g.setOpacity(opacity);

		X = (width / 2) - (HistoryBufferPostX[i][j] * scaleFactor);
		Y = (height / 2) - (HistoryBufferPostY[i][j] * scaleFactor);

		g.setPixel(X, Y);
	
	}`

while looping on the buffersize in i.

if i comment this part of the code the interference dissapear.
My compoents are getting all the data via a pointer to an editor pointer pointing a fixed size memory block in the processor thread, and “HistoryBufferPost/PreX/Y” is a matrix of floats declared in the same component.

In the plugin editor timercallback method we have

rightChannelPre = getProcessor()->fftDataPreR;
leftChannelPre = getProcessor()->fftDataPreL;
rightChannelPost = getProcessor()->fftDataPostR;
leftChannelPost = getProcessor()->fftDataPostL;

stereodisplay->rigthChannelPre = rightChannelPre;
stereodisplay->leftChannelPre = leftChannelPre;
stereodisplay->rigthChannelPost = rightChannelPost;
stereodisplay->leftChannelPost = leftChannelPost;

and then it repaints the component.

all the audio buffers are only being read, they’ll never change their values in the editor (or subcomponents) thread.

I’m now really lost on fixing that issue and the deadline is coming closer day by day :frowning:

Thanks in advance!


#2

Guessing wildly …Are you doing this in realtime? Have you run out of CPU on a core? setPixel i seem to recall being quite slow. I wrote my one of these to an image and then blitted the image.