HISE Logo Forum
    • Categories
    • Register
    • Login
    1. HISE
    2. pasmae
    3. Best
    • Profile
    • Following 0
    • Followers 0
    • Topics 5
    • Posts 15
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: noteOff() / noteOffByEventId()

      @Lunacy-Audio I just rebuilt HISE and now it works! Thanks so much for your help and effort!

      posted in Scripting
      pasmaeP
      pasmae
    • noteOff() / noteOffByEventId()

      Hello,

      I am working on a script that retriggers all currently pressed keys when another key is pressed. I created an object which stores if a certain keynumber is pressed or not. When I print to the console I get the keynumbers just as I want. Retriggering works fine, but when I let go a key, it doesn't stop the note with the Synth.noteOff() function, it says in the console that I should use Synth.noteOffByEventId() instead. But when I get the EventId in onNoteOff and insert it in the function, it also doesn't work right. It seems to look for the same ID in the onNoteOn. How do I have to treat the Synth.noteOffByEventId() in this case?

      //On Init
      
      //Storing the current key status for the key range
      const var a = {}
      
      for (i = 53; i < 97; i++)
      {
          a[i] = 0;
      }
      
      function onNoteOn()
      {
      	const var n = Message.getNoteNumber();
      		
      	a[n] = Synth.isKeyDown(n);
      	
      for (k in a)
          {
              if (a[k] == 1)
              {
      	        Synth.playNote(k, 1);
              }
          }
      }	
      
      function onNoteOff()
      {
          const var n = Message.getNoteNumber();
          
          const var e = Message.getEventId();
          
          a[n] = Synth.isKeyDown(n);
          
      for (k in a)
          {
              if (a[k] == 0)
              {
      	        Synth.noteOffByEventId(e);
              }
          }
      	
      }
      
      posted in Scripting
      pasmaeP
      pasmae