HISE Logo Forum
    • Categories
    • Register
    • Login

    OverlayMidiPanel: keep dragged MIDI file saved inside the plugin

    Scheduled Pinned Locked Moved General Questions
    2 Posts 2 Posters 113 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.
    • lijas90L
      lijas90
      last edited by

      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);
      
      
      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @lijas90
        last edited by

        @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.

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

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

        15

        Online

        2.0k

        Users

        12.8k

        Topics

        111.1k

        Posts