

ObservableBoolean/Number/String is a simple wrapper for the raw Lua base types.īasically, it just stores the corresponding value (a boolean, number, or string)Īnd maintains a list of attached notifiers. lists of document objects (dynamically sized lists of other document nodes).other document objects (create document trees).ObservableBoolean/String/NumberList (wrappers of lists for the Lua base types).ObservableBoolean/Number/String (wrappers for the "raw" Lua base types).

Types that can be in used in renoise.Documents, things that can make up a However, when dealing with unknown models or formats, you will need to research For example, when extending an already existing document format. This behaviour is, most of the time, theĭesired one. This means values which are not present in the original model Values in your document object (except for lists which are instantiatedĭynamically). Models from the source XML files, but will only assign existing corresponding Related to this, import of renoise.Documents from XML will NOT create new object You should look into using using a generic Lua table serializer instead. If all you need is a generic XML import/export (or JSON, or "insert trendyįormat here") and you don't need an Observable mechanism for your values, then The reason behind this limitation is to allow both worlds (Lua in scriptsĪnd the internal C++ objects) to fully interact with each others: scriptsĬan use existing Renoise objects, Renoise documents can be extended with e.g: theres no support for mixed types in lists, The Lua wrappers are not really "the Lua way" of solvingĪnd expressing things. If you want to create your own documents,Īll renoise.Document classes are wrappers for Renoise's internal documentĬlasses. If you only want to use the existing "_observables" in the Renoise API, Renoise.song ( ).tracks_observable:add_notifier (tracks_changed ) Notification.index1, notification.index2 ) ) end end type = "swap" ) then print ( ( "track at index: %d and %d swapped their positions" ): format ( type = "remove" ) then print ( ( "track got removed from index: %d" ): format (notification.index ) ) elseif (notification. type = "insert" ) then print ( ( "new track was inserted at index: %d" ): format (notification.index ) ) elseif (notification. Happened to the list: function tracks_changed (notification ) if (notification. When adding notifiers to lists (like the track list in a song) an additionalĬontext parameter is passed to your notifier function. Renoise.song ( ).transport.bpm_observable:remove_notifier (bpm_changed )

Renoise.song ( ).transport.bpm_observable:add_notifier (bpm_changed ) - later on, maybe: Here is a simple example: function bpm_changed ( ) print ( ( "something changed the BPM to %s" ): format ( Of callbacks, plain functions and methods (functions with a context). 'remove_notifier' from the Observable base class. For example, a view in the RenoiseĪPI is an Observer, which listens to observable values in Documents.Īttaching and removing notifiers can be done with the functions 'add_notifier', Set of raw data (booleans, numbers, lists, nested nodes) which anything canĪttach notifier function (listeners) to. This means, in order to track changes, a document is basically just a Observablesĭocuments and Views in the Renoise API are modelled after the observer pattern Please read the INTRODUCTION first to get an overview about the completeĪPI, and scripting for Renoise in general. These can also beīound to custom views, or "your own" document listeners Which can be loaded and saved as XML files by your scripts.

all "_observables" found in the Renoise Lua API areĬreate new documents (e.g persistent options, presets for your tools) The renoise.Document namespace covers all document related Renoise APIĪccessing existing Renoise document objects.
