HISE Logo Forum
    • Categories
    • Register
    • Login

    Hide preset browser when saving a preset.

    Scheduled Pinned Locked Moved Scripting
    13 Posts 3 Posters 752 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.
    • ThinkTankT
      ThinkTank
      last edited by

      So, ive been having a hard time with this.
      I am using a floating tile for the Preset Browser, and a button to hide/unhide it, which works.
      But how can i do the same with the build-in "Save preset" button?

      This does not work:

      const var FloatingTile1 = Content.getComponent("FloatingTile1");
      function onPresetSavedCallback()
      {
          // Logic to make the floating tile invisible
          FloatingTile1.set("visible", false);
      }
      
      // Set the post preset save callback to the function
      UserPresetHandler.setPostPresetSaveCallback(onPresetSavedCallback);
      

      Just throws a:
      Unknown function 'setPostPresetSaveCallback'

      Ive been trying to get chatGPT to help me, without any luck.

      Any help is appreciated!

      Without problems that test the limits of your abilities, you can not expand them.

      alhugA 1 Reply Last reply Reply Quote 0
      • alhugA
        alhug @ThinkTank
        last edited by

        @xxanx I think you need to define

        const UserPresetHandler = Engine.createUserPresetHandler();
        

        first and also the the function is

        .setPostSaveCallback()
        

        not setPostPresetSaveCallback

        "HISE is for software developers. If you're not one you must become one." - David Healy

        ThinkTankT 1 Reply Last reply Reply Quote 0
        • ThinkTankT
          ThinkTank @alhug
          last edited by ThinkTank

          @alhug said in Hide preset browser when saving a preset.:

          .setPostSaveCallback()

          Thanks,

          This seems to work, sort of (it closed the preset browser right away when clicking save preset):

          const var uph = Engine.createUserPresetHandler();
          
          uph.setPostSaveCallback(function()
          {
          
              // Logic to make the floating tile invisible after a preset is loaded
              FloatingTile1.set("visible", false);
             });
          

          However, the preset browser prompts the user the overwrite the preset, so its actually not working correctly. The preset browser still shows up when clicking "previous" or "next"

          Without problems that test the limits of your abilities, you can not expand them.

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

            @xxanx said in Hide preset browser when saving a preset.:

            The preset browser still shows up when clicking "previous" or "next"

            Do you have your show preset browser button set to saveInPreset enabled?

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

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

              @d-healey

              Yes, i do.
              But either way, the issue still persists.
              When i click previous or next buttons, and open the browser the "Overwrite prompt" is still there.

              Without problems that test the limits of your abilities, you can not expand them.

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

                @xxanx Each time you switch preset it's triggering that button and showing you your preset browser again :)

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

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

                  @d-healey

                  Thanks!
                  However if its on or off, the issue still persists.
                  When i click previous or next buttons, and click the browser button the "Overwrite prompt" is still there.

                  And "tempFileBeforeMove" shows up in the preset name text "label"

                  Without problems that test the limits of your abilities, you can not expand them.

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

                    @xxanx said in Hide preset browser when saving a preset.:

                    When i click previous or next buttons, and click the browser button the "Overwrite prompt" is still there.

                    I guess you've found an issue that the post save callback fires at the wrong time. @Christoph-Hart Can this be moved to fire after the confirmation?

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

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

                      @d-healey
                      I believe so yes, it should fire after the overwrite prompt.
                      I wonder if its possible to add a timer? (wait 1 second) before running it?
                      Just as a temporary quick fix.

                      Without problems that test the limits of your abilities, you can not expand them.

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

                        @xxanx Yeah you could do that

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

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

                          @d-healey

                          Still having issues with closing the preset browser when overwriting a preset, do you have an example of using a timer?

                          Without problems that test the limits of your abilities, you can not expand them.

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

                            @d-healey

                            This is what i have so far:
                            (rough code i think)

                            // SHOW AND HIDE PRESET BROWSER WITH BUTTON
                            const var FloatingTile1 = Content.getComponent("FloatingTile1");
                            const var Button1 = Content.getComponent("Button1");
                            Button1.setControlCallback(Button1CB);
                            
                            inline function Button1CB(control, value)
                            {
                                FloatingTile1.showControl(value);
                            };
                            
                            // Close Preset browser after save
                            const var uph = Engine.createUserPresetHandler();
                            
                            uph.setPostSaveCallback(function()
                            {
                                // Logic to make the floating tile invisible after a preset is saved
                                FloatingTile1.set("visible", false);
                                Button1.setValue(false); // Update the button state to match the FloatingTile visibility
                            });
                            
                            uph.setPostCallback(function()
                            {
                                // Logic to make the floating tile invisible after a preset is loaded
                                FloatingTile1.set("visible", false);
                                Button1.setValue(false); // Also update the button state here to ensure consistency
                            });
                            

                            Without problems that test the limits of your abilities, you can not expand them.

                            ThinkTankT 1 Reply Last reply Reply Quote 0
                            • ThinkTankT
                              ThinkTank @ThinkTank
                              last edited by ThinkTank

                              @xxanx

                              Figured it out.

                              In case anyone else wants a preset browser that kinda works, with opening and closing (with preset overwrite prompt)
                              heres my code:

                              // SHOW AND HIDE PRESET BROWSER WITH BUTTON
                              const var FloatingTile1 = Content.getComponent("FloatingTile1");
                              const var Button1 = Content.getComponent("Button1");
                              Button1.setControlCallback(Button1CB);
                              
                              inline function Button1CB(control, value)
                              {
                                  FloatingTile1.showControl(value);
                              };
                              
                              // Timer for handling delay after saving a preset
                              const var saveTimer = Engine.createTimerObject();
                              var saveTimerCounter = 0;
                              
                              saveTimer.setTimerCallback(function()
                              {
                                  if (saveTimerCounter > 0)
                                  {
                                      saveTimerCounter--;
                                      if (saveTimerCounter == 0)
                                      {
                                          FloatingTile1.set("visible", false);
                                          Button1.setValue(false);
                                          saveTimer.stopTimer();
                                      }
                                  }
                              });
                              
                              // Close Preset browser after save
                              const var uph = Engine.createUserPresetHandler();
                              
                              uph.setPostSaveCallback(function()
                              {
                                  saveTimerCounter = 1; // Set the counter for a brief delay
                                  saveTimer.startTimer(5500); // 500 milliseconds delay
                              });
                              
                              // Logic for handling preset loading (remains unchanged)
                              uph.setPostCallback(function()
                              {
                                  FloatingTile1.set("visible", false);
                                  Button1.setValue(false); 
                              });
                              

                              Without problems that test the limits of your abilities, you can not expand them.

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

                              19

                              Online

                              1.7k

                              Users

                              11.8k

                              Topics

                              102.7k

                              Posts