Pushing Messages onto an Array?
-
@Christoph-Hart
Legend, Could you please Do an example for these?
setUseTimestampInTicks()
MidiPlayer.setSyncToMasterClock
-
@Natan EDIT: What I've written below is approximate, not actual code. You'll need to create MIDI player in your Module Tree.
const TH = Engine.createTransportHandler(); TH.setEnableGrid(true, 4); TH.setSyncMode(TH.PreferExternal); TH.setOnGridChange(true, GridChange); const var yourMidiPlayer = Synth.getMidiPlayer("myMidiPlayer"); yourMidiPlayer.setUseTimestampInTicks(); yourMidiPlayer.setSyncToMasterClock(true);
You'll need to either create a new sequence or load one.
-
@Christoph-Hart Thank you for the suggestion. I tried that first, actually, but the MIDI player, and particularly recording, seemed oriented to looping a couple bars (e.g., MidiPlayer.create(int nominator, int denominator, int barLength))?
-
@clevername27 Thank you so Much Mate <3 :folded_hands:
Is there any difference that I Can hear, I Mean the results of the above code are obvious or it's a daw and Midi Thing?IMPORTANT! And one Quick question, Let's say I have 3 MidiPlayers, is It safe to use the code three times? or Inside a Loop?
-
@Natan Can you explain your first question in more detail? If you have three MIDI players, then you'd need to do this for all three—you'd call this at init, not inside a loop.
-
@clevername27 except if they are stored in an array:
const var yourMidiPlayers = [Synth.getMidiPlayer("myMidiPlayer1"), Synth.getMidiPlayer("myMidiPlayer2"), Synth.getMidiPlayer("myMidiPlayer3")]; for (p in yourMidiPlayers) { p.setUseTimestampInTicks(); p.setSyncToMasterClock(); }
-
-
@clevername27 following this:
void ScriptingObjects::ScriptedMidiPlayer::setSyncToMasterClock(bool shouldSyncToMasterClock) { if (shouldSyncToMasterClock && !getScriptProcessor()->getMainController_()->getMasterClock().isGridEnabled()) { reportScriptError("You have to enable the master clock before using this method"); } else { getPlayer()->setSyncToMasterClock(shouldSyncToMasterClock); } }
The grid has to be enabled
-
@ustk Cheers!
-
@clevername27 Solved.
-