HISE Logo Forum
    • Categories
    • Register
    • Login

    Post init callback

    Scheduled Pinned Locked Moved Feature Requests
    23 Posts 4 Posters 836 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 d.healey

      I have need to trigger some components in my secondary scripts from my main interface script at init. The problem is the init function of the main script triggers before all of the other scripts are initialiased. My current solution is to use a timer in the main script to delay this action but this is imprecise.

      A better way I think would be to have a post init callback that triggers after everything (not just the main script) is ready.

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

      ustkU 2 Replies Last reply Reply Quote 2
      • ustkU
        ustk @d.healey
        last edited by ustk

        @d-healey That would be nice to have indeed...

        In the waiting, what if you do the opposite? check from the secondary scripts the state of the interface script components?

        Or even a script at the end of the "script chain", so it is the last one to be triggered and checks for everything that you need? I never tried such a thing...

        Can't help pressing F5 in the forum...

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

          @d-healey It should work. I just tested and the component's CBs are called before the init of the next script begins...

          Can't help pressing F5 in the forum...

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

            @ustk said in Post init callback:

            what if you do the opposite? check from the secondary scripts the state of the interface script components?

            The timer is fine for me for now until we have a proper solution.

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

            ustkU d.healeyD 2 Replies Last reply Reply Quote 1
            • ustkU
              ustk @d.healey
              last edited by ustk

              @d-healey I have kind of the same issue with the samplerate. It is not ready at init so I use a timer that sets all the depending variables.
              Not a neat solution because I cannot use const variables since they cannot be updated later.

              Can't help pressing F5 in the forum...

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

                @d-healey said in Post init callback:

                The timer is fine for me for now until we have a proper solution.

                Problem with the timer. If you reopen a saved session in the DAW it will run the timer and reload the default preset. I think the same problem will exist with a post init callback too...

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

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

                  Did this ever get implemented? I seem to recall @Christoph posting something about it recently but I cant find anything with a forum search.

                  HISE Development for hire.
                  www.channelrobot.com

                  LindonL 1 Reply Last reply Reply Quote 0
                  • LindonL
                    Lindon @Lindon
                    last edited by

                    @Lindon OK back at this poiint again -- did we ever get anywhere?

                    HISE Development for hire.
                    www.channelrobot.com

                    Oli UllmannO 1 Reply Last reply Reply Quote 0
                    • Oli UllmannO
                      Oli Ullmann @Lindon
                      last edited by

                      @Lindon
                      You could load a default preset when you load the plug-in. Create a Preset hander and set the post load callback:

                      UserPresetHandler.setPostCallback(var presetPostCallback)

                      Maybe this works?

                      All the best
                      Oli

                      LindonL 1 Reply Last reply Reply Quote 0
                      • LindonL
                        Lindon @Oli Ullmann
                        last edited by

                        @Oli-Ullmann well even if it does it will p**s off the user base - every time they start the plugin - like in loading an already saved project in their DAW - we get the wrong preset loaded..or at least teh risk of that.

                        No what we need here is a post init call back.

                        HISE Development for hire.
                        www.channelrobot.com

                        Oli UllmannO 1 Reply Last reply Reply Quote 1
                        • Oli UllmannO
                          Oli Ullmann @Lindon
                          last edited by

                          @Lindon
                          Perhaps you could use if(Engine.getCurrentUserPresetName() != "") to
                          check whether a preset is loaded. If not, load the Init preset.

                          Regardless of whether a preset is loaded by the saved DAW project or by your script, the post callback is always executed.

                          It is even much easier!

                          In the HISE settings you can define exactly this behavior under “Default User Preset”. Then you don't even have to script!

                          All the best
                          Oli

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

                            @Oli-Ullmann said in Post init callback:

                            Perhaps you could use if(Engine.getCurrentUserPresetName() != "") to
                            check whether a preset is loaded. If not, load the Init preset.

                            Might be able to do it using this - https://docs.hise.audio/scripting/scripting-api/userpresethandler/index.html#isinternalpresetload

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

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

                              really none of this is much use, I have a panel with some data in it - it might be empty it might not.

                              if its not empty I want to draw the path it describes in a panel, on init. But on init (no matter the preset you are loading) the data panel load takes longer than the init processing AND any post-load processing(so anything in your post-preset callback)....so it never draws itself...

                              What I'm looking for is a "proper" post init call back that accounts for any panel data load scenario...

                              HISE Development for hire.
                              www.channelrobot.com

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

                                @Lindon said in Post init callback:

                                the data panel load takes longer than the init

                                Could you provide more detail about what you're doing?

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

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

                                  @d-healey sure:

                                  23b76baa-bd35-455f-a26a-4456136671d9-image.png

                                  See that grey circle inside the XY pad? Thats a path, its held in a Panel.data object, when I load this preset the data is passed to an array and from there it gets drawn correctly in the paint routine..., but on init - it all goes too fast and it doesnt get drawn - the array holding the Panel data object = 0.....

                                  HISE Development for hire.
                                  www.channelrobot.com

                                  d.healeyD Oli UllmannO 2 Replies Last reply Reply Quote 0
                                  • d.healeyD
                                    d.healey @Lindon
                                    last edited by

                                    @Lindon What's the reason for storing this in the panel's data object? And why do you need a path to draw a circle, I assume there is more going on?

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

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

                                      @d-healey said in Post init callback:

                                      @Lindon What's the reason for storing this in the panel's data object? And why do you need a path to draw a circle, I assume there is more going on?

                                      So its not always a circle its whatever the user draws (see the Record button in there?)- this is just one of the pre-loadable shapes.... when the user hits Play the XY pad follows this path and this modulates volume in the voices....

                                      Every preset needs to save its own "XY path shape".

                                      I would add an video showing you - but the forum wont let me load mp4 files.

                                      HISE Development for hire.
                                      www.channelrobot.com

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

                                        @Lindon said in Post init callback:

                                        Every preset needs to save its own "XY path shape".

                                        Ah I understand now. Are you able to store the path as a base64 string? Perhaps that will speed up the loading. Do you have some method to be able to test when the loading is complete?

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

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

                                          @d-healey said in Post init callback:

                                          @Lindon said in Post init callback:

                                          Every preset needs to save its own "XY path shape".

                                          Ah I understand now. Are you able to store the path as a base64 string? Perhaps that will speed up the loading. Do you have some method to be able to test when the loading is complete?

                                          not really and no in that order - especially the last bit - thats where the problem is - there is no notification that the data is loaded, if there was a callback for this I could do the repaint then...

                                          HISE Development for hire.
                                          www.channelrobot.com

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

                                            @Lindon Can you make a minimal snippet I can play with? Something that just draws one of these stored paths on a panel and takes too long to load.

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

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

                                            55

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            101.8k

                                            Posts