Forum

    • Register
    • Login
    • Search
    • Categories

    Autoplay Preset

    General Questions
    3
    12
    85
    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.
    • DanH
      DanH last edited by

      Had a request for an 'autoplay' feature for when users flick through presets, i.e everytime you load a new preset it plays a note. I'm thinking timer plus midi script. Any better ideas?

      It would also need to be optional / switchable.

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

        @DanH make a button that doesn't save with preset (you can save it manually using the file system and make your own pref file if you need), and use the preset handler setPostCallback to do what you want

        Tired to press F5 in the forum...
        Studio427 Audio - Audio Instruments & FX Plugins for music production. Website - Facebook

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

          @ustk ah yes, thanks.

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

            @ustk I'm getting into a bit of a muddle trying to execute this... IS this the right kind of path? It's making my project crash when changing preset so something is triggering 😆 @d-healey

            const var myPresetHandler = Engine.createUserPresetHandler();
            
            inline function autoplay(//is something meant to go in here?)
            {
            	Console.print("hi");
            }
            myPresetHandler.setPostCallback(autoplay);
            

            https://docs.hise.audio/scripting/scripting-api/userpresethandler/index.html

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

              @DanH

              You can't use an inline function as a callback, it has to be a standard function.

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

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

                @d-healey so like:

                myPresetHandler.setPostCallback(function(autoplay)
                {
                	
                });
                
                d.healey 1 Reply Last reply Reply Quote 0
                • d.healey
                  d.healey @DanH last edited by

                  @DanH The function doesn't take a parameter.

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

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

                    @d-healey

                    myPresetHandler.setPostCallback(function()
                    {
                    	
                    });
                    

                    ? And how would I call it from a button callback?

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

                      @DanH

                      A callback is a response to an event. The on note on callback is triggered when a note on message is received, a button callback is triggered when the button is clicked, a mouse callback is triggered when you interact with a panel using the mouse.

                      The setPostCallback is trigged post (after) a preset has been loaded. You don't need to call it manually.

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

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

                        @d-healey oh yep so I should use an if statement like if my button is on then do this...

                        Out of interest I'm still using a method of yours which involves a knob to update the preset name in a label from way back when - I'm assuming this was pre these functions and I'm probably better off using these new functions?!

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

                          @DanH said in Autoplay Preset:

                          @d-healey oh yep so I should use an if statement like if my button is on then do this...

                          Yeah

                          Out of interest I'm still using a method of yours which involves a knob to update the preset name in a label from way back when - I'm assuming this was pre these functions and I'm probably better off using these new functions?!

                          Maybe, different situations call for different methods. See what works 🙂

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

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

                            @d-healey ok thank you! 🙂

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

                            19
                            Online

                            742
                            Users

                            5.4k
                            Topics

                            50.4k
                            Posts