10. Main Rephasor

10.1. Overview

Rephasor whose scaling amount is represented as a rational number with a numerator and denominator.

10.2. Computation

It is computed with rephasor_tick.

<<static_funcdefs>>=
static SKFLT rephasor_tick(gestvm *gvm, SKFLT phs);

The rephasor scaling value must be updated any time the numerator, denominator, or skewing duration is changed.

<<funcs>>=
static SKFLT rephasor_tick(gestvm *gvm, SKFLT phs)
{
    SKFLT out;

    if (gvm->update_rephasor) {
        SKFLT scale;
        gvm->update_rephasor = 0;

        if (gvm->den != 0) {
            scale =
                (SKFLT)(gvm->num * gvm->skewdur) /
                (SKFLT)gvm->den;
        } else scale = 1.0;

        gestvm_rephasor_scale(&gvm->rephasor, scale);
    }

    out = gestvm_rephasor_tick(&gvm->rephasor, phs);
    return out;
}

10.3. Rephasor Control

<<gestvm>>=
gestvm_rephasor rephasor;
int num, den;
int update_rephasor;
<<init>>=
gestvm_rephasor_init(&gvm->rephasor);
gestvm_rephasor_scale(&gvm->rephasor, 1.0);
gvm->num = 1;
gvm->den = 1;
gvm->update_rephasor = 0;



prev | home | next