Module Duplex.OscDevice

A generic OSC device class, providing the ability to send and receive OSC.

Changes

0.99.3

- Ability to dump OSC message to console (just like MIDI messages)
- Feedback prevention: optionally block messages that appear to be echoed back

0.99.2

- strip non-ascii character from text before sending
- "pattern captures" - reconstruct when sending outgoing OSC message

0.98.27

- support text values

0.98.14

- optional, per-device message bundling (for example, TouchOSC)
  ..no more lost messages on wireless devices?

0.9

- First release

Functions

__init (name, message_stream, prefix, address, port_in, port_out) Initialize OSCDevice class
open () Create the OSC client/server sockets, set prefix (if any)
socket_error (error_message) An error happened in the servers background thread (this should not happen)
socket_message (socket, binary_data) Receive/unpack osc messages - this is a low-level method which will receive incoming messages and translate them into a text representation
receive_osc_message (value_str) Look up value, once we have unpacked the message
release () Release the device
set_device_prefix (prefix) Set prefix for this device (a pattern which is appended to all outgoing traffic, and also act as a filter for incoming messages)
queue_osc_message (message, value) Queue a message instead of sending it right away.
on_idle () Bundle & send queued messages
send_osc_bundle () Send a queued bundle of OSC messages
send_osc_message (message, value) Send a OSC message right away.
_construct_osc_message (message, value) Construct OSC message (used by send_osc_message & send_osc_bundle)
_unpack_messages (message_or_bundle, messages) Recursively unpacks all OSC messages from the given bundle or message.
_produce_entry (vars, value) Produce an OSC message value entry (utilized by _construct_osc_message).
_msg_to_string (msg) Create string representation of OSC message: e.g.

Fields

self.prefix (string) optional device prefix, e.g.
self.address (address) can be an IP address or a domain
self.port_in (int) the port where incoming messages arrive
self.port_out (int) the port where outgoing messages leave
self.bundle_messages (bool) whether we should bundle OSC messages (true) or not (false).
self.client (renoise.Socket.SocketClient)
self.server (renoise.Socket.SocketServer)
self.message_queue (table) containing queued messages.


Functions

__init (name, message_stream, prefix, address, port_in, port_out)
Initialize OSCDevice class

Parameters:

  • name (string) the friendly name of the device
  • message_stream (Duplex.MessageStream) the msg-stream we should attach to
  • prefix (string) the OSC prefix to use
  • address (string) the OSC address (can be an IP address)
  • port_in (int) the OSC input port
  • port_out (int) the OSC output port
open ()
Create the OSC client/server sockets, set prefix (if any)
socket_error (error_message)
An error happened in the servers background thread (this should not happen)

Parameters:

  • error_message
socket_message (socket, binary_data)
Receive/unpack osc messages - this is a low-level method which will receive incoming messages and translate them into a text representation

Parameters:

  • socket (a "dummy" socket, contains socket.port and socket.address)
  • binary_data (raw, packetized socket data)
receive_osc_message (value_str)
Look up value, once we have unpacked the message

Parameters:

  • value_str (string), control-map string
release ()
Release the device
set_device_prefix (prefix)
Set prefix for this device (a pattern which is appended to all outgoing traffic, and also act as a filter for incoming messages)

Parameters:

  • prefix (string)
queue_osc_message (message, value)
Queue a message instead of sending it right away. Some devices need data to arrive in fewer packets due to network conditions

Parameters:

  • message (string) the message string
  • value (number, string or table) the value(s) to inject
on_idle ()
Bundle & send queued messages
send_osc_bundle ()
Send a queued bundle of OSC messages

See also:

send_osc_message (message, value)
Send a OSC message right away. This is the method being used by the Display for updating the visual state of device

Parameters:

  • message (string) the message string, e.g. "/device/button %i"
  • value (number or table) the value(s) to inject
_construct_osc_message (message, value)
Construct OSC message (used by send_osc_message & send_osc_bundle)

Parameters:

  • message (string) the message string, e.g. "/device/button %i"
  • value (number or table) the value(s) to inject
_unpack_messages (message_or_bundle, messages)
Recursively unpacks all OSC messages from the given bundle or message.
when messageorbundle is a single message, only this one will be added to the given message list

Parameters:

  • message_or_bundle (renoise.Osc.Message or renoise.Osc.Bundle)
  • messages (table) table to insert unpacked messages into
_produce_entry (vars, value)
Produce an OSC message value entry (utilized by _construct_osc_message).

Note that if only "vars" is defined, it will be treated as a standalone floating-point value. Otherwise, "vars" will indicate the type of value

Parameters:

  • vars

    (number or string), value or the type of value

    "%i" = integer number
    "%f" = floating-point
    "%s" = string (ascii)
    
  • value (number)
_msg_to_string (msg)
Create string representation of OSC message: e.g. "/this/is/the/pattern 1 2 3"

Parameters:

  • msg (renoise.Osc.Message)

Fields

self.prefix
(string) optional device prefix, e.g. "/duplex"
self.address
(address) can be an IP address or a domain
self.port_in
(int) the port where incoming messages arrive
self.port_out
(int) the port where outgoing messages leave
self.bundle_messages
(bool) whether we should bundle OSC messages (true) or not (false). Enable this feature if you experience lost packets, and/or is using devices that communicate over wireless networks (see TouchOSC class)
self.client
(renoise.Socket.SocketClient)
self.server
(renoise.Socket.SocketServer)
self.message_queue

(table) containing queued messages.

[1] = {
  message = (string) -- e.g. "/device/button %i"
  value = (number or table) -- the current value
},...
generated by LDoc 1.4.2