Forum
    • Categories
    • Register
    • Login

    Report Latency?

    Scheduled Pinned Locked Moved Scripting
    4 Posts 2 Posters 63 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.
    • ChazroxC
      Chazrox
      last edited by

      How do we report our plugins latency to the daw? I see there are some api's for this but Im not sure how its done.

      dannytaurusD 1 Reply Last reply Reply Quote 0
      • dannytaurusD
        dannytaurus @Chazrox
        last edited by dannytaurus

        @Chazrox https://docs.hise.audio/scripting/scripting-api/engine/index.html#setlatencysamples

        Engine.setLatencySamples(int latency)
        

        sets the latency of the plugin as reported to the host. Default is 0

        You have to calculate the latency yourself, then report it to the host with that call. Neither is automatic.

        HISE dev latest / herdr + Claude Code / Figma + Affinity
        Meat Beats: https://meatbeats.com
        Klippr Video: https://klippr.video

        ChazroxC 1 Reply Last reply Reply Quote 0
        • ChazroxC
          Chazrox @dannytaurus
          last edited by

          @dannytaurus There is also, Engine.getLatencySamples(). Do I just get and set the samples on interface script and leave it there? Do I have to create a variable or anything specific?

          dannytaurusD 1 Reply Last reply Reply Quote 0
          • dannytaurusD
            dannytaurus @Chazrox
            last edited by

            @Chazrox said in Report Latency?:

            Engine.getLatencySamples()

            All that does is give you back the number you already set manually with Engine.setLatencySamples().

            If your plugin introduces latency (not all do) then you have to calculate or measure the amount of latency in samples and set it in Engine.setLatencySamples(), which is then reported to the host by HISE/JUCE.

            If your plugin has a variable amount of latency, possibly from switching a latency-producing effect in/out, then you have to either:

            1. Adjust Engine.setLatencySamples() in realtime, as the amount changes, so the new value is reported to the host, or
            2. Report a larger fixed value to the host and compensate yourself within the plugin.

            Example: if you have a effect in your synth that uses oversampling and introduces 100 samples of latency, you can either:

            1. Use Engine.setLatencySamples(100) every time the effect is enabled in the synth, then Engine.setLatencySamples(0) when it's disabled, or
            2. Set Engine.setLatencySamples(100) at initialisation then compensate yourself in the plugin by adding a fixed delay of 100 samples when the effect is disabled and removing the delay when the effect is enabled.

            The second method seems better because you're reporting a fixed amount to the host them compensating within your own plugin.

            If you use the first method and keep reporting different amounts of latency to the host, you won't know exactly when or how the host will apply the new latency value (next block, next play, will it glitch when it changes, etc.)

            It sounds complicated but it isn't when you get your head around it.

            HISE dev latest / herdr + Claude Code / Figma + Affinity
            Meat Beats: https://meatbeats.com
            Klippr Video: https://klippr.video

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

            9

            Online

            3.1k

            Users

            14.0k

            Topics

            122.1k

            Posts