Module Duplex.Application
The generic application class for Duplex.
Supplies any class that extend it with basic methods like start, stop, idle time notifications.
Applications are instantiated by the Duplex Browser, and all .lua files in the Duplex/Applications folder are included on startup. To create a new Duplex application, you must extend this class and put it in that folder.
Functions
__init (...) | Initialize the Application class |
start_app (start_running) | Start/resume application |
stop_app () | Stop application, set active flag to false |
_build_app () | Create application (build interface) |
destroy_app () | Destroy application: unregister components, set to inactive state (not actually a used feature anymore?) |
on_idle () | Handle idle updates for the application (nothing is done by default) |
on_release_document () | Called when releasing the active document |
on_new_document () | Called when a new document becomes available |
on_window_resigned_active () | Called when window loose focus |
on_window_became_active () | Called when window receive/regain focus |
on_keypress (key) | Receive keypress events from the Duplex Browser dialog |
_apply_palette (palette) | Assign matching palette entries |
_check_mappings (mappings) | Check mappings: should be called before application is started |
_build_options (process) | Create application options dialog |
_add_option_row (t, key, process) | Build a row of option controls |
_set_option (key, val, process) | Set option value |
_add_component (c) | Register a UIComponent so we can automatically remove it when exiting |
list_mappings_and_options (app) | (For documentation) print application summary in markdown syntax |
__tostring () | Return the type of application (class name) |
__eq (other) | Compare application to another class instance (check for object identity) |
Tables
default_options | (table) the application default options, are overridden by any user- specified choice (those are stored in Preferences.xml) |
available_mappings | (table) the default mappings for this class eacb named entry can contain the following fields |
default_palette | (table) specify custom colors, values and text for the application, e.g. |
Fields
self._process | (Duplex.BrowserProcess) where our application got instantiated |
self.mappings | (table) imported from device-config |
self.palette | (table) imported from device-config |
self.options | (table) imported from application default options |
self.display | (Duplex.Display) the display associated with our process |
self._app_name | (string) this is the name of the application as it appears in the device configuration, e.g. |
self.active | (bool) when the application is inactive, it should sleep during idle time and ignore any user input |
self._created | (bool) true once build_app has been run |
self._vb | (renoise.ViewBuilder) the options view |
self._settings_view | (renoise.Views.View) the settings view |
self._ui_components | (table) UIComponents registered via add_component method |
Functions
- __init (...)
-
Initialize the Application class
Parameters:
- ...
(VarArg), containing:
- process (Duplex.BrowserProcess)
- mappings (table)
- palette (table)
- options (table)
- config_name (string)
- ...
- start_app (start_running)
-
Start/resume application
Parameters:
- start_running (bool) when requested to auto-start
Returns:
-
bool or nil, false when application failed to start
- stop_app ()
- Stop application, set active flag to false
- _build_app ()
-
Create application (build interface)
Returns:
-
(bool) true when application was built. Can fail e.g. when a
device configuration fails to provide a required mapping
- destroy_app ()
- Destroy application: unregister components, set to inactive state (not actually a used feature anymore?)
- on_idle ()
- Handle idle updates for the application (nothing is done by default)
- on_release_document ()
- Called when releasing the active document
- on_new_document ()
- Called when a new document becomes available
- on_window_resigned_active ()
- Called when window loose focus
- on_window_became_active ()
- Called when window receive/regain focus
- on_keypress (key)
-
Receive keypress events from the Duplex Browser dialog
Parameters:
- key
(table) forwarded from the keyhandler
key = { name, -- name of the key, like 'esc' or 'a' - always valid modifiers, -- modifier states. 'shift + control' - always valid character, -- character representation of the key or nil note, -- virtual keyboard piano key value (starting from 0) or nil repeated, -- true when the key is soft repeated (hold down) }
Returns:
-
(bool) if false, key event is not forwarded to Renoise
- key
- _apply_palette (palette)
-
Assign matching palette entries
Parameters:
- palette (table)
- _check_mappings (mappings)
-
Check mappings: should be called before application is started
Parameters:
- mappings (table) available_mappings
Returns:
-
bool, false if missing group-names were encountered
- _build_options (process)
-
Create application options dialog
Parameters:
- process (Duplex.BrowserProcess)
- _add_option_row (t, key, process)
-
Build a row of option controls
Parameters:
- t
- key
- process
Returns:
-
renoise.Views.View
- _set_option (key, val, process)
-
Set option value
Parameters:
- key (string) the key to change
- val (int or string) the value to change
- process (Duplex.BrowserProcess) supply this parameter to modify the persistent settings
- _add_component (c)
-
Register a UIComponent so we can automatically remove it when exiting
Parameters:
- list_mappings_and_options (app)
-
(For documentation) print application summary in markdown syntax
Parameters:
- app
- __tostring ()
-
Return the type of application (class name)
Returns:
-
string
- __eq (other)
-
Compare application to another class instance (check for object identity)
Parameters:
- other
Returns:
-
bool
Tables
- default_options
- (table) the application default options, are overridden by any user- specified choice (those are stored in Preferences.xml)
- available_mappings
-
(table) the default mappings for this class
eacb named entry can contain the following fields
Fields:
- description
- distributable
- flipped
- greedy
- orientation
- toggleable
- default_palette
-
(table) specify custom colors, values and text for the application, e.g.
button_on = { color={0xFF,0x80,0x00}, text="▼", val=true }, button_off = { color={0x00,0x00,0x00}, text="▼", val=false },
Fields
- self._process
- (Duplex.BrowserProcess) where our application got instantiated
- self.mappings
- (table) imported from device-config
- self.palette
- (table) imported from device-config
- self.options
- (table) imported from application default options
- self.display
- (Duplex.Display) the display associated with our process
- self._app_name
- (string) this is the name of the application as it appears in the device configuration, e.g. "MySecondMixer" - used for looking up the correct preferences-key when specifying custom options
- self.active
- (bool) when the application is inactive, it should sleep during idle time and ignore any user input
- self._created
- (bool) true once build_app has been run
- self._vb
- (renoise.ViewBuilder) the options view
- self._settings_view
- (renoise.Views.View) the settings view
- self._ui_components
- (table) UIComponents registered via add_component method