Module Duplex.Device

The Device class is the base class for any OSC or MIDI device.

It also contains methods for managing basic device settings

Changes

0.99.4

- Changed the interpretation of "colorspace": monochrome devices are
  now specified as {1} instead of {1,1,1}

0.99.2

- output_to_value now split into submethods (output_number/boolean/text)
  (including ability to produce completely custom output to device)

0.9

- First release

Functions

__init (name, message_stream, protocol) Initialize the Device class
get_protocol () Retrieve the protocol of this device.
set_control_map (xml_file) Set the device to the provided control-map, including memoizing of patterns (making pattern-matching a lot more efficient)
quantize_color (color, colorspace) Function for quantizing RGB color values to a device color-space.
show_settings_dialog (process) Open the device settings dialog.
_build_settings () Construct the device settings view (for both MIDI and OSC devices).
_send_message (msg, param, regex) Construct & send internal messages (for both MIDI and OSC devices).
output_value (pt, xarg, ui_obj) Convert values into a something that the display & device can understand.
output_text (pt, xarg, ui_obj) output a text-based value (e.g.
output_boolean (pt, xarg, ui_obj) represents a button's lit state and will output either min or max (only relevant for basic, monochrome buttons)
output_number (pt, xarg, ui_obj) scale a numeric value from our UIComponent range to the range of the external device (for example, from decibel to 0-127)

Tables

self._feedback_buffer (table) indexed table of the most recent messages, stored as strings...

Fields

self.name this is the 'friendly name' of the device (any/all characters are supported)
self.protocol MIDI or OSC?
self.message_stream transmit messages through this stream
self.control_map create our control-map
self.default_parameter_mode (Duplex.Globals.PARAM_MODE) the default parameter mode
self.loopback_received_messages allow sending back the same messages we got from the device as answer to the device.
self.allow_zero_velocity_note_on allow Duplex to transmit MIDI note-on messages with zero velocity (normally, such a message is converted to note-off just before being sent)
self.feedback_prevention_enabled (bool) feedback prevention: when connected to an external source that simply echoes anything back, this will help us avoid getting bogged down ignore messages that bounce back within a certain time window - only applies to messages that can be reconstructed (no wildcards)
self.parameter_caching (bool) memoize previously matched parameters (more efficient)
self._vb renoise.Viewbuilder
self._settings_view renoise.Views.View


Functions

__init (name, message_stream, protocol)
Initialize the Device class

Parameters:

get_protocol ()
Retrieve the protocol of this device.

Returns:

    Duplex.Globals.DEVICE_PROTOCOL
set_control_map (xml_file)
Set the device to the provided control-map, including memoizing of patterns (making pattern-matching a lot more efficient)

Parameters:

  • xml_file (String) path to file
quantize_color (color, colorspace)
Function for quantizing RGB color values to a device color-space.

Parameters:

  • color (table), RGB colors
  • colorspace (table), colorspace

Returns:

    (table), the quantized color
show_settings_dialog (process)
Open the device settings dialog.

Parameters:

_build_settings ()
Construct the device settings view (for both MIDI and OSC devices).

Returns:

    renoise.ViewBuilder.view
_send_message (msg, param, regex)
Construct & send internal messages (for both MIDI and OSC devices). this function is invoked by the device class when a new message is received, and will populate the message with properties that are device-independent before sending it off to the Duplex.MessageStream

Parameters:

output_value (pt, xarg, ui_obj)
Convert values into a something that the display & device can understand.

Each type of value (number, boolean or text) is handled by a specific submethod: output_number, output_boolean, output_text

Numbers are generally used for dials and faders, booleans are used for objects with an on/off state (buttons), and text is used for things like labels and segmented displays

Depending on the device, you might want to override these submethods with your own implementation. For example, the Launchpad has it's own method for converting a value into a color. You can also implement your own code for direct communication with the device by overriding these methods - in such a case, adding an additional boolean return value ("skip_hardware") will update the virtual display, but skip the hardware part

Parameters:

Returns:

  1. number, table or text (the value output to the display/device)
  2. bool (skip_hardware)
output_text (pt, xarg, ui_obj)
output a text-based value (e.g. for segmented text displays)

Parameters:

See also:

output_boolean (pt, xarg, ui_obj)
represents a button's lit state and will output either min or max (only relevant for basic, monochrome buttons)

Parameters:

See also:

output_number (pt, xarg, ui_obj)
scale a numeric value from our UIComponent range to the range of the external device (for example, from decibel to 0-127)

Parameters:

See also:

Tables

self._feedback_buffer
(table) indexed table of the most recent messages, stored as strings... (This is part of a simple mechanism for avoiding message feedback)

Fields

self.name
this is the 'friendly name' of the device (any/all characters are supported)
self.protocol
MIDI or OSC?
self.message_stream
transmit messages through this stream
self.control_map
create our control-map
self.default_parameter_mode
(Duplex.Globals.PARAM_MODE) the default parameter mode
self.loopback_received_messages
allow sending back the same messages we got from the device as answer to the device. some controller which cannot deal with message feedback, may want to disable this in its device class...(see also "skip_echo", which is similar but per-parameter instead of being set for the whole device)
self.allow_zero_velocity_note_on
allow Duplex to transmit MIDI note-on messages with zero velocity (normally, such a message is converted to note-off just before being sent)
self.feedback_prevention_enabled
(bool) feedback prevention: when connected to an external source that simply echoes anything back, this will help us avoid getting bogged down ignore messages that bounce back within a certain time window - only applies to messages that can be reconstructed (no wildcards)
self.parameter_caching
(bool) memoize previously matched parameters (more efficient)
self._vb
renoise.Viewbuilder
self._settings_view
renoise.Views.View
generated by LDoc 1.4.2