HISE Logo Forum
    • Categories
    • Register
    • Login

    Call a function after the plugin loaded

    Scheduled Pinned Locked Moved General Questions
    14 Posts 5 Posters 441 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.
    • ?
      A Former User
      last edited by

      I need to call a function after the plugin loaded into the DAW. So am I making a mistake with below use? Or any more useful ideas?

      Plugin performance is important for me, so do you think below usage can bring some trouble especially on the multi usage (let's say 30 instances) in the DAW project?

      var startupSorter = Engine.createTimerObject();
      
      startupSorter.setTimerCallback(function(t)
      {
          this.stopTimer();
          myFunction();
       
      });
      
      startupSorter.startTimer(1000);
      
      
      d.healeyD ulrikU 2 Replies Last reply Reply Quote 0
      • d.healeyD
        d.healey @A Former User
        last edited by

        @harris-rosendahl What does the function do?

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

        ? 1 Reply Last reply Reply Quote 0
        • ?
          A Former User @d.healey
          last edited by A Former User

          @d-healey The the plugin is loading with OpenGL is enabled by default. I don't want that. If the user wants, then he can enable it.

          So I will store the OpenGL enabled status in a JSON object, it will be the main value, then while loading the plugin, I am using Settings.setEnableOpenGL() to control the OpenGL.

          I need a sanity check function to be executed after the plugin loaded to check whether if the user preference is equal to the current "Settings.isOpenGLEnabled" return value. But as I see, the plugin's "Settings.setEnableOpenGL()" value can be settled only after the plugin is loaded. Because of that I need this function to be executed after the loading.

          By the way we can't check values inside the "GeneralSettings.xml" via scripting, right?

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

            @harris-rosendahl If you add a custom settings floating tile the user can change the option there, and you should be able to set it to load disabled by default.

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

            ? 1 Reply Last reply Reply Quote 0
            • ?
              A Former User @d.healey
              last edited by

              @d-healey Yes I've tried the FloatingTile, but unfortunately the plugin always load with "Yes" by default (I mean on the first plugin installation). And there isn't a "No" option by default.

              So the user must deactivate it manually. I need the plugin is OpenGL disabled by default with the first installation because of the shitty OpenGL performance on some systems.

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

                @harris-rosendahl What about if you set the floating tile to saveInPreset = true and save your project before exporting with the OpenGL option set to disabled?

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

                ? 1 Reply Last reply Reply Quote 0
                • ?
                  A Former User @d.healey
                  last edited by

                  @d-healey CustomSettings FT can't saved in a preset, I've tested it :/

                  Above timer object will always start 1 second after the plugin is loaded and then stop, right?

                  ustkU 1 Reply Last reply Reply Quote 0
                  • ustkU
                    ustk @A Former User
                    last edited by

                    @harris-rosendahl what about using this flag: HISE_USE_OPENGL_FOR_PLUGIN=0 ?

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

                    ? 1 Reply Last reply Reply Quote 0
                    • ?
                      A Former User @ustk
                      last edited by A Former User

                      @ustk said in Call a function after the plugin loaded:

                      @harris-rosendahl what about using this flag: HISE_USE_OPENGL_FOR_PLUGIN=0 ?

                      This time, OpenGL is completely disabled then :) And the user can't activate it if he wants. There is no middle way ahahah :D

                      I just need OpenGL is available according to the user demand, but disabled by default, that's it.

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

                        @harris-rosendahl said in Call a function after the plugin loaded:

                        I need to call a function after the plugin loaded into the DAW. So am I making a mistake with below use? Or any more useful ideas?

                        Plugin performance is important for me, so do you think below usage can bring some trouble especially on the multi usage (let's say 30 instances) in the DAW project?

                        var startupSorter = Engine.createTimerObject();
                        
                        startupSorter.setTimerCallback(function(t)
                        {
                            this.stopTimer();
                            myFunction();
                         
                        });
                        
                        startupSorter.startTimer(1000);
                        
                        

                        In your timerCallback you have to switch places of myFunction() and this.stopTimer()
                        as you have it now the timer will stop before it reach your function

                        startupSorter.setTimerCallback(function(t)
                        {
                            myFunction(); 
                            this.stopTimer();
                         });
                        

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

                        ? LindonL 2 Replies Last reply Reply Quote 0
                        • ?
                          A Former User @ulrik
                          last edited by

                          @ulrik Oh, I see, thank you!

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

                            @ulrik said in Call a function after the plugin loaded:

                            In your timerCallback you have to switch places of myFunction() and this.stopTimer()
                            as you have it now the timer will stop before it reach your function

                            startupSorter.setTimerCallback(function(t)
                            {
                                myFunction(); 
                                this.stopTimer();
                             });
                            

                            Err, i'm not sure thats true.... the stopTimer call will stop subsequent calls to the timer - it wont stop execution of the current callback...

                            HISE Development for hire.
                            www.channelrobot.com

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

                              @Lindon I just tried it, and you're right, it finish the callback 😬

                              Sorry @harris-rosendahl @Lindon

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

                              ? 1 Reply Last reply Reply Quote 0
                              • ?
                                A Former User @ulrik
                                last edited by

                                @ulrik No problem.

                                I think I found a bug, Settings.isOpenGLEnabled() returns always true o the compiled plugin, but it works on Hise.

                                If you set the OpenGL "No" on the CustomSettings FT, GeneralSettings.xml shows OPEN_GL="0" when the plugin is closed, as it supposed to be. That's ok.

                                But when you load the plugin again, even the OPEN_GL is set to 0 on the GeneralSettings.xml, Settings.isOpenGLEnabled() returns always true.

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

                                18

                                Online

                                1.7k

                                Users

                                11.8k

                                Topics

                                102.6k

                                Posts