HISE Logo Forum
    • Categories
    • Register
    • Login

    Delay other events than Message

    Scheduled Pinned Locked Moved Scripting
    10 Posts 3 Posters 265 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.
    • ulrikU
      ulrik
      last edited by ulrik

      I have this project where I use

      local delay = Engine.getSamplesForQuarterBeats(value.rotation * (1/360) * 4);
      

      to delay note ons like this:

      local id = Synth.addNoteOn(1, key, value.velocity, delay);
      Synth.noteOffDelayedByEventId(id, delay + Engine.getSamplesForQuarterBeats(value.bars/value.sides*4) * value.length);
      

      I set the delay by rotating the ellipse, and it works great for note creation, but I also want to get the visual ball to show the delay so....

      Is it possible to also delay a component.repaint() or .changed() action?
      I have tried with timers and it works but it's not so smooth, in this arp I'm delaying up to 32 note ons and this means that if I want to delay a repaint action on all of those note ons, and the delay is long, I have to set up several timers to make it work.
      If first note on starts the first timer, it might not has been executed before next note on is executed, so I have to use another timer for the next, and next, etc....

      So is there a simpler way to do this?
      Any help is appreciated.

      delayed message.gif

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

      d.healeyD A 2 Replies Last reply Reply Quote 0
      • d.healeyD
        d.healey @ulrik
        last edited by

        @ulrik You could do it like a video game. You have one timer running as your game loop. For each cycle of the loop you perform the actions needed and at the end of the loop you update the UI. The timer interval needs to be short enough for your fastest refresh time.

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

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

          @ulrik Content.callWithDelay?

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

            @aaronventure Thanks but it seems it will react just the same as a timer if the delay is longer than the time to next note on.
            At least that is how I understand the "Description", or maybe I'm wrong

            Skärmavbild 2024-08-02 kl. 17.29.57.png

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

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

              @d-healey Thanks, yes I tried this technic and it works nicely with (in this project, 4 polygons), more than that starts to make the visuals be unsynced with the delay.
              You can hear and see it in this video:

              video

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

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

                @ulrik said in Delay other events than Message:

                Thanks but it seems it will react just the same as a timer if the delay is longer than the time to next note on.
                At least that is how I understand the "Description", or maybe I'm wrong

                Wrong function

                f7b8c72d-8a49-4353-a21e-7d4bbc66ae89-image.png

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

                ulrikU 1 Reply Last reply Reply Quote 2
                • d.healeyD
                  d.healey @ulrik
                  last edited by

                  @ulrik said in Delay other events than Message:

                  You can hear and see it in this video:

                  The GUI shouldn't affect the audio thread. Are you triggering notes in your UI script?

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

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

                    @d-healey said in Delay other events than Message:

                    @ulrik said in Delay other events than Message:

                    Thanks but it seems it will react just the same as a timer if the delay is longer than the time to next note on.
                    At least that is how I understand the "Description", or maybe I'm wrong

                    Wrong function

                    f7b8c72d-8a49-4353-a21e-7d4bbc66ae89-image.png

                    Oh, well I read what @aaronventure wrote :)
                    Well this seems to be a better one, thanks!

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

                    1 Reply Last reply Reply Quote 1
                    • ulrikU
                      ulrik @d.healey
                      last edited by

                      @d-healey said in Delay other events than Message:

                      @ulrik said in Delay other events than Message:

                      You can hear and see it in this video:

                      The GUI shouldn't affect the audio thread.

                      It doesn't, it's only the visual that is unsynced

                      Are you triggering notes in your UI script?
                      I'm triggering notes inside the TransportHandler grid function

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

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

                        @ulrik @aaronventure @d-healey
                        After trimming with timers in different setups I found that "CallAfterDelay()" was the best solution!
                        Thanks to you all!

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

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

                        53

                        Online

                        1.7k

                        Users

                        11.7k

                        Topics

                        102.2k

                        Posts