ive just taken a look at your new code, but its still got the same basic issue - this code will not work
readpos = writepos - time;
if(readpos < 0)
readpos = 0; //read pos wrapper
please see my previous reply for why......
(hint, for writepos = 1,2,3,4 you will set readpos to 0, this is incorrect!)
I'm confused you say it works under xcode... to me the algorithm looks wrong.
(well to be precise, it would 'appear' to work only under limited circumstances, when the writepos is not near the start of the delay line)
personally, id draw this on a piece of paper, and work thru it, once you have worked out the algorithm its trivial to implement.
the issue, is real time programming (including audio stuff) is tricky to debug, its better to spend more time upfront working out the design/algo .... this is a different 'workflow' for some programmers, who have become reliant on debuggers ( quite common these days with modern IDEs)
btw, a tip
initially develop objects as embedded objects, its a much quicker workflow.
also then you can upload the axp here, and we can look at it with one click.
( with axo, I have to save the file, move it into an objects directory, and then reload objects... much more hassle )