FixObjectArray - already with the questions
-
So looking at using this ... but I need to save to disk and read these back, so can I just do this like "normal" array?
-
@Lindon no, this is not possible, but I can add a toBase64() / fromBase64() method that writes the entire memory range as tightly packed byte array. Do you need them to be human readable?
-
@Christoph-Hart said in FixObjectArray - already with the questions:
@Lindon no, this is not possible, but I can add a toBase64() / fromBase64() method that writes the entire memory range as tightly packed byte array. Do you need them to be human readable?
nope base64 would be fine...
-
There you go:
// Create an array with this memory layout const var fo = Engine.createFixObjectFactory({ "noteNumber": 1, "velo": 2, "somethingElse": 0 }); const var fa = fo.createArray(128); const var b64 = fa.toBase64(); // See that it uses 1536 bytes (4 bytes (int32) * 3 * 128) Console.print(b64); Console.assertTrue(fa[0].velo == 2); fa[0].velo = 900; Console.assertTrue(fa[0].velo == 900); const var ok = fa.fromBase64(b64); Console.assertTrue(ok); Console.assertTrue(fa[0].velo == 2);
-
@Christoph-Hart great thanks.