~pbatch/gestvm

545db73c9634bb62c499b34d5fc8b9d6b65899bb — Paul Batchelor 1 year, 2 months ago 86e3044
extscale: initial components
1 files changed, 29 insertions(+), 0 deletions(-)

M gestvm.org
M gestvm.org => gestvm.org +29 -0
@@ 658,6 658,11 @@ static SKFLT rephasor_tick(gestvm *gvm, SKFLT phs)
{
    SKFLT out;

    if (gvm->extscale != gvm->pextscale) {
        gvm->extscale = gvm->pextscale;
        gvm->update_rephasor = 1;
    }

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


@@ 668,6 673,8 @@ static SKFLT rephasor_tick(gestvm *gvm, SKFLT phs)
                (SKFLT)gvm->den;
        } else scale = 1.0;

        scale *= gvm->extscale;

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



@@ 688,11 695,16 @@ the rescaling factor. When this happens, the rational
fraction value is computed as a floating point value
and stored inside the rephasor.

=extscale= is used to apply additional scaling to the
rephasor from an external source. This can be useful when
the scaling needs more resolution than what Uxn can offer.

#+NAME: gestvm
#+BEGIN_SRC c
gestvm_rephasor rephasor;
int num, den;
int update_rephasor;
SKFLT extscale, pextscale;
#+END_SRC

These values are initialized below:


@@ 704,6 716,23 @@ gestvm_rephasor_scale(&gvm->rephasor, 1.0);
gvm->num = 1;
gvm->den = 1;
gvm->update_rephasor = 0;
gvm->extscale = gvm->pextscale = 1.0;
#+END_SRC
** External scaling
An external scaling factor that is used to apply additional
rescaling.

#+NAME: funcdefs
#+BEGIN_SRC c
void gestvm_extscale(gestvm *gvm, SKFLT extscale);
#+END_SRC

#+NAME: funcs
#+BEGIN_SRC c
void gestvm_extscale(gestvm *gvm, SKFLT extscale)
{
    gvm->extscale = extscale;
}
#+END_SRC
* Uxn Evaluator
** Overview