I’m trying to figure out the best way to have my audio plugin draw an incoming waveform as it’s being fed from the host (it’s also drawing some other stuff based on the analysis of the waveform but the issue is the same.) I know there is a simple way to do this, but I’m not seeing it.
For the data, I was thinking shared memory, so I’ve looked at the MemoryInputStream and MemoryOutputStream classes. However I don’t see how you have simultaneous writing and reading with these classes.
It looks to me like I need to implement a MyInputStream : InputStream class so I can feed data into it from the filter. The filter could be an InputSource allowing the UI to call createInputStream() which would give it access to the dynamically updating stream. I was planning on using AudioThumbnail to do the drawing (I’ve seen the other posts on that).
My filter is a ChangeBroadcaster already, which is used to update the UI’s sliders during automation, etc. But when I added a call to sendChangeMessage() when the audio is flowing in to tell the UI to update itself, things ground to a halt. The mechanism works fine for automation, but perhaps calling it every 128 samples is too often? I would like the display to look almost continuously updating as the audio is played, so if there is a more efficient way to do this, I’m open to suggestions.