Whats the best way to hand audio data to ui components?



i want to visualise some audio data, like draw a wavetable in a ui component. Right now i'm writing the wavetable into a seperate buffer every n samples from within the audio callback. Then the component reads from that buffer whenever its paint function is called. Is that a good practice? I tried reading directly from the wavetable but this seemed to introduce some crackeling. I'm still a bit new to audio programming and i'm not sure if the audio thread would have to wait for another thread thats trying to read from the same buffer. 

Any hints would be greatly appreciated.



In case anyone else is interested, i found this article on the subject: http://www.rossbencina.com/code/programming-with-lightweight-asynchronous-messages-some-basic-patterns