save load table area

saves an area of a table,specified by 'start' and 'length' , to SD-card. OR,loads a file from SD-card to a position specified by 'offset'.
Author: Robert Schirmer
License: GPL
Github: rbrt/SD/save load table area.axo

Inlets

charptr32 filename

bool32.rising save

bool32.rising load

int32.positive start

int32.positive length

int32.positive offset

Outlets

None

Attributes

objref table

objref SDapi

Declaration
bool trig;
Control Rate
if (inlet_load && !trig) {
  trig = 1;
  int filesize = attr_SDapi.fsize(inlet_filename);
  int dstsize = (attr_table.LENGTH - inlet_offset) * sizeof(*attr_table.array);
  int rem_sz = (filesize > dstsize) ? dstsize : filesize;
  attr_SDapi.fload(inlet_filename, (char *)&attr_table.array[inlet_offset],
                   rem_sz);
}
if (inlet_save && !trig) {
  trig = 1;
  int rem_sz = inlet_length * sizeof(*attr_table.array);
  attr_SDapi.fsave(inlet_filename, (char *)&attr_table.array[inlet_start],
                   rem_sz);
}

if (!inlet_load && !inlet_save)
  trig = 0;

Privacy

© 2024 Zrna Research