• Isadora
  • Get it
  • Forum
  • Help
  • ADD-ONS
  • Newsletter
  • Impressum
  • Dsgvo
  • Impressum
Forum
    • Categories
    • Recent
    • Popular
    • Tags
    • Register
    • Login

    Toggles - JSONs, recalling patch states and updating buttons.

    How To... ?
    1
    3
    101
    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.
    • J
      jtsteph
      last edited by jtsteph

      Hello,

      I am working on another build of a show that is an ongoing project. I am using JSON to communicate midi information across the patch to several sub patches. I learned this technique a few years ago from @DusX and @Woland . It allows me to snapshot the current state of the patch, with its many user actors, for later recall of all of my effects states and buttons.

      I am stuck on how to deal with storing and recalling toggle states.


      Currently I am planning to use a global variables to flag which buttons are toggles and which are just triggers. When I recall a snapshot, I would like to send all of the values of the JSON to the various user actors containing effects, clip selectors and to update the dial information and button states on my Streamdecks including toggle states. The trick is I don't want to init to off and then reset the toggles based on the logic. I will be using this not only to save snapshots, but to update button statuses when I change profiles on the Streamdeck (because of the 10 page limit). In this case, initing to off would interrupt my patch.

      I have a good handle on sending of dial values to my controllers and user actors, but am a bit uncertain as to how to ensure that the toggles are in the correct state.

      My logic is: 

      - if the Global Value for the button is set to 1 (toggle-able) and the recalled JSON value is 127, then set the toggle to on.

      - if the Global Value for the button is set to 1 (toggle-able) and the recalled JSON value 0, then set the toggle to off

      - if the Global Value for the button is set to 0 (not a toggle IE a dial), then pass the JSON value.

      As I write this out, it perhaps makes good sense to use Javascript here?

      Anyways. I wonder what others might be doing to solve this issue.

      Thanks.

      W11 PRO 13700K (in a 4U case), 128GB RAM, 4 Lane M.2 Storage, RTX 3090, Behringer UMC404HD audio interface, Streamdeck XL, Stremdeck +, KorgNano Kontrol2, Izzy 3.26 USB
      Website: http://justinstephenson.com

      J 2 Replies Last reply Reply Quote 1
      • J
        jtsteph @jtsteph
        last edited by jtsteph

        Javascript for the initial win. I did this and it works. I will see if I can do it with actors now. t_flag = toggle flag and v_out = value out. I wonder if it will hamper performance if I have hundreds of these. Do they only activate on changes or are they always running?

        Oops spoke too soon. This will not turn the toggle off and on. More work!

        // iz_input 1 "value"
        // iz_input 2 "t_flag"
        // iz_output 1 "output 1"

        function main()
        {
        let v_out = arguments[0];
        let t_flag = arguments[1];

        if (v_out==127 && t_flag ==1) {
            v_out=127;}
            else {
            v_out=0; }
        if (t_flag == 0){
            v_out=arguments[0];}

           
            return v_out;
        }

        J

        W11 PRO 13700K (in a 4U case), 128GB RAM, 4 Lane M.2 Storage, RTX 3090, Behringer UMC404HD audio interface, Streamdeck XL, Stremdeck +, KorgNano Kontrol2, Izzy 3.26 USB
        Website: http://justinstephenson.com

        1 Reply Last reply Reply Quote 0
        • J
          jtsteph @jtsteph
          last edited by jtsteph

          Well I was certainly making things more complex than I needed to. I ended up using the controller's toggle function, storing all controller values in the JSON and when recalling the JSON sending the controller values back to the controller. This activates the toggle and will set the effects to the correct state...when I get to that stage of the build.

          KISS principal applied.

          W11 PRO 13700K (in a 4U case), 128GB RAM, 4 Lane M.2 Storage, RTX 3090, Behringer UMC404HD audio interface, Streamdeck XL, Stremdeck +, KorgNano Kontrol2, Izzy 3.26 USB
          Website: http://justinstephenson.com

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