Module cObservable
Be 'smart' about observable properties in the Renoise API .
#
This class tries to be clever and provide 'inside knowledge' about properties. For example, the valid range of a "selected_instrument_index" is an integer with a minimum of 1
For now, we only care about the "first level" properties - the ones that belong to the song object.
Functions
set_mode (mode) | automatically attach to song (auto-renew registered observables) |
get_by_type (str_type, array) | get a specific type of observable |
get_by_type_and_name (str_type, str_obs, str_prefix) | combine the above search with a match for a given name |
get_keys_by_type (str_type, prefix, arr) | return a 'flattened' list of observable names, e.g. |
detach (obs, arg1, arg2) | Remove notifier - wrap in protected call (when observables are gone) supports all three combinations of arguments: function or (object, function) or (function, object) |
attach (obs, arg1, arg2) | Add notifier, while checking for / removing existing one supports all three combinations of arguments: function or (object, function) or (function, object) |
retrieve_observable (obs) | support the use of string-based observable names |
list_remove (obs, val) | remove all entries from ObservableXXXList with specified value |
list_add (obs, val) | add to ObservableXXXList when not already present |
get_song_names (prefix) | return table containing all names (using .dot syntax) |
Functions
- set_mode (mode)
-
automatically attach to song (auto-renew registered observables)
Parameters:
- mode
- get_by_type (str_type, array)
-
get a specific type of observable
Parameters:
- str_type , string ("boolean","number" or "string")
- array , list of cObservable descriptors
Returns:
-
table or nil
- get_by_type_and_name (str_type, str_obs, str_prefix)
-
combine the above search with a match for a given name
Parameters:
- str_type (string), one of xStreamArg.BASE_TYPES
- str_obs (string), e.g. "transport.keyboard_velocity_enabled_observable"
- str_prefix (string), e.g. "rns."
- get_keys_by_type (str_type, prefix, arr)
-
return a 'flattened' list of observable names, e.g.
"transport.keyboard_velocity_enabled_observable"
Parameters:
- str_type (string), one of xStreamArg.BASE_TYPES
- prefix (string), e.g. "rns."
- arr (table) supply observables (when we got them)
Returns:
-
table
- detach (obs, arg1, arg2)
-
Remove notifier - wrap in protected call (when observables are gone)
supports all three combinations of arguments:
function or (object, function) or (function, object)
Parameters:
- obs (renoise.Document.ObservableXXX)
- arg1 (function or object)
- arg2 (function or object)
Returns:
- bool, true when attached
- string, error message when failed
- attach (obs, arg1, arg2)
-
Add notifier, while checking for / removing existing one
supports all three combinations of arguments:
function or (object, function) or (function, object)
Parameters:
- obs (renoise.Document.ObservableXXX)
- arg1 (function or object)
- arg2 (function or object)
Returns:
- bool, true when attached
- string, error message when failed
- retrieve_observable (obs)
-
support the use of string-based observable names
Parameters:
- obs (string or ObservableXXX)
Returns:
-
ObservableXXX
- list_remove (obs, val)
-
remove all entries from ObservableXXXList with specified value
Parameters:
- obs
- val
- list_add (obs, val)
-
add to ObservableXXXList when not already present
Parameters:
- obs
- val
- get_song_names (prefix)
-
return table containing all names (using .dot syntax)
Parameters:
- prefix