I’m having issues trying to drag an audio file out of my app and into a DAW or a file folder. My code is below. It says that it is succeeding, and sometimes it does, for a DAW.
When I drag to Studio One timeline, sometimes it drops the file properly, and sometimes it just flashes a snapshot of the waveform for an instant, which then disappears and nothing gets dropped.
When I drag to the desktop (on my Mac) or to a folder I created for testing on my desktop, it always shows the “can’t do this” icon (circle with a slash through it), and never lets me drop it anywhere. I can see the temp.wav file get created on my desktop, so I know that the “writeExportedFile()” function succeeded in writing my file.
What am I missing here? (It’s very difficult to find a complete example of doing this. People just say “use performExternalDragDropOfFiles” and the reply is “that worked”. Not exactly useful. lol.)
void PlaybackViewComponent::mouseDrag (const juce::MouseEvent& e)
{
if (!dragStarted)
{
// Export to temp file
juce::File tmpFolder = juce::File::getSpecialLocation(juce::File::userDesktopDirectory);
juce::File tmpFile = tmpFolder.getChildFile(juce::String("temp")); // TODO:
if (writeExportedFile(tmpFile))
{
if (mainComp.performExternalDragDropOfFiles({tmpFile.getFullPathName()}, true))
dragStarted = true;
}
}
}
void PlaybackViewComponent::mouseDown (const juce::MouseEvent& e)
{
if (e.mods.isAltDown())
{
dragStarted = false;
}
}
void PlaybackViewComponent::mouseUp (const juce::MouseEvent&)
{
dragStarted = false;
}
