Module Duplex.StateController

The StateController handles states within a display/controlmap

Functions

__init (display) [Constructor] Initialize the StateController class
handle_message (msg) [Class] Interpret an incoming message, update display accordingly (this method is invoked when the MessageStream receive a message)
add_state (xarg, t) [Class] Add a state
match (msg) [Class] Match states with message - discover if message is a trigger
initialize () [Class] Called once the display has created the virtual control surface
add_view (state_id, view) [Class] Associate a parameter with a named state
toggle (state_id) [Class] toggle a named state
enable (state_id) [Class] Activate a named state
disable (state_id) [Class] Deactivate a named state
update_trigger (ui_obj, color, text, val) [Class] Update the display of a trigger-button

Tables

self.states

associative array

[string] = {          -- state name/id
  xarg = (table)      -- control-map attributes
  active = (bool)     -- current state
  triggers = [
    param = (table)   -- control-map <Param>
    ui_obj = (table)  -- instance of UIButton
  ],...
self.registered_ids (table) list of control-map elements (used when initializing)

Fields

self.display (Duplex.Display)
self.app (Duplex.Application) handles our trigger-buttons


Functions

__init (display)
[Constructor] Initialize the StateController class

Parameters:

  • display (Duplex.Display)
handle_message (msg)
[Class] Interpret an incoming message, update display accordingly (this method is invoked when the MessageStream receive a message)

Parameters:

  • msg
add_state (xarg, t)
[Class] Add a state

Parameters:

  • xarg (table)
  • t (table)
match (msg)
[Class] Match states with message - discover if message is a trigger

Parameters:

  • msg TRACE("StateController - match",msg)

Returns:

    table
initialize ()
[Class] Called once the display has created the virtual control surface
add_view (state_id, view)
[Class] Associate a parameter with a named state

Parameters:

  • state_id (string) unique name/id for the state
  • view (table) control-map parameter
toggle (state_id)
[Class] toggle a named state

Parameters:

  • state_id (string) unique name/id for the state
enable (state_id)
[Class] Activate a named state

Parameters:

  • state_id (string) unique name/id for the state
disable (state_id)
[Class] Deactivate a named state

Parameters:

  • state_id (string) unique name/id for the state
update_trigger (ui_obj, color, text, val)
[Class] Update the display of a trigger-button

Parameters:

  • ui_obj (Duplex.UIButton)
  • color (table) 8-bit r/g/b values
  • text (string) button or label text
  • val (number or table) as defined by the UIComponent

Tables

self.states

associative array

[string] = {          -- state name/id
  xarg = (table)      -- control-map attributes
  active = (bool)     -- current state
  triggers = [
    param = (table)   -- control-map <Param>
    ui_obj = (table)  -- instance of UIButton
  ],...
  params = (table)    -- table of control-map params
    [1] = {
      xarg = (table)
    }
},...
self.registered_ids
(table) list of control-map elements (used when initializing)

Fields

self.display
(Duplex.Display)
self.app
(Duplex.Application) handles our trigger-buttons
generated by LDoc 1.4.2