HISE Logo Forum
    • Categories
    • Register
    • Login

    Restore global cable's last data on DAW load

    Scheduled Pinned Locked Moved Scripting
    3 Posts 2 Posters 53 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.
    • iamlampreyI
      iamlamprey
      last edited by iamlamprey

      Another edge case, I'm manually implementing NAM and using a scriptPanel drop callback to pass the file to the node via a Global Cable. It works perfectly fine in a DAW, but if I save/load the project it doesn't restore the model path:

      inline function sendNAMCableData()
      {
      	local path = pnlAmpNAMLoader.get("text");
          local file = FileSystem.fromAbsolutePath(path);
          local json = file.loadAsObject();
          namCable.sendData(json);
      }
      
      inline function pnlAmpNAMLoaderDrop(f)
      {
          if(f.drop)
          {
              pnlAmpNAMLoader.set("text", f.fileName);
              sendNAMCableData();
              pnlAmpNAMLoader.repaint();
          }
      } 
      

      I've tried calling this sendNAMCableData() on init (at the end) like this:

      if (isDefined(Amp.namCable) && isDefined(Amp.pnlAmpNAMLoader))
      	Amp.sendNAMCableData();function onNoteOn() // nope
      

      I can only assume the cable and/or the panel isn't defined yet, is there a way to force the cable to re-send the data on DAW reload, or just save the data inside the cable somehow?

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

        @iamlamprey the global cables don't have a persistent data model so you need to implement this on your own - the simplest solution would be a hidden panel that stores a JSON that contains the global cable value (and is updated asynchronously when the cable changes).

        iamlampreyI 1 Reply Last reply Reply Quote 0
        • iamlampreyI
          iamlamprey @Christoph Hart
          last edited by

          @Christoph-Hart Lol was compiling exactly that as you posted, working now 🙂

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

          30

          Online

          2.0k

          Users

          12.7k

          Topics

          110.0k

          Posts