HISE Logo Forum
    • Categories
    • Register
    • Login

    More problems with saving data in panels - must be me can someone please define the rules...

    Scheduled Pinned Locked Moved General Questions
    23 Posts 4 Posters 923 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 Lindon

      The simplest of examples (I have set Panel1 to saveOnPreset)

      Content.makeFrontInterface(600, 500);
      
      const var Panel1 = Content.getComponent("Panel1");
      
      
      Panel1.setValue({a:123});
      var reloaded = "none";
      Console.print("0:    " + trace(Panel1.getValue()));
      
      
      inline function onPanel1Control(component, value)
      {
      	Console.print("1:" + trace(Panel1.getValue()));
      	reloaded = Panel1.getValue();
      };
      
      Content.getComponent("Panel1").setControlCallback(onPanel1Control);
      
      
      inline function onButton1Control(component, value)
      {
      	//
      	Console.print("2:" + trace(Panel1.getValue()));
      	Console.print("3:" + reloaded);
      };
      
      Content.getComponent("Button1").setControlCallback(onButton1Control);
      

      it seems to correctly load {a:123} on init then immediately lose it....the above produces this output in the console:

      Interface: 0: {
      "a": 123
      }
      Interface: 1:0.0
      Interface: 2:0.0
      Interface: 3:0

      All i'm trying to do is store an object in the panel and recall it on init or on preset load. I know I can do this wiht teh data but i was really looking for a simpler approach...

      HISE Development for hire.
      www.channelrobot.com

      ustkU 1 Reply Last reply Reply Quote 0
      • ustkU
        ustk @Lindon
        last edited by ustk

        @Lindon You need to enable saveInPreset for the panel to recall with presets...
        You mentioned it, but it is not possible with data (aka panel.data.stuff) because it is volatile... Only the value stays as long as you enable save in preset
        You don't need to use the "reloaded" variable, just treat the panel value object as any value

        Content.makeFrontInterface(600, 500);
        Console.clear();
        
        const var Panel1 = Content.getComponent("Panel1");
        const var Label1 = Content.getComponent("Label1");
        
        Panel1.setValue({a:123});
        
        
        inline function onPanel1Control(component, value)
        {
        	Console.print("1:" + trace(component.getValue()));
        	Label1.set("text", value.a);
        };
        Content.getComponent("Panel1").setControlCallback(onPanel1Control);
        
        
        

        Can't help pressing F5 in the forum...

        LindonL 1 Reply Last reply Reply Quote 0
        • LindonL
          Lindon @ustk
          last edited by

          @ustk said in More problems with saving data in panels - must be me can someone please define the rules...:

          @Lindon You need to enable saveInPreset for the panel to recall with presets...

          Please read line 1 of my post.

          You mentioned it, but it is not possible with data (aka panel.data.stuff) because it is volatile... Only the value stays as long as you enable save in preset

          see above.

          You don't need to use the "reloaded" variable, just treat the panel value object as any value

          Content.makeFrontInterface(600, 500);
          Console.clear();
          
          const var Panel1 = Content.getComponent("Panel1");
          const var Label1 = Content.getComponent("Label1");
          
          Panel1.setValue({a:123});
          
          
          inline function onPanel1Control(component, value)
          {
          	Console.print("1:" + trace(component.getValue()));
          	Label1.set("text", value.a);
          };
          Content.getComponent("Panel1").setControlCallback(onPanel1Control);
          
          
          

          HISE Development for hire.
          www.channelrobot.com

          ustkU 1 Reply Last reply Reply Quote 0
          • ustkU
            ustk @Lindon
            last edited by

            @Lindon Oups sorry I thought you haven't enabled saveInPreset but it wasn't a snippet so... my bad 😇
            Is it working for you now?

            Can't help pressing F5 in the forum...

            LindonL 1 Reply Last reply Reply Quote 0
            • LindonL
              Lindon @ustk
              last edited by

              @ustk no its not otherwise I woudnt be posting it - basically its a bug I think - it allows you to setValue() - then getValue() that but then fails elsewhere. So its not consistent.

              HISE Development for hire.
              www.channelrobot.com

              ustkU 2 Replies Last reply Reply Quote 0
              • ustkU
                ustk @Lindon
                last edited by ustk

                @Lindon Honestly seeing your code I don't get where it doesn't work. It seems good to me.
                I am working with huuuge 3D objects blended with arrays in panel's value and it works like a charm.
                What about my code on your side?

                But in fact, I might see the problem but not sure... It might come from the fact that component types are not recalled at the same time. I don't remember the order, but if the button is recalled before the panel, there's no value to print... Although the "1:" should recall anyway...

                Once you have set an object as the value, it is available all the time from everywhere like any other "simple" value so I don't see why it doesn't work for you.
                EDIT: it doesn't work here neither... Investigating...

                Can't help pressing F5 in the forum...

                1 Reply Last reply Reply Quote 0
                • ustkU
                  ustk @Lindon
                  last edited by

                  @Lindon Ok same issue I had in the past
                  You can't assign the value at init, but with a method that checks if the value is already an object or not:

                  Content.makeFrontInterface(600, 500);
                  Console.clear();
                  
                  const var Panel1 = Content.getComponent("Panel1");
                  
                  var obj = {a:123};
                  
                  var reloaded = "none";
                  Console.print("0: " + trace(Panel1.getValue()));
                  
                  inline function onPanel1Control(component, value)
                  {
                  	Console.print("1: " + trace(Panel1.getValue()));
                  	reloaded = Panel1.getValue();
                  };
                  
                  Content.getComponent("Panel1").setControlCallback(onPanel1Control);
                  
                  inline function onButton1Control(component, value)
                  {
                      if (typeof Panel1.getValue() != "object"){
                          Panel1.setValue(obj);
                      }
                      
                  	Console.print("2: " + trace(Panel1.getValue()));
                  	Console.print("3: " + reloaded);
                  };
                  Content.getComponent("Button1").setControlCallback(onButton1Control);
                  

                  Can't help pressing F5 in the forum...

                  LindonL 1 Reply Last reply Reply Quote 0
                  • LindonL
                    Lindon @ustk
                    last edited by

                    @ustk no... this is not what is required either.

                    I'm looking for a simple way to set a value in a panel, have it save in the instrument, then recall it in another event (an onButton event) - an event that has no other access to the object - I need it to get the value out of the panel.

                    I want to be able to dynamically change the value of the panel, and have it save in the preset and be available next time the instrument starts. I need persistent data, not programmed data..

                    HISE Development for hire.
                    www.channelrobot.com

                    lalalandsynthL 1 Reply Last reply Reply Quote 0
                    • lalalandsynthL
                      lalalandsynth @Lindon
                      last edited by

                      @Lindon if i understand correctly then this is exactly what i need to achieve...following.

                      https://lalalandaudio.com/

                      https://lalalandsynth.com/

                      https://www.facebook.com/lalalandsynth

                      https://www.facebook.com/lalalandsynth

                      LindonL 1 Reply Last reply Reply Quote 0
                      • d.healeyD
                        d.healey
                        last edited by d.healey

                        Have you tried the persistent data library in my framework?
                        Example Project.zip

                        Libre Wave - Freedom respecting instruments and effects
                        My Patreon - HISE tutorials
                        YouTube Channel - Public HISE tutorials

                        1 Reply Last reply Reply Quote 0
                        • LindonL
                          Lindon @lalalandsynth
                          last edited by

                          @lalalandsynth said in More problems with saving data in panels - must be me can someone please define the rules...:

                          @Lindon if i understand correctly then this is exactly what i need to achieve...following.

                          OK well in some ways this is ugly (but thats my opinion only I think) but here it is in a simple example working...

                          HiseSnippet 1466.3ocsX0uaaaCDmJIps1adXEaO.D9urwxbj+JsMEcyKeUj00Di5thsALzRKQayFYROI5jFDDf7nrGk9Hs2fsiTRVzN1xIFKJ.wl73c+9w6Nd9nZGHboggh.jUt2dwHJx5Ks6bAWNXuADFGcz9HqGYKogRm5ncuXDILj5grrV+kJoV41.oe9mebWhOg6RSmBgdmf4R+E1PlLc11sdEy2+PhG8srgFqtQqibE78D9hw.SV21AMh3dJoO8XhZYqYirdvAdLoHnij.zAYswtBuK5LPbNOZ8uiEx55SUCph5.FJZ5CE9dJFqlEs2.luW6jcbHBrR6z8+5Q6+u090LO1j4S8CesV.NUCS+g0ZYQuplzy41SOKC5sQD8drcG2.1HYpDE29B6i3RZPOBDBLoUzZQq0Mm8dBXEbYkgjSoGF.ClnQoscb1D2zwo7yKjuPdHPDJwmQBvsIbpeU7KvI51mJ2SLbjfCCJULRbQkVQesRnRNWFH72i362EBgkD7HYwyqVbJ.uhK5tX6qkpMu9ay25ZQy036NVJE7Ea9X4Z.h+97gHVXFfTaIfTy.jZYARsL.o9R.otAH0yBj5Ffn9SAwvKNo6GA.t7J8jasEFL.VNfhGoBegXQ2ORciloGK.HlDN.iomQCvDtGlG8s9vgkJUpTHOi6y3vRGyckLAGmfciXrK4lP+Mgsn+XZ4B4urP9brdkRFhgG0TpO8EtDeEGTTjriylc2ooylt6T0wQQX8ZRyAemxBkfUq1gJQWE+I.dnvmVYT.S425PkRFue51LhJXoXmh3uCKCTGNhMa+DyVtrxpQtorBGMJVNqfPioBBf+1WP7LXRr+FbcLNSt.e5TGsVjKcqsf+kDe0BTdr45PdCUFvnmMGehgCIx1oNgEGrWNyRRxNENECt8X+unGlnyEvyMYXR0fn.hdqUgT94SI1c.g2m5UZRJfdOGw3Ew2ZqNe6NCeykIY6tbxlMSqu5L08NwT2aKSWTlfY84Ey1yGP43XaiCni7gDMM8mPa0.2wAAfxPoIep19waEI7KivRhyweAtXzgmho4M33G0pSp0mdhFToZ4zEodhSpLNwbSST61XhtYZh52FS3dyysyqdmdwlo6pOMCOKJYp4RBOyTjnsQkRV3+CUJalckxlSUozf8GKjzS3kJm+x74xeUd7rh50atxhMmOMXthUMlFjkhk3iG1kFj3iRVHzg1zs.Zu3V.M6P0MxyXrPA+Hnj+Iin7E0XHJ1cBsHZGyJXoRcCheUbChc7Ydz.DC5C7g15SgHMgAUrz8bOqhER5rTEF058H6nPZhh+f8O24jiurHo3NXniwhcgOqWqxSdl5oV8m3rsSylv7tv7a2rRU0za+rFOsViZUe1U2DwDpFEm0PlyN93YBloWw3tndskrWyP05yn5udz9DIQ0LdrSGBDinARlJFasO7qktznVyyYuOM7ToXDjJLIIGryRiKeJcaNr0ESFb8AsFRLj86sPFl8gKMpkp506aX1O+msNm4IGLYh+95VCnr9CRum10+QqPxYzi3sCnvIynzPq0MP+A2hHnA0eoA9n8aMhnpiaXtIbNf3wDuLPLdzLg96.x0L24LSG58Mx0MP9Cmah7g2yH2v.4OyMi1+0LgR3H.8SR8EIgVDhJlqqWitaH1bQH9AYqHD9F61pewXJLlkKnadCW3d1Buw9D4zW9V8FGhE.kim5VtpaxxCYxKL8e2K2H+1R2Ga2lIcGLe9t1b3KTe49luwueiB1GzqGzcTJY2v9ve69+kYfdiXr51Vul.2w.RcrOd7vNhwAtTfIb0cLUkbWSUrNZrSRI3NTtmdv+BOwBqpFaEKrZhPzPhaf38tQU6UuAkGomA3DW+hjxY+Z0Xb5uEZ6TwAMj4wduqqxU78.2muN0VAcpuB5zXEzo4Jny1qfNOYEz4oYpi5cp8SikhgQGSfIZef9GbsrNfSfrLcFI5+vimIeM
                          

                          HISE Development for hire.
                          www.channelrobot.com

                          lalalandsynthL 1 Reply Last reply Reply Quote 0
                          • lalalandsynthL
                            lalalandsynth @Lindon
                            last edited by

                            @Lindon Awesome ! This works perfectly !
                            Personally I would need this to switch between 3 Knobs with each button - Button 1/Knob1 etc .
                            Think I see a way to do that, sweet , testing !

                            https://lalalandaudio.com/

                            https://lalalandsynth.com/

                            https://www.facebook.com/lalalandsynth

                            https://www.facebook.com/lalalandsynth

                            LindonL 1 Reply Last reply Reply Quote 0
                            • LindonL
                              Lindon @lalalandsynth
                              last edited by

                              @lalalandsynth well I need it to switch a set of around 20 controls, so I define an object that holds each of the 20 control values and use that in the place of "obj" in the code.

                              HISE Development for hire.
                              www.channelrobot.com

                              lalalandsynthL 1 Reply Last reply Reply Quote 1
                              • lalalandsynthL
                                lalalandsynth
                                last edited by

                                Isnt there a problem if you want to automate this knob ? Would it automate the value for the Button selected or ?

                                https://lalalandaudio.com/

                                https://lalalandsynth.com/

                                https://www.facebook.com/lalalandsynth

                                https://www.facebook.com/lalalandsynth

                                LindonL 1 Reply Last reply Reply Quote 0
                                • LindonL
                                  Lindon @lalalandsynth
                                  last edited by

                                  @lalalandsynth - automate the knob? it would just spend some time saving its value into the panel as it moved, so depends on the frequency of your automation and the amount you are doing in the knob call back.

                                  The knob call back doesnt call any of the button callbacks...

                                  HISE Development for hire.
                                  www.channelrobot.com

                                  1 Reply Last reply Reply Quote 1
                                  • lalalandsynthL
                                    lalalandsynth
                                    last edited by

                                    Strangely , when I mess with the code a bit , break it :) and then reload the snippet it gives me this error.
                                    Line 56, column 20: API call with undefined parameter 0

                                    I have to close and reopen HISE, reload snippet?

                                    https://lalalandaudio.com/

                                    https://lalalandsynth.com/

                                    https://www.facebook.com/lalalandsynth

                                    https://www.facebook.com/lalalandsynth

                                    1 Reply Last reply Reply Quote 0
                                    • lalalandsynthL
                                      lalalandsynth @Lindon
                                      last edited by

                                      @Lindon said in More problems with saving data in panels - must be me can someone please define the rules...:

                                      so I define an object that holds each of the 20 control values and use that in the place of "obj" in the code.

                                      Can you explain a bit more if you have time ?
                                      I was trying to just duplicate the code, name it myObj2 , knob 2 to have it work for more then one knob .

                                      https://lalalandaudio.com/

                                      https://lalalandsynth.com/

                                      https://www.facebook.com/lalalandsynth

                                      https://www.facebook.com/lalalandsynth

                                      LindonL 1 Reply Last reply Reply Quote 0
                                      • LindonL
                                        Lindon @lalalandsynth
                                        last edited by

                                        @lalalandsynth

                                        so theres an object in there:

                                        obj = {a:0,b:50,c:100};

                                        its holding 3 values for knob01,

                                        you want to hold values for more than one knob...

                                        obj = {
                                        a1:0,
                                        b1:50,
                                        c1:100,
                                        a2:25,
                                        b2:75,
                                        c2:99
                                        }

                                        So all I'm doing in this simple example is increasing the number of values held in obj - in fact what I actually do is declare another object - lets call it VoiceObj - this has attributes for each of the 20 different things I want to record - so I create one for each "snapshot" I want to make (in the example case 3 - one for each button) -

                                        so

                                        voice1 = {.....stuff in here};
                                        voice2 = {.....stuff in here};
                                        voice3 = {.....stuff in here};

                                        obj= {
                                        snap1:voice1,
                                        snap2:voice2,
                                        snap3:voice3
                                        };

                                        HISE Development for hire.
                                        www.channelrobot.com

                                        1 Reply Last reply Reply Quote 1
                                        • lalalandsynthL
                                          lalalandsynth
                                          last edited by lalalandsynth

                                          @Lindon said in More problems with saving data in panels - must be me can someone please define the rules...:

                                          ributes for each of the 20 different things I want to record - so I create one for each "snapshot" I want to make (in the example case 3 - one for each

                                          Thanks, looking at that .
                                          Whenever I try and edit the code , even though I undo I get that error when pushing the knob ,even when I open the snippet again. I guess you dont encounter that problem ? Strange .

                                          https://lalalandaudio.com/

                                          https://lalalandsynth.com/

                                          https://www.facebook.com/lalalandsynth

                                          https://www.facebook.com/lalalandsynth

                                          LindonL 1 Reply Last reply Reply Quote 0
                                          • LindonL
                                            Lindon @lalalandsynth
                                            last edited by

                                            @lalalandsynth - you need to save the initial state. so open the snippet, move the knob, and save the snippet.

                                            HISE Development for hire.
                                            www.channelrobot.com

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

                                            57

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            101.8k

                                            Posts