HISE Logo Forum
    • Categories
    • Register
    • Login

    Updating blur?

    Scheduled Pinned Locked Moved General Questions
    9 Posts 5 Posters 433 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.
    • ThinkTankT
      ThinkTank
      last edited by ThinkTank

      Hi everyone, i have this blur code:

      const var BlurPanel = Content.getComponent("BlurPanel");
      BlurPanel.setPaintRoutine(function(g)
      { 
          g.beginLayer(true);
          g.boxBlur(33.0);  ///  0 To 100
          g.endLayer();
      });
      

      However theres a lot of knobs on top, and when i turn the knobs down, they become darker, making the blur look "off" with hard edges around the knobs. How would i update the blur effect every second (if thats not a perfomance issue)? or when i turn the knobs?

      Without problems that test the limits of your abilities, you can not expand them.

      CasmatC 1 Reply Last reply Reply Quote 0
      • CasmatC
        Casmat @ThinkTank
        last edited by

        @ThinkTank you would use a timer and put the blur in the callback

        i make music

        ThinkTankT 1 Reply Last reply Reply Quote 0
        • ThinkTankT
          ThinkTank @Casmat
          last edited by

          @Casmat

          What is the function for a timer callback?

          Engine.setTimerCallback(onTimerCallback);
          

          ?

          Without problems that test the limits of your abilities, you can not expand them.

          LindonL A 2 Replies Last reply Reply Quote 0
          • LindonL
            Lindon @ThinkTank
            last edited by Lindon

            @ThinkTank said in Updating blur?:

            @Casmat

            What is the function for a timer callback?

            Engine.setTimerCallback(onTimerCallback);
            

            ?

            there are two types of timer - one for the Ui and one that still runs even when the Ui is not visible - as you are using a blur here - you want the UI timer...look up Panel timers.

            HISE Development for hire.
            www.channelrobot.com

            1 Reply Last reply Reply Quote 0
            • A
              aaronventure @ThinkTank
              last edited by

              @ThinkTank yeah but do it for the panel, it's the same method. The panel timer is bypassed when the GUI is closed which prevents you from doing silly things.

              have the timer and your knob change a variable, and have the blur reference that variable.

              don't forget to call repaintImmediately() with the timer.

              ThinkTankT 1 Reply Last reply Reply Quote 0
              • ThinkTankT
                ThinkTank @aaronventure
                last edited by

                @aaronventure
                @Lindon
                Thanks!

                Without problems that test the limits of your abilities, you can not expand them.

                1 Reply Last reply Reply Quote 0
                • ThinkTankT
                  ThinkTank
                  last edited by

                  This works:

                  // BLUR IT 
                  const var BlurPanel = Content.getComponent("BlurPanel");
                  
                  // Define the paint routine for the BlurPanel
                  BlurPanel.setPaintRoutine(function(g)
                  {
                      // Start a new layer for the blur effect
                      g.beginLayer(true);
                  
                      // Apply the blur effect
                      g.boxBlur(33.0); // Adjust the blur amount as needed
                  
                      // End the layer, which applies the blur
                      g.endLayer();
                  });
                  
                  // Implement the onTimer callback for BlurPanel
                  BlurPanel.setTimerCallback(function()
                  {
                      // Trigger a repaint on the BlurPanel to update the blur effect
                      BlurPanel.repaint();
                      BlurPanel1.repaint();
                      BlurPanel2.repaint();
                  });
                  
                  // Start the timer with a desired interval (in milliseconds)
                  BlurPanel.startTimer(30); // Adjust the interval as needed
                  
                  
                  
                  const var BlurPanel1 = Content.getComponent("BlurPanel1");
                  BlurPanel1.setPaintRoutine(function(g)
                  { 
                      g.beginLayer(true);
                      g.boxBlur(33.0);  /// 0 To 100
                      g.endLayer();
                  });
                  
                  const var BlurPanel2 = Content.getComponent("BlurPanel2");
                  BlurPanel2.setPaintRoutine(function(g)
                  { 
                      g.beginLayer(true);
                      g.boxBlur(33.0);  ///  0 To 100
                      g.endLayer();
                  });
                  

                  This seems to work fine here, if anyone new to hise needs something like this.
                  Probably not the most efficient way though

                  Without problems that test the limits of your abilities, you can not expand them.

                  Matt_SFM 1 Reply Last reply Reply Quote 0
                  • Matt_SFM
                    Matt_SF @ThinkTank
                    last edited by

                    @ThinkTank why not repaint() directly into the knob's CB?

                    Develop branch
                    Win10 & VS17 / Ventura & Xcode 14. 3

                    ThinkTankT 1 Reply Last reply Reply Quote 0
                    • ThinkTankT
                      ThinkTank @Matt_SF
                      last edited by

                      @Matt_SF

                      I think there is about 12 knobs, and some other elements that is getting messed up.
                      So, this seems easier.

                      Without problems that test the limits of your abilities, you can not expand them.

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

                      31

                      Online

                      1.7k

                      Users

                      11.8k

                      Topics

                      102.7k

                      Posts