The comment indicates that you want to test with .5% tolerance, but I think currently you are testing with 50% tolerance. So there are two zeros missing before the five.
Looking a bit more into the test, something else is tripping me up too: I find it hard to understand how one can assure, that a buffer overflow does not happen. The stretcher doesn’t seem to get the information how big the output buffer is. So what prevents him from writing in unallocated memory?
E.g. when the output is flushed: tracktion_engine/tracktion_TimeStretch.test.cpp at a52de2e05f1b831582c7c615371f82fb0f9b64e6 · Tracktion/tracktion_engine · GitHub
how do I know that doesn’t crash? It seems like the result buffer is allocated with 8192 samples overhead – is that just in case to prevent buffer overflows?
I think the flush should never produce more than
getFramesNeeded() but it’s tricky as we have to support three underlying implementations that work differently but present a unified interface.
I’ve actually fixed these issues in the
engine_2_0 branch I’m working on so these will get merged in when that branch is ready: tracktion_engine/tracktion_TimeStretch.test.cpp at feature/engine_2_0 · Tracktion/tracktion_engine · GitHub