8xScaling

description
Author: Remco van der Most
License: BSD
Github: sss/math/8xScaling.axo

Inlets

frac32.bipolar in1

frac32.bipolar in2

frac32.bipolar in3

frac32.bipolar in4

frac32.bipolar in5

frac32.bipolar in6

frac32.bipolar in7

frac32.bipolar in8

Outlets

frac32 out1

frac32 out2

frac32 out3

frac32 out4

frac32 out5

frac32 out6

frac32 out7

frac32 out8

Parameters

int32 Max1

int32 Min1

int32 Max2

int32 Min2

int32 Max3

int32 Min3

int32 Max4

int32 Min4

int32 Max5

int32 Min5

int32 Max6

int32 Min6

int32 Max7

int32 Min7

int32 Max8

int32 Min8

Declaration
int32_t min[8];
int32_t max[8];
float32_t width2[8];
float32_t ratio[8];
int32_t in[8];
int32_t In[8];
int i;
Control Rate
max[0] = param_Max1;
max[1] = param_Max2;
max[2] = param_Max3;
max[3] = param_Max4;
max[4] = param_Max5;
max[5] = param_Max6;
max[6] = param_Max7;
max[7] = param_Max8;
min[0] = param_Min1;
min[1] = param_Min2;
min[2] = param_Min3;
min[3] = param_Min4;
min[4] = param_Min5;
min[5] = param_Min6;
min[6] = param_Min7;
min[7] = param_Min8;
In[0] = inlet_in1;
In[1] = inlet_in2;
In[2] = inlet_in3;
In[3] = inlet_in4;
In[4] = inlet_in5;
In[5] = inlet_in6;
In[6] = inlet_in7;
In[7] = inlet_in8;

for (i = 0; i < 8; i++) {
  width2[i] = (max[i] - min[i]) << 21;
  ratio[i] = (float32_t)width2[i] / (1 << 28);
  in[i] = In[i] > (1 << 27) ? (1 << 27) : In[i];
  in[i] = in[i] < -(1 << 27) ? -(1 << 27) : in[i];
}
outlet_out1 = (in[0] + (1 << 27)) * ratio[0] + (min[0] << 21);
outlet_out2 = (in[1] + (1 << 27)) * ratio[1] + (min[1] << 21);
outlet_out3 = (in[2] + (1 << 27)) * ratio[2] + (min[2] << 21);
outlet_out4 = (in[3] + (1 << 27)) * ratio[3] + (min[3] << 21);
outlet_out5 = (in[4] + (1 << 27)) * ratio[4] + (min[4] << 21);
outlet_out6 = (in[5] + (1 << 27)) * ratio[5] + (min[5] << 21);
outlet_out7 = (in[6] + (1 << 27)) * ratio[6] + (min[6] << 21);
outlet_out8 = (in[7] + (1 << 27)) * ratio[7] + (min[7] << 21);

Privacy

© 2024 Zrna Research