scroll

string scroller
Author: Smashed Transistors
License: LGPL
Github: tiar/string/scroll.axo

Inlets

int32 offset

charptr32 in

Outlets

charptr32 string

Declaration
char out[12];
Init
out[11] = '\0';
Control Rate
// lets find the length of the input string
// max length is 80 chars
int len = 80;
for (int i = 0; i < 80; i++) {
  if (inlet_in[i] == '\0') {
    len = i;
    break;
  }
}
for (int i = 0; i < 11; i++) {
  int j = i + inlet_offset;
  out[i] = j >= 0 && j < len ? inlet_in[j] : ' ';
}
outlet_out = out;

Privacy

© 2024 Zrna Research