HISE Logo Forum
    • Categories
    • Register
    • Login

    Multiple instruments, single project or multiple projects?

    Scheduled Pinned Locked Moved General Questions
    94 Posts 3 Posters 22.2k 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.
    • d.healeyD
      d.healey
      last edited by

      Aha ok, same as before then :)

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

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

        I'm working with the storeAllControlsAsPreset and restoreAllControlsFromPreset functions but I'm getting a crash as soon as I try to restore. Any ideas?

        /**
         * Title: Preset Hander v1.0.0.js
         * Author: David Healey
         * Date: 02/07/2017
         * Modified: 03/07/2017
         * License: GPLv3 - https://www.gnu.org/licenses/gpl-3.0.en.html
        */
        
        //INIT
        const var save = Content.addButton("Save", 0, 0);
        const var load = Content.addButton("Load", 150, 0);
        
        //FUNCTIONS
        function savePreset()
        {
        	Content.storeAllControlsAsPreset("test");
        }
        
        function loadPreset()
        {
        	Content.restoreAllControlsFromPreset("test");
        }
        
        //CALLBACKS
        function onNoteOn()
        {
        }
        
        function onNoteOff()
        {
        }
        
        function onController()
        {
        }
        
        function onTimer()
        {
        }
        
        function onControl(number, value)
        {
        	switch(number)
        	{
        		case save:
        			number.setValue(0);
        			savePreset();
        		break;
        
        		case load:
        			number.setValue(0);
        			loadPreset();
        		break;
        	}
        }
        

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

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

          You are storing the widget that calls the restore function in the preset. This causes an endless loop because it will load the preset on the onControl callback, fire the onControl callback, load the preset on the onControl callback, fire the onControl callback, load the preset on the onControl callback, fire the onControl callback, load the preset on the onControl callback, fire the onControl callback, load the preset on the onControl callback, fire the onControl callback, load the preset on the onControl callback, fire the onControl callback, load the preset on the onControl callback, fire the onControl callback, load the preset on the onControl callback :)
          This can be solved by setting saveInPreset to false for both buttons. (I thought about adding a safety measure that prevents this loop, but there was no easy solution and this is the kind of error that you'll only do once.

          Also you need to give it a file extension (the HISE default extension for user presets is .preset) - and the number widget is not defined, which causes a script error.

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

            Thanks Christoph, that makes total sense - you are right, I will not make that mistake twice :p

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

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

              After I saved a user preset with Content.storeAllControlsAsPreset("Bank 1/Category 1/test.preset"); I then click to load it from the preset browser and I get the prompt "This User Preset Was Built With a Previous Version. Do you want to update it?" - am I missing a setting somewhere?

              Also is there a way to get the ID of the current script (self)? I want to save the state of all scripts but I can't reference the script I'm in, my current solution is to ignore midi processors with a particular ID but I have to hard code that ID to be the same as the MIDI processor and I would like it to be more generic if it could just know its own ID.

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

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

                Can you post the .preset file, then I'll take a look.

                I need to rewrite the preset system a bit to make sure you can store multiple scripts - I added this feature long time ago but it never got used so it's a bit abandoned. With the new layout stuff and the possibility to include script interfaces within other script interfaces, it might become interesting again.

                But actually you don't need to retrieve the ID of the script, the preset is a XML file that has a child element for each script that gets automatically resolved using the ID.

                Oh, and Happy Birthday!

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

                  Thank you!

                  I've uploaded the preset file here - http://www.filedropper.com/preset10

                  I've almost got a fully working factory preset saving system that saves all modules, effects, synths, and processors :)

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

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

                    I see a new saveUserPreset() function has appeared. What is the difference between this and storeAllControlsAsPreset()?

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

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

                      Actually it is pretty similar. I am simplificating the user preset interaction with the scripting engine and this new method opens a dialog, asks for a name and saves the preset automatically (the exact same function as the "Save preset button in the old top bar).

                      It might be possible that the storeAllControlsAsPreset will be deprecated soon, so I would bet on the other function if I were you :)

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

                        Ah, actually I found out what's wrong with your preset: You exported just the script as preset, while an actual user preset contains a wrapper element around this with the version number and so on.

                        Idiotic stuff like this is exactly why I am rewriting the preset system :)

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

                        53

                        Online

                        1.7k

                        Users

                        11.7k

                        Topics

                        102.1k

                        Posts