Trying to make a simple delay plugin, and I hit a really strange wall. When I run the plugin in my DAW, it works correctly as long as I put a limiter after it in the plugin chain. When it first instantiates in the DAW it’s outputting an inaudible signal with infinitely high gain. If I hit play and run the DAW, this persists for a split second and then goes away. Debugging has narrowed down the problem, but I’m still pretty stuck.
The problem begins at either line 209 or line 232. At line 104 I’m clearing the delay buffer. If I leave this line in, the problems begin at line 232. If I remove line 104, it happens at 209. Exactly when I start getting extreme values is seemingly arbitrary. Stepping through the code, the output buffer values are 0 up until some number of times through (this number is inconsistent) and then I will suddenly get massive exponential values for each sample.
Any ideas at all on what might be happening or where to look are greatly appreciated.