None
frac32buffer.bipolar out
int32_t cChange; // sample ratio change counter
int32_t csr; // sample ratio counter
int32_t sr; // sample ratio
int32_t _sr;
uint32_t urand; // unsigned pseudo random generator (for periods)
int32_t rand; // signed pseudo random gen (for audio)
int32_t curOut;
int32_t deltaOut; // delta output for linear interpolation
rand = GenerateRandomNumber();
urand = (uint32_t)GenerateRandomNumber();
cChange = 1;
csr = 1;
sr = 1;
_sr = 1 << 27;
curOut = 0;
deltaOut = 0;
cChange--;
// sample ratio change
if (cChange <= 0) {
sr =
4 + ((urand = urand * 69069 + 1) >> (32 - 2)); // random sample ratio 1..5
_sr = arm::float_to_q(1.0f / sr, 27);
cChange =
2 + ((urand = urand * 69069 + 1) >> (32 - 2)); // random change cycle
}
csr--;
if (csr <= 0) {
csr = sr;
int32_t nextOut = (rand = rand * 69069 + 1) >> (31 - 27);
deltaOut = ___SMMUL(nextOut - curOut, _sr) << 5;
}
curOut += deltaOut;
outlet_out = curOut;