I’m sending values from another application (Pure Data) to Processing via OSC. That data is then visualized in Processing by scrolling by bars like a waveform using an ArrayDeque. It seems to run fine, except after a few minutes running I’m getting ConcurrentModificationException suggesting that I access data somwhere whil it is being deleted or written to. That’s surprising to me as it sounds like I’m running a threaded program, something I’m not aware of.
I’ve tried to remedy that by not drawing (and though accessing the first and last two items of the deque (for (int i = 2; i < width-2; i++)) but that did not help. As another try, I set up a blocking boolean while the OSC data is incoming, so that while the deque is written the read access is paused (boolean block_drawing). That also did not change the fact that I’m getting the ConcurrentModificationException error after a while.
Anyone has an idea what else to try?
It’s not particularly beautiful, in essence I just catch the error and ignore it, so the program can go on. Solves my issue for the moment but I gladly accept a real solution.
The rendering is not 100% smooth, there is a slight stutter. It’s not very strong, but noticeable. I am wondering if there is a way to make sure it is always smooth. I’m thinking of rendering it as a texture and then moving the object it is rendered on smoothly… or something like that. I also wonder how to have more parameters, like for example changing the color of the waveform for each bar. How to get more parameters/dimensions into the ArrayDeque?