Can one drag and drop MIDI from a JUCE plug-in to the DAW timeline?

Can one drag and drop MIDI from a JUCE plug-in to the DAW timeline?


I’m pretty sure @Rail_Jon_Rogut did it for his plugin

As long as the DAW supports it… yes… Just create a temporary MIDI File and drag/drop that… then clean up the temporary file.


So which DAWs support it?

All that I can think of… as long as they accept dropping a Standard MIDI File onto the timeline… it’ll work… There may be some esoteric DAW that may not support that (which is why I put in the disclaimer).


1 Like

Yes. Works at least in Logic and Ableton on MacOS.

Hi, how do I make the file draggable from a JUCE component? thx


1 Like

Any chance you can post some code here on how you did it? Thanks.

File outf = File::getSpecialLocation( File::SpecialLocationType::tempDirectory ).getChildFile( "file.mid" );

MidiFile            mf;
MidiMessageSequence ms;

ms.addEvent( MidiMessage::textMetaEvent( 3, "Clip Name" );
ms.addSequence( m_ms.get_midi( m_index ), 0 );

mf.setTicksPerQuarterNote( 24 );
mf.addTrack( ms );

if ( ScopedPointer<FileOutputStream> p_os = outf.createOutputStream() ) {
    mf.writeTo( *p_os, 0 );

    DBG( "drag clip file name: " << outf.getFullPathName() );

    performExternalDragDropOfFiles( { outf.getFullPathName() }, false, nullptr, [ =, &mel_sauce ] ( void ) {
        DBG( "clip dropped" );
    } );