Simple delay plugin, tail is cut off

I am a beginner programmer, trying to create my first plugin. I made a simple delay plugin and aptly titled it MyGreatProject. You can find it here: MyGreatProject/Source at main · Archonic944/MyGreatProject · GitHub

It works by creating a buffer of the max delay length (5.0 seconds) and restricting the buffer to the current delay length. There is no editor yet so the only length is 1.0 seconds, the only feedback is 0.5.

Strangely, when I try to export the audio from ableton it seems like the tail is cut off. That is, I can’t hear the extra “echos” after the actual audio file ends. I will attach an example. Also, CPU usage is insane and I can only get good audio when I export.

Any help is appreciated!

audio.zip (130.3 KB)

Allocate memories in prepareToPlay() and avoid memory allocation processBlock (if possible). For example feedbackVec.reserve(blockLength);: