HISE Logo Forum
    • Categories
    • Register
    • Login

    Simple button with noteOffByEventId

    Scheduled Pinned Locked Moved Scripting
    3 Posts 2 Posters 231 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.
    • bendursoB
      bendurso
      last edited by

      Hi! I want to make a simple button to trigger a note (on/off). noteOff works fine, but is depreciated. I read the other posts about artificial notes and noteOffByEventId, but I still couldn't figure out how to solve this simple script.

      const var btnPlay = Content.getComponent("btnPlay");
       
      inline function onbtnPlayControl(component, value)
      {
      	if (value)
       	{
      		Synth.playNote(40, 100);
       	}
       	else
       	{
       		Synth.noteOffByEventId();
       	}
      };
       
      Content.getComponent("btnPlay").setControlCallback(onbtnPlayControl);
      
      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @bendurso
        last edited by

        @bendurso

        Synth.playNote() returns an event ID, so you can store that in a variable and use it in the note off function.

        You might enjoy this video:
        https://youtu.be/5PmEgPVsGvA

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

        bendursoB 1 Reply Last reply Reply Quote 1
        • bendursoB
          bendurso @d.healey
          last edited by

          @d-healey Thanks! I love your videos :)

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

          49

          Online

          1.7k

          Users

          11.7k

          Topics

          101.8k

          Posts