HISE Logo Forum
    • Categories
    • Register
    • Login

    FixObjectArray - already with the questions

    Scheduled Pinned Locked Moved General Questions
    5 Posts 2 Posters 168 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • LindonL
      Lindon
      last edited by

      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?

      HISE Development for hire.
      www.channelrobot.com

      Christoph HartC 1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @Lindon
        last edited by

        @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?

        LindonL 1 Reply Last reply Reply Quote 1
        • LindonL
          Lindon @Christoph Hart
          last edited by

          @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...

          HISE Development for hire.
          www.channelrobot.com

          Christoph HartC 1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart @Lindon
            last edited by

            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);
            
            LindonL 1 Reply Last reply Reply Quote 2
            • LindonL
              Lindon @Christoph Hart
              last edited by

              @Christoph-Hart great thanks.

              HISE Development for hire.
              www.channelrobot.com

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              35

              Online

              1.7k

              Users

              11.8k

              Topics

              102.7k

              Posts