Is it possible to create a gui in SC that would allow drag and drop of an audio file to a DAW? I guess to be more clear, is it possible that grabbing a GUI element that contains a string representing a path to an audio file can somehow move that audio file to a DAW?
Yes - you can use the Class DragSource which is a GUI widget you can drag from.
See the help file for examples:
I think the answer to this is no.
If I drag a file from a file browser to, say, a nysthi QuadSimpler module in VCV Rack, it knows this is a file and accepts the drag.
If I drag the file from a file browser to a DragBoth, the drag
.object is a string with the path.
Then I can drag this path from the DragBoth to the sampler module, but it does not accept the string path in place of however the file browser represents the file.
This isn’t the problem – the problem is, what do you put into the drag source so that the other software will recognize it as a file? I don’t think we have an object for that currently.
Thank you for your replies. Paul, if you have a way that this works, can you please demonstrate?
I tried putting a SoundFile object there, but of course the DAW (Reaper) has no idea what that is. The DAW also is not happy with a string, because it is not how the browser represents the file. So, perhaps it is as hjh states … there may not be an object for the DragSource in SuperCollider that represents the audio file appropriately.
Of note, there exists a third party way to do this in Max. So, that leads me to think that some tinkering with Drag and Drop could allow it.
The ultimate goal would be to create an interface that allows the selection of parts of an audio file that could then be dragged to a DAW. But, before all that, how to drag and drop a representation of the audio file that is valid?
My mistake - I thought it just needed a string.
After digging around in the QtCollider folder, and looking at QDrag and particularly the setMimeData method … I have really no idea how I would go about making this happen. As such, I think that the question is “solved” in that this is not possible at the moment.
This was (accidentally?) possible with Ableton Live 9 OSX by dragging an Array with a soundfile path, like
[~/sounds/soundfile.wav] but after Live 10 unfortunately it doesn’t work any more.