I’ve consistently had a problem when running a standalone JUCE app with Linux/ALSA where the audio will become very garbled for an indeterminate period of time. As far as I can tell it seems to appear more often when CPU usage is high. The problem is that when this occurs, PluginProcessor::processBlock gets called noticeably faster than it should be for the current buffer size and sample rate, resulting in higher CPU usage, sustaining the problem. The problem usually goes away after playing no notes and waiting for CPU usage to drop as a result.
Recently, I’ve made some additions to my project which, on an unoptimized build, can reliably cause this problem. I wanted to take the opportunity to go into JUCE’s ALSA code to see if I could create a patch for the problem. Unfortunately, I am not very familiar with ALSA or how JUCE interacts with it. All I’ve been able to figure out so far is that
juce_audio_devices/native/juce_linux_ALSA.cpp gets called more often than it should be when the audio is garbled and returns to a normal rate when the audio becomes clear again.
I would appreciate any advice on what to do or suggestions of things to try.