HISE Logo Forum
    • Categories
    • Register
    • Login

    Detect if the plugin UI interface is open or closed (bypass code when the ui is closed using broadcasters and listeners)

    Scheduled Pinned Locked Moved Solved Scripting
    14 Posts 5 Posters 695 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.
    • griffinboyG
      griffinboy
      last edited by griffinboy

      Is it possible to tell a piece of code to act differently depending on whether the plugin UI is open?
      I understand that certain scripts in HISE already act this way on default.

      In my project I have a bunch of LAF and Scriptnode which create metering. I don't need these to run whilst the UI is closed.

      Perhaps this is not important, as this stuff generally uses a negligible amount of resources, but I thought it was an interesting question.

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

        If the script is deferred then it won't run when the UI is closed - your main interface script should always be deferred.

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

        griffinboyG 2 Replies Last reply Reply Quote 0
        • griffinboyG
          griffinboy @d.healey
          last edited by griffinboy

          @d-healey
          Thank you I will look into this.
          I guess this would not help me bypass the scriptnode, but would at least allow me to stop drawing my metering.

          For some reason I thought that I had read somewhere that the UI stuff was automatically deferred, but that can't be the case.

          Synth.deferCallbacks(true);

          ^ How do you implement this?
          Am I able to defer a whole namespace somehow?

          Christoph HartC d.healeyD 2 Replies Last reply Reply Quote 0
          • griffinboyG
            griffinboy @d.healey
            last edited by griffinboy

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • Christoph HartC
              Christoph Hart @griffinboy
              last edited by

              Link Preview Image
              HISE | Docs

              favicon

              (docs.hise.dev)

              griffinboyG 1 Reply Last reply Reply Quote 0
              • griffinboyG
                griffinboy @Christoph Hart
                last edited by

                @Christoph-Hart
                Aha! Thank you I missed this

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

                  @griffinboy You just drop it in your on init callback and the entire script (all midi callbacks) are deferred. I thought this applied to timers as well but as Christoph points out the timers are automatically deferred.

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

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

                    @d-healey
                    I'm not sure if I can do what I want using Synth.deferCallbacks(true);

                    I am firstly trying to defer my Timer script which loops and draws the UI, and then secondly to disable the scriptnode which is creating the information for the Ui.
                    This is for performance reasons.

                    I think I shall have to look into what Christoph posted, it looks like I shall have to create a listener to this suspend event!

                    griffinboyG 1 Reply Last reply Reply Quote 0
                    • griffinboyG
                      griffinboy @griffinboy
                      last edited by

                      @griffinboy
                      It works perfectly using the documentation here:
                      https://docs.hise.dev/scripting/scripting-api/content/index.html#setsuspendtimercallback

                      Note* I discovered that all the repaint() routines get called when switching from a different window, back to the main interface window.
                      This was confusing me for a moment, making me think that my UI was still updating in the background.

                      But no, it was successfully paused and only repainted once, when opening up the UI page,

                      griffinboyG 1 Reply Last reply Reply Quote 0
                      • griffinboyG griffinboy marked this topic as a question on
                      • griffinboyG griffinboy has marked this topic as solved on
                      • griffinboyG
                        griffinboy @griffinboy
                        last edited by griffinboy

                        @griffinboy
                        For those who want to see the working code:

                        a65d740b-515e-4772-9145-7b93a8130635-image.png

                        HISEnbergH 1 Reply Last reply Reply Quote 3
                        • HISEnbergH
                          HISEnberg @griffinboy
                          last edited by

                          @griffinboy thanks for posting this, it wasn't something I had given much thought to previously, but my newer projects could benefit greatly from this

                          griffinboyG 1 Reply Last reply Reply Quote 1
                          • griffinboyG
                            griffinboy @HISEnberg
                            last edited by griffinboy

                            @HISEnberg
                            No problem,
                            I'm going to update this screenshot in a second to be less case specific, and with the code for altering scriptnode bypass

                            I'll probably delete this post and just make a neat answer post.

                            1 Reply Last reply Reply Quote 1
                            • J
                              jack52
                              last edited by

                              I find this topic incredibly interesting and would like to discuss it in depth.

                              1 Reply Last reply Reply Quote 0
                              • J
                                jack52
                                last edited by

                                Last week, while working on a project for custom logo design services, I faced a challenge with the plugin's UI interface. It was crucial to detect whether it was open or closed. I implemented a solution using broadcasters and listeners to bypass certain code when the UI was closed. This not only streamlined the process but also indirectly optimized my workflow, allowing me to focus more on delivering creative designs to my clients.

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

                                29

                                Online

                                1.7k

                                Users

                                11.8k

                                Topics

                                102.3k

                                Posts