HISE Logo Forum
    • Categories
    • Register
    • Login

    PLAY et STOP " Midi Player 1 "

    Scheduled Pinned Locked Moved General Questions
    21 Posts 3 Posters 1.2k 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.
    • d.healeyD
      d.healey @tsempire
      last edited by

      @tsempire said in PLAY et STOP " Midi Player 1 ":

      now I don't know how to interact with the Play du Midi

      You need a reference to the MIDI player. In your button callback you can call the play function on that reference and pass in the timestamp.

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

      tsempireT 1 Reply Last reply Reply Quote 0
      • tsempireT
        tsempire @d.healey
        last edited by

        @d-healey who means I have to copy and paste this into onInit ?

        const var MIDIPlayer1 = Synth.getMidiProcessor("MIDI Player1");

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

          @tsempire You probably want this one

          84d2ce22-ff75-4bf7-8e5f-7042a867f14d-image.png

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

          tsempireT 1 Reply Last reply Reply Quote 0
          • tsempireT
            tsempire @d.healey
            last edited by

            @d-healey I think, so I have to put or “getMidiPlayer”?

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

              @tsempire I don't quite understand the question.

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

              tsempireT 1 Reply Last reply Reply Quote 0
              • tsempireT
                tsempire @d.healey
                last edited by

                @d-healey I have to put or getMidiPlayer ?

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

                  @tsempire That's the same question :)

                  Instead of const var MIDIPlayer1 = Synth.getMidiProcessor("MIDI Player1");

                  I think* you need const var MIDIPlayer1 = Synth.getMidiPlayer("MIDI Player1");

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

                  tsempireT 1 Reply Last reply Reply Quote 0
                  • tsempireT
                    tsempire @d.healey
                    last edited by

                    @d-healey sorry with my english with google translate :-S

                    So I did what I suggested, it made me wrong?

                    dbb47272-1abd-46ee-863e-ca607ae71331-image.png

                    tobanteT d.healeyD 2 Replies Last reply Reply Quote 0
                    • tobanteT
                      tobante @tsempire
                      last edited by

                      @tsempire You can try deepl.com for translations. It's a lot better then google. If it has your language

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

                        @tsempire That error is telling you that you are a missing semi-colon ;

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

                        tsempireT 2 Replies Last reply Reply Quote 0
                        • tsempireT
                          tsempire @d.healey
                          last edited by

                          This post is deleted!
                          1 Reply Last reply Reply Quote 0
                          • tsempireT
                            tsempire @d.healey
                            last edited by

                            @d-healey campris ); or I missed it :-)

                            now when I press the Play button the midi doesn't start?

                            7cff72cf-cb70-45b3-84cf-770cf9f5880e-image.png

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

                              @tsempire I think you need to start with something simpler. There are basic concepts that you are missing.

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

                              tsempireT 1 Reply Last reply Reply Quote 0
                              • tsempireT
                                tsempire @d.healey
                                last edited by

                                @d-healey thank you very much, I succeeded with the help of an external friend.

                                I've been using HISE for 3 days now and I think I've learned a lot without knowing anything about coding.

                                in my opinion you should give the codes to understand the logic for people like me who don't understand.

                                thank you for the help

                                tsempireT 1 Reply Last reply Reply Quote 0
                                • tsempireT
                                  tsempire @tsempire
                                  last edited by

                                  @tsempire I'll give the solution to those who need it.

                                  1. Copy this code:

                                  // Get a reference to the MIDI processor as MIDI player
                                  const MIDIplayer = Synth.getMidiProcessor("MIDI Player1").asMidiPlayer();

                                  // Get a reference to the transport buttons
                                  const grpTranportBtn = [Content.getComponent("btnPlay"),
                                  Content.getComponent("btnStop")];
                                  for(b in grpTranportBtn)
                                  {
                                  // Make sure the buttons are not saved with the presets
                                  b.set("saveInPreset", false);

                                  // Assign the control callback to the transport buttons
                                  b.setControlCallback(onTransportBtnControl);
                                  

                                  }

                                  // Also set the STOP button to be momentary
                                  grpTranportBtn[1].set("isMomentary", true);

                                  inline function onTransportBtnControl(component, value)
                                  {
                                  // get which button triggered the callback
                                  local index = grpTranportBtn.indexOf(component);

                                  // If it's the PLAY button
                                  if(index == 0)
                                  {
                                  	// if the PLAY button is pressed
                                  	if(value)
                                  	{
                                  		// start playing
                                  		MIDIplayer.play(0);
                                  	}
                                  	else
                                  	{
                                  		// keep the button's value to 1 if it's still playing
                                  		grpTranportBtn[0].setValue(1);
                                  	}
                                  }
                                  // if it's the STOP button
                                  else
                                  {
                                  	// only react if the mouse is clicked (not released)
                                  	if(!value)
                                  		return;
                                  	
                                  	// stop playing
                                  	MIDIplayer.stop(0);
                                  	// set the PLAY button's value to 0
                                  	grpTranportBtn[0].setValue(0);
                                  }
                                  

                                  };

                                  // on compilation, reset the playhead position to the beginning
                                  // comment it out if not needed
                                  MIDIplayer.setPlaybackPosition(0.0);

                                  1. Create 2 buttons with the ID

                                  btnPlay

                                  btnStop

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

                                  28

                                  Online

                                  1.7k

                                  Users

                                  11.8k

                                  Topics

                                  102.5k

                                  Posts