Forum
    • Categories
    • Register
    • Login

    Effect stops working when UI closed

    Scheduled Pinned Locked Moved General Questions
    7 Posts 2 Posters 62 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.
    • MorsM
      Mors
      last edited by

      Hey! I have an effect built in scriptfx that i'm using the below code to essentially trigger the effect on and off depending on your DAW's playback state.

      This works perfectly fine inside HISE and when the plugin UI is open in your DAW, but the moment you close the plugins UI in your daw, it ceases to work.

      What am I missing?

      Cheers!

      const var HardcodedMasterFX1 = Synth.getEffect("HardcodedMasterFX1");
      
      const var handler = Engine.createTransportHandler();
      
      handler.setOnTransportChange(false, function(playing)
      {
          if (playing)
          {
              // DAW is playing
              HardcodedMasterFX1.setAttribute(HardcodedMasterFX1.gate, 1);
              HardcodedMasterFX1.setAttribute(HardcodedMasterFX1.switchy, 1);
          }
          else
          {
              // DAW stopped
              HardcodedMasterFX1.setAttribute(HardcodedMasterFX1.gate, 0);
              HardcodedMasterFX1.setAttribute(HardcodedMasterFX1.switchy, 0);
          }
      });
      
      
      David HealeyD 1 Reply Last reply Reply Quote 0
      • David HealeyD
        David Healey @Mors
        last edited by

        @Mors Is the code in your interface script?

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        MorsM 1 Reply Last reply Reply Quote 0
        • MorsM
          Mors @David Healey
          last edited by

          @David-Healey It is, and i've also tried doing it in a separate Script Processor and still no good

          David HealeyD 1 Reply Last reply Reply Quote 0
          • David HealeyD
            David Healey @Mors
            last edited by

            @Mors Check the Execution Modes and see if that helps

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

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - HISE tutorials

            MorsM 1 Reply Last reply Reply Quote 0
            • MorsM
              Mors @David Healey
              last edited by

              @David-Healey That was it! I just to make it synchronous, thank you!

              Here's the updated code if anyone ever has the same problem:

              const var HardcodedMasterFX1 = Synth.getEffect("HardcodedMasterFX1");
              
              const var handler = Engine.createTransportHandler();
              
              inline function onTransportChange(playing)
              {
                  HardcodedMasterFX1.setAttribute(HardcodedMasterFX1.gate, playing ? 1 : 0);
                  HardcodedMasterFX1.setAttribute(HardcodedMasterFX1.switchy, playing ? 1 : 0);
              }
              
              handler.setOnTransportChange(true, onTransportChange);
              
              David HealeyD 1 Reply Last reply Reply Quote 1
              • David HealeyD
                David Healey @Mors
                last edited by David Healey

                @Mors said in Effect stops working when UI closed:

                HardcodedMasterFX1.setAttribute(HardcodedMasterFX1.gate, playing ? 1 : 0);
                HardcodedMasterFX1.setAttribute(HardcodedMasterFX1.switchy, playing ? 1 : 0);
                

                You don't need the ternary statement, playing will already be either 1 or 0.

                Free HISE Bootcamp Full Course for beginners.
                YouTube Channel - Public HISE tutorials
                My Patreon - HISE tutorials

                MorsM 1 Reply Last reply Reply Quote 0
                • MorsM
                  Mors @David Healey
                  last edited by

                  @David-Healey Oh awesome, thanks for letting me know!

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

                  22

                  Online

                  2.2k

                  Users

                  13.5k

                  Topics

                  117.6k

                  Posts