lifeSurface

This module reads out a 2D surface of the game of life module The outcome is a scaled based upon how many coordinates are within the surface. Each step has 4 possible values, 0,1,2,3, and all steps are added together, scaled to the total amount of steps*3 (*3 because each step has 3 as its highest value). Using the min/max parameters, you can set the minimum and maximum output values.
Author: Remco van der Most
License: BSD
Github: sss/seq/lifeSurface.axo

Inlets

int32 Xs

int32 Ys

int32 Xe

int32 Ye

frac32 max

frac32 min

Outlets

frac32 CV

Parameters

int32 Xs

int32 Ys

int32 Xe

int32 Ye

frac32.s.map max

frac32.s.map min

Attributes

objref ref

Declaration
int i;
int j;
Control Rate
int Xs = (param_Xs + inlet_Xs) & 15;
int Xe = ((param_Xe + inlet_Xe) - Xs) & 15;
int Ys = (param_Ys + inlet_Ys) & 15;
int Ye = ((param_Ye + inlet_Ye) - Ys) & 15;
int size = Xe * Ye * 3;
int32_t temp = 0;
for (i = Xs; i < (Xe + Xs); i++) {
  for (j = Ys; j < (Ye + Ys); j++) {
    temp += attr_ref.array[i][j];
  }
}
int32_t max = __SSAT(param_max + inlet_max, 27);
int32_t min = __SSAT(param_min + inlet_min, 27);
int32_t width = max - min;
outlet_CV = ___SMMUL(((temp << 16) / size) << 14, width << 2) + min;

Privacy

© 2024 Zrna Research