Module Duplex.MessageStream

Recieve messages from connected devices and the virtual control surface.

After the type of event has been determined, the resulting Message is then directed towards relevant UIComponent event-listeners, such as DEVICEEVENT.BUTTONPRESSED.

A device can only belong to a single stream, but nothing stops the stream from recieving it's input from several devices.

Changes

0.99.3

- Ability to cache multiple matched ui-components (implemented as queue)
- Integration with StateController

0.99.1

- FIXME Caching can break multiple UIComponents listening to the same signal

0.98.27

- Caching: improve performance when many controls are present

0.96

- New Message property: is_note_off - distinguish between note-on/note-off

0.9

- First release

Functions

__init (process) Initialize the MessageStream class
on_idle () The MessageStream idle time method, checks for held buttons
input_message (msg) Here we receive a message from the device, and pass it to all the relevant UIComponents.
add_listener (obj, evt_type, handler) Register an event listener
remove_listener (obj, evt_type) Remove event listener from previously attached UIComponent
_handle_or_pass (msg, listeners, evt_type) Handle or pass: invoke event handlers or pass on to Renoise as MIDI (only valid msg context is DEVICEMESSAGE.MIDINOTE)

Tables

self._temp_cache contains entries that should be cached once a series of messages have been received

Fields

self.process (Duplex.BrowserProcess)
self.change_listeners (table) listeners for faders,dials,xy pads
self.press_listeners (table) listeners for buttons
self.hold_listeners (table) listeners for buttons
self.release_listeners (table) listeners for buttons
self.key_press_listeners (table) listeners for keys
self.key_hold_listeners (table) listeners for keys
self.key_release_listeners (table) listeners for keys
self.pitch_change_listeners (table) listeners for keys
self.channel_pressure_listeners (table) listeners for keys
self.button_hold_time (number) how long before triggering hold event
self.current_msg (Duplex.Message) most recent message
self.pressed_buttons (table of Duplex.Message) pressed buttons in order of arrival
self.message_cache

table, containing each type of event and messages by value:

[DEVICE_EVENT.BUTTON_RELEASED] = {
  "F#4|Ch1" = {[UIComponent instance],...}
},...
self.queued_messages how many messages a device is going to send


Functions

__init (process)
Initialize the MessageStream class

Parameters:

on_idle ()
The MessageStream idle time method, checks for held buttons
input_message (msg)
Here we receive a message from the device, and pass it to all the relevant UIComponents. If a listener's handler method actively reject the message (by explicitly returning false in the event-handling method), we instead (can choose to) pass the message on to Renoise as a MIDI message

Parameters:

add_listener (obj, evt_type, handler)
Register an event listener

Parameters:

remove_listener (obj, evt_type)
Remove event listener from previously attached UIComponent

Parameters:

Returns:

    (bool) true if successful, false if not
_handle_or_pass (msg, listeners, evt_type)
Handle or pass: invoke event handlers or pass on to Renoise as MIDI (only valid msg context is DEVICEMESSAGE.MIDINOTE)

Parameters:

Tables

self._temp_cache
contains entries that should be cached once a series of messages have been received

Fields

self.process
(Duplex.BrowserProcess)
self.change_listeners
(table) listeners for faders,dials,xy pads
self.press_listeners
(table) listeners for buttons
self.hold_listeners
(table) listeners for buttons
self.release_listeners
(table) listeners for buttons
self.key_press_listeners
(table) listeners for keys
self.key_hold_listeners
(table) listeners for keys
self.key_release_listeners
(table) listeners for keys
self.pitch_change_listeners
(table) listeners for keys
self.channel_pressure_listeners
(table) listeners for keys
self.button_hold_time
(number) how long before triggering hold event
self.current_msg
(Duplex.Message) most recent message
self.pressed_buttons
(table of Duplex.Message) pressed buttons in order of arrival
self.message_cache

table, containing each type of event and messages by value:

[DEVICE_EVENT.BUTTON_RELEASED] = {
  "F#4|Ch1" = {[UIComponent instance],...}
},...
self.queued_messages
how many messages a device is going to send
generated by LDoc 1.4.2