HISE Logo Forum
    • Categories
    • Register
    • Login

    Play note pressing a button...

    Scheduled Pinned Locked Moved General Questions
    5 Posts 3 Posters 419 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
      alepan
      last edited by

      I'm sure I'm not doing it right, but I can't really understand why I can't play a note hitting a button, with the following:

      Engine.loadAudioFilesIntoPool();
      
      //REFERENCES
      const var Kick = Synth.getChildSynth("Kick");
      
      const var Kick1_btn = Content.getComponent("Kick1_btn");
      const var Kick2_btn = Content.getComponent("Kick2_btn");
      
      
      
      //FUNCTIONS
      
      
      inline function onKick1_btnControl(component, value)
      {
      	Kick.playNote(24, 100);
      };
      
      Content.getComponent("Kick1_btn").setControlCallback(onKick1_btnControl);
      

      So I have a sampler, two samples loaded, super-simple, when I hit compile I get a "function not found" error for the playNote line.

      Thanks for your help :)

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

        Synth.playNote() is the function you need. If it ever says function not found it means the thing you are trying to call the function on (in your case kick) doesn't have a function with that name. You can always use the auto complete popup (press ESC) to check what's available.

        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
          alepan @d.healey
          last edited by

          @d-healey Aaahh ok, and what if I had 2 samplers with different samples, how can I differentiate which sampler is going to play?

          LindonL 1 Reply Last reply Reply Quote 0
          • LindonL
            Lindon @alepan
            last edited by

            @alepan said in Play note pressing a button...:

            @d-healey Aaahh ok, and what if I had 2 samplers with different samples, how can I differentiate which sampler is going to play?

            at least 2 ways off the top of my head -

            1. put a midi processor in each sampler - that plays a note, and call each one
              or
            2. put a processor in each sampler that ignores all midi chanels except one(a different one for each sampler) and send them midi notes...

            HISE Development for hire.
            www.channelrobot.com

            A 1 Reply Last reply Reply Quote 0
            • A
              alepan @Lindon
              last edited by

              @Lindon Ok, thanks a lot!

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

              58

              Online

              1.7k

              Users

              11.7k

              Topics

              101.8k

              Posts