Jump to content


Photo

preset handling


  • Please log in to reply
4 replies to this topic

#1 catchphrase

catchphrase

    Super Advanced Member

  • Normal Members
  • PipPipPipPip
  • 139 posts
  • Gender:Male
  • Location:Germany

Posted 20 December 2016 - 13:52

Hi LUA experts,

 

I like to implement preset-management into my tool. Is there already a canonical way to do this (I am speaking a ?lib from danoise somewhere) or shall I use standard LUA function to just write a text file to disk or are there any recommended XML libs for this?

 

Which route shall I take?

 

Thank you very much for your thoughts,

 

  catchphrase


Edited by catchphrase, 20 December 2016 - 13:53.

Tools:
Moveit

#2 danoise

danoise

    Probably More God or Borg Than Human Member

  • Renoise Team
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6490 posts
  • Gender:Male
  • Location:Berlin
  • Interests:wildlife + urban trekking

Posted 20 December 2016 - 14:21

Is there already a canonical way to do this (I am speaking a ?lib from danoise somewhere) 

 

Haha, I am flattered  ;)

Take a look in the Renoise.Application.API, it contains a bunch of features for exchanging presets. 

 

Also, thread of interest: 

http://forum.renoise...preset-via-lua/


  • catchphrase likes this

Tracking with Stuff. API wishlist | Soundcloud


#3 catchphrase

catchphrase

    Super Advanced Member

  • Normal Members
  • PipPipPipPip
  • 139 posts
  • Gender:Male
  • Location:Germany

Posted 20 December 2016 - 14:29

Thanks a bunch, will have a look!

 

EDIT:

Ah, well, not sure if I made myself clear enough.

 

My tool has a certain state (set of variables), and I like to save this set of variables as presets, as for example the Epic Arpeggiator did. Preferably in correct XML.

 

EDIT2:

You are pointing me to DocumentNode, aren't you? I think, I get the idea...


Edited by catchphrase, 20 December 2016 - 14:43.

Tools:
Moveit

#4 danoise

danoise

    Probably More God or Borg Than Human Member

  • Renoise Team
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 6490 posts
  • Gender:Male
  • Location:Berlin
  • Interests:wildlife + urban trekking

Posted 20 December 2016 - 18:14

My tool has a certain state (set of variables), and I like to save this set of variables as presets, as for example the Epic Arpeggiator did

 

Aha, OK yes - now I get it. 

For simple tools that have a fixed set of preferences you can simply instantiate the renoise.tool().preferences. 

 

Lookie here:

https://github.com/r...ol.API.lua#L336

 

What it's doing, technically, is to create an instance of renoise.Document.DocumentNode, which is associated with the tool and automatically loaded on startup. Also, any values that change are automatically saved to the document (not immediately, but as the tool or Renoise is unloaded). 

 

When/if you need more complex stuff I would suggest looking into extending the renoise.Document.DocumentNode as a class, or possibly, invent your own solution. 

 

Here is an example tool I did for Raul which (among other things) implements the renoise prefs as a class. Could be used as a starting point? 

http://forum.renoise...nside/?p=353456


Tracking with Stuff. API wishlist | Soundcloud


#5 catchphrase

catchphrase

    Super Advanced Member

  • Normal Members
  • PipPipPipPip
  • 139 posts
  • Gender:Male
  • Location:Germany

Posted 21 December 2016 - 07:21

This can be perfectly used as a starting point, thank you very much!
Tools:
Moveit