Hey there. I’ve just been getting started with both C++ and JUCE. This about my third plugin. The first was a basic sample opener that took MIDI, the second was basically the standalone version of this. This is a sample player that loads four random samples and then crossfades through them. Sort of like a primitive version of Lunacy Audio’s CUBE before I knew it existed. The standalone version works fine, but works differently (no processBlock). For whatever reason I’m getting some serious crunchy/lo-fi results in the plugin attempt. I thought it might be sample rate, but I’ve added resampling after files are loaded. The way midi notes affect pitch is primitive right now, but also not the cause since the buzz/crunch was happening before that was implemented.
edit: code removed. fixed the issues pointed out in comments, but the problem persisted. ended up refactoring using JUCE’s AudioTransportSource and AudioFormatReaderSource to handle audio playback