Forum

    • Register
    • Login
    • Search
    • Categories

    store user preset to an object?

    Scripting Forum
    2
    12
    172
    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.
    • ulrik
      ulrik last edited by

      Is it possible to store "saveUserPreset()" as a temporary object instead of a file? for later use..

      Like store the state of all components?

      Hise Develop branch
      MacOs 12.4, Xcode 13.0
      http://musikboden.se

      d.healey ulrik 2 Replies Last reply Reply Quote 0
      • d.healey
        d.healey @ulrik last edited by

        @ulrik You could do this. Won't work for tables though.

        const myObj = {};
        
        for (c in Content.getAllComponents(""))
        	myObj[c.get("id")] = c.getValue();
        

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

        ulrik 1 Reply Last reply Reply Quote 1
        • ulrik
          ulrik @ulrik last edited by

          @ulrik I tried using an array to push all .getValue() and .setValue() but it gets tricky when there are slider packs involved....

          It is over 200 components

          Hise Develop branch
          MacOs 12.4, Xcode 13.0
          http://musikboden.se

          d.healey 1 Reply Last reply Reply Quote 0
          • d.healey
            d.healey @ulrik last edited by

            @ulrik Are you trying to make an a/b system?

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

            ulrik 1 Reply Last reply Reply Quote 0
            • ulrik
              ulrik @d.healey last edited by

              @d-healey Yes it won't work with all components

              Hise Develop branch
              MacOs 12.4, Xcode 13.0
              http://musikboden.se

              1 Reply Last reply Reply Quote 0
              • ulrik
                ulrik @d.healey last edited by

                @d-healey yes 🙂

                Hise Develop branch
                MacOs 12.4, Xcode 13.0
                http://musikboden.se

                d.healey 1 Reply Last reply Reply Quote 0
                • d.healey
                  d.healey @ulrik last edited by

                  Maybe start here - https://forum.hise.audio/topic/1197/a-b-comparison

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

                  ulrik 2 Replies Last reply Reply Quote 1
                  • ulrik
                    ulrik @d.healey last edited by

                    @d-healey thank you!

                    Hise Develop branch
                    MacOs 12.4, Xcode 13.0
                    http://musikboden.se

                    1 Reply Last reply Reply Quote 0
                    • ulrik
                      ulrik @d.healey last edited by

                      @d-healey I used getAllComponents that has saveInPreset enabled, get and set values for all components except type == "ScriptSliderPack"

                      It works ok but it miss all changes made in SliderPacks 😞

                      Hise Develop branch
                      MacOs 12.4, Xcode 13.0
                      http://musikboden.se

                      ulrik 1 Reply Last reply Reply Quote 0
                      • ulrik
                        ulrik @ulrik last edited by

                        @ulrik it would be great if the "Content.restoreAllControlsFromPreset()" was working

                        Hise Develop branch
                        MacOs 12.4, Xcode 13.0
                        http://musikboden.se

                        d.healey 1 Reply Last reply Reply Quote 0
                        • d.healey
                          d.healey @ulrik last edited by

                          @ulrik

                          for (c in Content.getAllComponents(""))
                          {
                          	if (c.get("type") == "ScriptSliderPack")
                          	{
                          		var values = [];
                          
                          		for (j = 0; j < c.getNumSliders(); j++)
                          			values.push(c.getSliderValueAt(j));
                          			
                          		myObj[c.get("id")] = values;
                          	}
                          	else
                          	{
                          		myObj[c.get("id")] = c.getValue();	
                          	}	
                          }
                          

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

                          ulrik 1 Reply Last reply Reply Quote 1
                          • ulrik
                            ulrik @d.healey last edited by

                            @d-healey Nice 🙂

                            Hise Develop branch
                            MacOs 12.4, Xcode 13.0
                            http://musikboden.se

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

                            4
                            Online

                            851
                            Users

                            5.7k
                            Topics

                            52.9k
                            Posts