Hallo, Hans-Christoph Steiner hat gesagt: // Hans-Christoph Steiner wrote:
So I fixed a couple bugs in Pd-devel and added a new feature which I'd like feedback on:
Here's some quick feedback, it's all IMO, of course.
I created a system for associating pd patches to file extensions and created an example wav.pd for opening .WAVs. Basically, create a patch using the text "$FILENAME" for the filename should go, name it after the file extension (i.e. wav.pd), then drop it into 'pd/associations'. On start-up, Pd will set up the associations for that filetype. When you then open a .wav in Pd, it will open wav.pd, replace $FILENAME with the complete path, then create the patch by sending the contents of wav.pd to pd.
I think, that the $FILENAME syntax is a bit strange in adding another meaning to dollar signs in messages. Having a message without any incoming connection do something is pretty mysterious. I'd very much prefer a receiver message coming in through [r pd] and tagged accordingly like:
[r pd] | [route dnd] | [route wav] | [s $0-dropped-wavefile]
Alternatively and IMO even better would be to use an object like:
[draganddrop wav] | [s $0-dropped-wavefile]
The next step would be to use this for drag-n-drop functionality, so when you drop an associated file on a canvas (i.e. voice.wav), it would copy-n-paste the contents of wav.pd to that canvas, with the $FILENAME replacement.
Thoughts, objections, comments, improvements?
In general the global registering of filetypes in my view is too restrictive. I'm pretty sure, that if I'd want to use d'n'd, I'd want it to do different things depending on which canvas I drop it in. A sample might be played, when dropped on a sample player, and it might be loaded into a table when used in a sample bank. The only useful way to make "wav.pd" work for everything with your system then would be:
[symbol $FILENAME( | [s DROPPED_FILE]
and then we could just directly use a receiver like above.
Third: I'd don't like, that some information about what the associations patch does is encoded in the filename rsp. object name "wav.pd", which is a bit against Pd's loose convention of having patches retain crucial information when printed. [route wav] would better fit this philosophy.
However patchers should also remember, that some systems (the command line, RjDj, ...) don't support drag and drop at all.
Ciao