PLAY et STOP " Midi Player 1 "
-
@d-healey I have to put or getMidiPlayer ?
-
@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");
-
@d-healey sorry with my english with google translate :-S
So I did what I suggested, it made me wrong?
-
-
@tsempire That error is telling you that you are a missing semi-colon
;
-
This post is deleted! -
@d-healey campris ); or I missed it :-)
now when I press the Play button the midi doesn't start?
-
@tsempire I think you need to start with something simpler. There are basic concepts that you are missing.
-
@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
-
@tsempire I'll give the solution to those who need it.
- 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);- Create 2 buttons with the ID
btnPlay
btnStop