OverlayMidiPanel: keep dragged MIDI file saved inside the plugin
-
Hi friends,
I have an OverlayMidiPanel linked to a MIDIPlayer1.
I want that when the user drags a MIDI file onto the OverlayMidiPanel, it stays saved inside the plugin so that it reappears in future sessions.
I suppose for that, the user has to save the MIDI file somewhere, so I also created a button that should open a directory to save it — but it doesn’t work.
The directory always opens when the script compiles, not when I press the button.
Can anyone help me? Thanks!const var ScriptButton1 = Content.getComponent("ScriptButton1"); const var MIDIPlayer1 = Synth.getMidiProcessor("MIDIPlayer1").asMidiPlayer(); MIDIPlayer1.saveAsMidiFile("{PROJECT_FOLDER}MidiFiles", 1); FileSystem.browse(FileSystem.Desktop, true, "*.mid", function(f){ MIDIPlayer1.saveAsMidiFile(f.toString(0), 1); }); ScriptButton1.setControlCallback(f); -
@lijas90 said in OverlayMidiPanel: keep dragged MIDI file saved inside the plugin:
The directory always opens when the script compiles, not when I press the button.
You've placed the command inside
onInit. This is the callback that runs when you hit compile or when the plugin loads.You need to place the command inside the button callback. - Check my YouTube channel, I have lots of videos showing button callbacks.