string 4 caps

constant string
Author: Johannes Taelman
License: BSD
Github: rbrt/string/string 4 caps.axo

Inlets

bool32 caps

Outlets

charptr32 string

charptr32 text1

charptr32 text2

charptr32 text3

Attributes

table str0

table str1

table str2

table str3

Declaration
char c[4][20];

bool caps;
uint8_t start;
int8_t offset;
Init
strcpy(&c[0][0], "attr_str0");
strcpy(&c[1][0], "attr_str1");
strcpy(&c[2][0], "attr_str2");
strcpy(&c[3][0], "attr_str3");
Control Rate
outlet_text0 = &c[0][0];
outlet_text1 = &c[1][0];
outlet_text2 = &c[2][0];
outlet_text3 = &c[3][0];

if (inlet_caps != caps) {
  caps = inlet_caps;
  if (inlet_caps) {
    start = 97;
    offset = -32;
  } else {
    start = 65;
    offset = 32;
  }
  int ii;
  for (ii = 0; ii < 4; ii++) {
    int i;
    for (i = 0; i < 20; i++)
      if ((c[ii][i] >= start) && (c[ii][i] <= (start + 25)))
        c[ii][i] = c[ii][i] + offset;
  }
}

Privacy

© 2024 Zrna Research