HISE Logo Forum
    • Categories
    • Register
    • Login

    Hand cranked mono/legato issue..

    Scheduled Pinned Locked Moved General Questions
    5 Posts 2 Posters 288 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.
    • LindonL
      Lindon
      last edited by

      Ok so I want to play my instrument polyphonically or monophonically., and if mono then set some start offset....sort of half-way to legato...

      but I clearly dont understand how the event ID system works because this code doesnt work:

      function onNoteOn()
      {
          if (PolyphonicOnOff.getValue() == 0) {
            // mono phonic processing...
            //is there a held note?
      	  Console.print(Globals.lastNoteNum);
            if (Globals.lastNoteNum > -1){
                // yes there is...so we should have the id of the last event in lastNoteId...
                Synth.noteOffByEventId(Globals.lastNoteId);
                Message.ignoreEvent(true);
                Globals.lastNoteId = Synth.playNoteWithStartOffset(Message.getChannel(), Message.getNoteNumber(),Message.getVelocity(), 10000);
                
            }else{
              // no there isnt we are "first event"
              Globals.lastNoteNum = Message.getNoteNumber();
              Globals.lastNoteId = Message.getEventId();
            };
          };
      	Console.print(Globals.lastNoteNum);
      	Console.print(Globals.lastNoteId);
      };
      

      its failing at the noteOffByEventId, where its telling me it cant find the note ID...held in Globals.lastNoteId

      What am i doing wrong?

      HISE Development for hire.
      www.channelrobot.com

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

        Last note ID needs to be artificial

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

        LindonL 1 Reply Last reply Reply Quote 0
        • LindonL
          Lindon @d.healey
          last edited by

          @d-healey Thanks Dave. So I did this:

          function onNoteOn()
          {
              if (PolyphonicOnOff.getValue() == 0) {
                // mono phonic processing...
                //is there a held note?
          	  Console.print(Globals.lastNoteNum);
                if (Globals.lastNoteNum > -1){
                    // yes there is...so we should have the id of the last event in lastNoteId...
          
                    Synth.noteOffByEventId(Globals.lastNoteId);
                    Message.ignoreEvent(true);
                    Globals.lastNoteId = Synth.playNoteWithStartOffset(Message.getChannel(), Message.getNoteNumber(),Message.getVelocity(), 10000);
                    Globals.lastNoteNum = Message.getNoteNumber();
                }else{
                  // no there isnt we are "first event"
                  Message.makeArtificial();
                  Globals.lastNoteNum = Message.getNoteNumber();
                  Globals.lastNoteId = Message.getEventId();
                };
              };
          	Console.print(Globals.lastNoteNum);
          	Console.print(Globals.lastNoteId);
          };
          

          Which with the required jiggery-pokery in the note off makes it work....I am assuming that

          Globals.lastNoteId = Synth.playNoteWithStartOffset(.....

          makes that event Artificial anyway...

          HISE Development for hire.
          www.channelrobot.com

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

            @Lindon Looks good. I think makeArtificial returns an ID so you can skip a line of code here.

            Message.makeArtificial();
            Globals.lastNoteNum = Message.getNoteNumber();
            Globals.lastNoteId = Message.getEventId();

            Globals.lastNoteId = Message.makeArtificial();

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

            LindonL 1 Reply Last reply Reply Quote 0
            • LindonL
              Lindon @d.healey
              last edited by

              @d-healey oh yes that seems logical, thanks Dave.

              HISE Development for hire.
              www.channelrobot.com

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

              44

              Online

              1.7k

              Users

              11.7k

              Topics

              101.8k

              Posts