HISE Logo Forum
    • Categories
    • Register
    • Login

    store user preset to an object?

    Scheduled Pinned Locked Moved Scripting
    12 Posts 2 Posters 544 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.
    • ulrikU
      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 15.3.1, Xcode 16.2
      http://musikboden.se

      d.healeyD ulrikU 2 Replies Last reply Reply Quote 0
      • d.healeyD
        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

        ulrikU 1 Reply Last reply Reply Quote 1
        • ulrikU
          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 15.3.1, Xcode 16.2
          http://musikboden.se

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            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

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

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

              Hise Develop branch
              MacOs 15.3.1, Xcode 16.2
              http://musikboden.se

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

                @d-healey yes :)

                Hise Develop branch
                MacOs 15.3.1, Xcode 16.2
                http://musikboden.se

                d.healeyD 1 Reply Last reply Reply Quote 0
                • d.healeyD
                  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

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

                    @d-healey thank you!

                    Hise Develop branch
                    MacOs 15.3.1, Xcode 16.2
                    http://musikboden.se

                    1 Reply Last reply Reply Quote 0
                    • ulrikU
                      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 15.3.1, Xcode 16.2
                      http://musikboden.se

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

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

                        Hise Develop branch
                        MacOs 15.3.1, Xcode 16.2
                        http://musikboden.se

                        d.healeyD 1 Reply Last reply Reply Quote 0
                        • d.healeyD
                          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

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

                            @d-healey Nice :)

                            Hise Develop branch
                            MacOs 15.3.1, Xcode 16.2
                            http://musikboden.se

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

                            42

                            Online

                            1.7k

                            Users

                            11.7k

                            Topics

                            101.9k

                            Posts