radio_switch_8

8 way radio switch
Author: Are Leistad
License: BSD
Github: drj/switch/radio_switch.axo

IO Variants: 6


Variant: 1

Inlets

bool32.rising Input 0

bool32.rising Input 1

bool32.rising Input 2

bool32.rising Input 3

bool32.rising Input 4

bool32.rising Input 5

bool32.rising Input 6

bool32.rising Input 7

Outlets

int32 Output number

bool32 Output 0

bool32 Output 1

bool32 Output 2

bool32 Output 3

bool32 Output 4

bool32 Output 5

bool32 Output 6

bool32 Output 7

Attributes

combo default

Declaration
int32_t n;
int8_t old[8];
Init
for (int i = 0; i < 8; i++) {
  old[i] = 0;
}
n = attr_default;
Control Rate
if (!old[0] && inlet_i0) {
  n = 0;
} else if (!old[1] && inlet_i1) {
  n = 1;
} else if (!old[2] && inlet_i2) {
  n = 2;
} else if (!old[3] && inlet_i3) {
  n = 3;
} else if (!old[4] && inlet_i4) {
  n = 4;
} else if (!old[5] && inlet_i5) {
  n = 5;
} else if (!old[6] && inlet_i6) {
  n = 6;
} else if (!old[7] && inlet_i7) {
  n = 7;
}
outlet_o0 = 0;
outlet_o1 = 0;
outlet_o2 = 0;
outlet_o3 = 0;
outlet_o4 = 0;
outlet_o5 = 0;
outlet_o6 = 0;
outlet_o7 = 0;
switch (n) {
case 0:
  outlet_o0 = 1;
  break;
case 1:
  outlet_o1 = 1;
  break;
case 2:
  outlet_o2 = 1;
  break;
case 3:
  outlet_o3 = 1;
  break;
case 4:
  outlet_o4 = 1;
  break;
case 5:
  outlet_o5 = 1;
  break;
case 6:
  outlet_o6 = 1;
  break;
case 7:
  outlet_o7 = 1;
  break;
}
outlet_out = n;
old[0] = inlet_i0;
old[1] = inlet_i1;
old[2] = inlet_i2;
old[3] = inlet_i3;
old[4] = inlet_i4;
old[5] = inlet_i5;
old[6] = inlet_i6;
old[7] = inlet_i7;

Variant: 2

Inlets

bool32.rising Input 0

bool32.rising Input 1

Outlets

int32 Output number

bool32 Output 0

bool32 Output 1

Attributes

combo default

Declaration
int32_t n;
int8_t old[2];
Init
n = attr_default;
old[0] = 0;
old[1] = 0;
Control Rate
if (!old[0] && inlet_i0) {
  n = 0;
} else if (!old[1] && inlet_i1) {
  n = 1;
}
outlet_o0 = 0;
outlet_o1 = 0;
switch (n) {
case 1:
  outlet_o0 = 1;
  break;
case 2:
  outlet_o1 = 1;
  break;
}
outlet_out = n;
old[0] = inlet_i0;
old[1] = inlet_i1;

Variant: 3

Inlets

bool32.rising Input 0

bool32.rising Input 1

bool32.rising Input 2

bool32.rising Input 3

bool32.rising Input 4

bool32.rising Input 5

bool32.rising Input 6

bool32.rising Input 7

Outlets

int32 Output number

Attributes

combo default

Declaration
int32_t n;
int8_t old[8];
Init
for (int i = 0; i < 8; i++) {
  old[i] = 0;
}
n = attr_default;
Control Rate
if (!old[0] && inlet_i0) {
  n = 0;
} else if (!old[1] && inlet_i1) {
  n = 1;
} else if (!old[2] && inlet_i2) {
  n = 2;
} else if (!old[3] && inlet_i3) {
  n = 3;
} else if (!old[4] && inlet_i4) {
  n = 4;
} else if (!old[5] && inlet_i5) {
  n = 5;
} else if (!old[6] && inlet_i6) {
  n = 6;
} else if (!old[7] && inlet_i7) {
  n = 7;
}
outlet_out = n;
old[0] = inlet_i0;
old[1] = inlet_i1;
old[2] = inlet_i2;
old[3] = inlet_i3;
old[4] = inlet_i4;
old[5] = inlet_i5;
old[6] = inlet_i6;
old[7] = inlet_i7;

Variant: 4

Inlets

bool32.rising Input 0

bool32.rising Input 1

bool32.rising Input 2

bool32.rising Input 3

Outlets

bool32 Output 0

bool32 Output 1

bool32 Output 2

bool32 Output 3

int32 Output number

Attributes

combo default

Declaration
int32_t n;
int8_t old[4];
Init
for (int i = 0; i < 4; i++) {
  old[i] = 0;
}
n = attr_default;
Control Rate
if (!old[0] && inlet_i0) {
  n = 0;
} else if (!old[1] && inlet_i1) {
  n = 1;
} else if (!old[2] && inlet_i2) {
  n = 2;
} else if (!old[3] && inlet_i3) {
  n = 3;
}
outlet_o0 = 0;
outlet_o1 = 0;
outlet_o2 = 0;
outlet_o3 = 0;
switch (n) {
case 0:
  outlet_o0 = 1;
  break;
case 1:
  outlet_o1 = 1;
  break;
case 2:
  outlet_o2 = 1;
  break;
case 3:
  outlet_o3 = 1;
  break;
}
outlet_out = n;
old[0] = inlet_i0;
old[1] = inlet_i1;
old[2] = inlet_i2;
old[3] = inlet_i3;

Variant: 5

Inlets

bool32.rising Input 0

bool32.rising Input 1

bool32.rising Input 2

bool32.rising Input 3

Outlets

int32 Output number

Attributes

combo default

Declaration
int32_t n;
int8_t old[4];
Init
for (int i = 0; i < 4; i++) {
  old[i] = 0;
}
n = attr_default;
Control Rate
if (!old[0] && inlet_i0) {
  n = 0;
} else if (!old[1] && inlet_i1) {
  n = 1;
} else if (!old[2] && inlet_i2) {
  n = 2;
} else if (!old[3] && inlet_i3) {
  n = 3;
}
outlet_out = n;
old[0] = inlet_i0;
old[1] = inlet_i1;
old[2] = inlet_i2;
old[3] = inlet_i3;

Variant: 6

Inlets

bool32.rising Input 0

bool32.rising Input 1

Outlets

int32 Output number

Attributes

combo default

Declaration
int32_t n;
int8_t old[2];
Init
n = attr_default;
old[0] = 0;
old[1] = 0;
Control Rate
if (!old[0] && inlet_i0) {
  n = 0;
} else if (!old[1] && inlet_i1) {
  n = 1;
}
outlet_out = n;
old[0] = inlet_i0;
old[1] = inlet_i1;

Privacy

© 2024 Zrna Research