[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-dev] Ugen creation q
Here are some questions in going through LFPulse, I
also looked at Latch which was clear.
Thanks,
Casey
//phase goes between 0 and 1?
^this.multiNew('audio', freq, iphase, width).madd(mul,
add)
// This copies, the arguments to the variables in the
structure?
void LFPulse_next_a(LFPulse *unit, int inNumSamples)
{
float *out = ZOUT(0);
float *freq = ZIN(0); // Not sure what this does
float nextDuty = ZIN0(2); // Not sure what this does
// ZIN0 means only get at each buffer?
float duty = unit->mDuty;
float freqmul = unit->mFreqMul;
float phase = unit->mPhase;
LOOP(inNumSamples,
float z;
if (phase >= 1.f) {
phase -= 1.f; // Keeps the phase in a 0-1 range?
duty = unit->mDuty = nextDuty; // nextDuty, ZIN?
// output at least one sample from the opposite
polarity
z = duty < 0.5 ? 1.f : 0.f; // This i dont get.
Why?
} else {
z = phase < duty ? 1.f : 0.f; // I get this.
}
phase += ZXP(freq) * freqmul; // increment freq
(ZIN)
// (whatever that is) multiply by
// frequency add to phase?
ZXP(out) = z;
);
unit->mPhase = phase;
}
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com