ok, I don't have time to debug your code, so I can only point out some errors that 'stand out' to me.
the main issue, is you are trying to store the float signal into a 16 bit int, its should be a float (which is 32bit), make your array a float.
( are you not getting 'type conversion' warnings when you compile this?)
buffreadpos = buffwritepos - 12000;
if(buffreadpos < 0) buffreadpos = 0;
this is wrong,
essentially what your trying to do is create a circular buffer...
if the writepos = 100, then readpos = 12000 -writepos,
note, you also need to be careful here, if your buffer size is less that the delay line size, you need to handle this too.
(your default is 5000, so cannot work for 12000 samples)
also your check will not work..
bufferreadpos will never be < 0 as you have declared it as a uint, i.e. an unsigned int...
this is probably what is crashing your patch, as on the first execution
bufreadpos = 0-12000, which will evaluation to UINT32_MAX-12000,
which is a very large number, well beyond your array boundary
finally, if you are using larger delay lines you will want to declare the array in sdram, as the default (sram) is quite small... look up one of the factory objects with sdram in title to see how to do this.
also id be tempted to add a 'wet/dry' param, so your out only has a part of you in signal.