DragAndDropContainer in Logic Pro (macOS 12.2.1)

Hi,

I have a code which drag and drop midi file from the plugin to a DAW. In every DAW I tested before it works (in Logic Pro with BigSur it works too). But in Logic Pro (macOS 12.2.1) it doesn’t work.

My code:

       File tempFile = File::getSpecialLocation( File::SpecialLocationType::tempDirectory ).getChildFile( "myfile.mid" );
                
       FileOutputStream fos(tempFile);
       midiFile.writeTo(fos, 1);
                
       const StringArray files = { tempFile.getFullPathName() };
       const bool canMoveFiles = true;
                
       DragAndDropContainer::performExternalDragDropOfFiles (files, canMoveFiles, nullptr,
                                                                                    [=](void){ tempFile.deleteFile(); });
       fos.flush();

Any ideas how to fix it?

Thank you.

I have tested it on 12.0.1 and I was able to drag and drop MIDI to the arrange view in logic x from my plugin.

I call it this way:

DragAndDropContainer::performExternalDragDropOfFiles(files, false);

I wonder why you flush after the performExternalDragDropOfFiles call?

Edit: I didn’t call flush in my case:

        File file(File::addTrailingSeparator(File::getSpecialLocation(File::tempDirectory).getParentDirectory()).getChildFile(Uuid().toString() + ".mid"));
        FileOutputStream outputStream(file);
        midiFile.writeTo(outputStream);
        return file.getFullPathName();

Are you testing on an Intel machine each time? If your Monterey machine is running on Arm rather than Intel, then perhaps the issue is to do with the plugin being run in a dedicated process.

Have you tried debugging at all? Does writing to tempFile definitely succeed before starting the drag, for example?

My computer is running on Intel, but we test it on M1 too. But I don’t have an option to debug it with M1. For instance, Cubase (M1) is working. Now we see this problem only in Logic Pro with M1.

Are you sure that it must be false as a second parameter?

I tested on an M1 machine. I don’t think it’s required to set the second parameter to true. It’s maybe safer to set it to false, especially if you delete the file afterward. But I’m not sure. You have to try it out.

1 Like

Tried. But on M1 Logic Pro Monterey still not working

I would try if you can drag and drop the temp file manually from the temp folder into logic x.

Interesting.
I changed

DragAndDropContainer::performExternalDragDropOfFiles (files, false, nullptr,
                                                                                    [=](void){ tempFile.deleteFile(); }

to

DragAndDropContainer::performExternalDragDropOfFiles(files, false);

And now it works.

1 Like