HISE Logo Forum
    • Categories
    • Register
    • Login

    [Method] Synth.getNumPressedKeysInRange

    Scheduled Pinned Locked Moved Solved Feature Requests
    7 Posts 3 Posters 374 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.
    • A
      aaronventure
      last edited by

      The existing method Synth.getNumPressedKeys is cool and all, but if the instrument features keyswitching, it's useless.

      Custom solution is to loop through the given range calling Synth.isKeyDown(), but benchmarking shows it's around 72x slower than Synth.getNumPressedKeys. Given how this would be used primarily in real-time situations, I think a native implementation would be good.

      Christoph HartC 1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @aaronventure
        last edited by

        @aaronventure or you just increase / decrease a counter on the onNoteOn / onNoteOff with a range filter. The native solution also isn‘t looping through all 127 notes.

        A 1 Reply Last reply Reply Quote 1
        • A
          aaronventure @Christoph Hart
          last edited by aaronventure

          @Christoph-Hart Right, I was thinking of the issues around the MIDI processing order we talked about yesterday. But after reading your post, it just occurred to me that I can implement exactly that, it'll just have to be added to every Script Processor.

          Still getting used to this, sorry :face_with_tongue:

          Christoph HartC 1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart @aaronventure
            last edited by

            @aaronventure put it in an external file and include that in every script processor, then it shouldn't be much overhead.

            If the logic is the same and there are only a few parameters that change (eg. the exact range), then you might also connect the script processors to an external file and set the range via two knobs on the script interface.

            A 1 Reply Last reply Reply Quote 1
            • A
              aaronventure @Christoph Hart
              last edited by

              @Christoph-Hart I already have a "Configuration" processor where I put in all these instrument specifications as constants and simply pull the data from there wherever I need it.

              Good to hear I got the right idea ;)

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

                @aaronventure You might want to roll your own solution anyway because there is (maybe was) an issue with getNumPressedKeys. If I recall the function isn't actually returning the number of keys physically held down but uses some kind of counter.

                Link Preview Image
                Fade out and numPressedKeys

                I'm experimenting and I think that fading out a note to -100 doesn't reduce the numPressedKeys counter - I'm trying to put together a simple example to demon...

                favicon

                Forum (forum.hise.audio)

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

                A 1 Reply Last reply Reply Quote 1
                • A
                  aaronventure @d.healey
                  last edited by

                  @d-healey Yeah, will have my own counter. Overhead is non-existent and it's always correct.

                  1 Reply Last reply Reply Quote 1
                  • A aaronventure marked this topic as a question on
                  • A aaronventure has marked this topic as solved on
                  • First post
                    Last post

                  16

                  Online

                  1.8k

                  Users

                  12.0k

                  Topics

                  104.8k

                  Posts