unsigned LI_FrameDS()
{
fix24 out = 0;
int delay = 0;
state.dsPb = NextC( state.dsPc, state.dsPm, state.dsPb);
int dc = state.dsOscC.delay - state.dsRc;
int dm = state.dsOscM.delay - state.dsRm;
int db = state.dsOscB.delay - state.dsRb;
if(dc <= dm && dc <= db) //dc is next
{
fix24 phaseC = fix24_mul(state.dsOutM, state.dsMod);
state.dsOutC = NeMoscSample(state.dsOscC, state.morph, phaseC);
delay = dc;
if(delay < 0) delay = 0;
state.dsRc = -delay;
}
if(dm <= dc && dm <= db) //dm is next
{
fix24 phaseM = FIX24_Q state.morph;
state.dsOutM = NeMoscSample(state.dsOscM, state.morph, phaseM);
delay = dm;
if(delay < 0) delay = 0;
state.dsRm = -delay;
}
if(db <= dm && db <= dc) //db is next
{
state.dsOutB = NeMoscSample(state.dsOscB, state.morph);
delay = db;
if(delay < 0) delay = 0;
state.dsRb = -delay;
}
if(state.current.syncSw == LI_SYNC_A)
{
if(state.dsOscM.sync) NeMoscReset(state.dsOscC);
}
else if(state.current.syncSw == LI_SYNC_B)
{
if(state.dsOscC.sync)
NeMoscReset(state.dsOscM);
}
state.dsRc += delay;
state.dsRm += delay;
state.dsRb += delay;
fix24 a = state.dsA;
fix24 a2 = fix24_mul(a, a);
fix24 n = state.dsOutC - fix24_mul(a, state.dsOutB);
fix24 d = FIX24 FIX a2 - 2 * fix24_mul(a, state.dsOutM);
out = fix24_mul(FIX24_3RD,fix24_div(n, d));
out = fix24_mul(state.morphScale, out);
out = fix24_soft_clip_poly(out);
out = NeFoldSample(state.fold, out);
return fix24_to_u16_audio_delay(out, 2 * delay);
}
Code: DS
Noise Engineering
Loquelic Iteritas
Complex Digital Oscilator
12