Hey guys - I am working on a plugin where it would be nice to have some data automatically stored and retrieved from the currently loaded .xrns song file, so that any time the user opens up this song, the plugin would have the same configuration options from last time this song was accessed. Since .xrns files are just zipped folders, I am hoping this is a problem that someone has already solved. Any clue how to do this? Thanks!
There are document related options planned that you might be able to use, but are not thoroughly written out currently.
You may be able to add some kind of hash code in the song comment info that when read again also should trigger the script to load these variables from the XML file where you stored these in.
There is a notification trigger that informs your plugin when a new song is loaded. You can make that function trigger a routine that reads the song-comments ( renoise.song().comments) and scans it for the hashcode and then applies plugin values.
– invoked each time a new document (song) was created or loaded, aka each time
– the result of renoise.song() has changed. also called when the script gets
– reloaded (only happens with the auto_reload debugging tools), in order
– to connect the new script instance to the already running document.
renoise.tool().app_new_document_observable
→ [renoise.Document.Observable object]
How can one write the song comment with the API?
I posted the one line in my paragraph, but it seems a bit sitting there too subtile between parentheses:
renoise.song().comments, _observable
→ [array of strings]
Also note that you have to send or retreive the stuff using an array.