TouchOSC

Next generation modular control surface
TouchOSC Manual

Script · Objects · Messages


Script objects representing the different types of messages associated with a control.

The objects representing the different message types described here can be accessed via a control's messages field.



MIDIMessage

An object representing a single MIDI message in a control's list of MIDI messages.


Fields

The following fields allow to dynamically configure some of the same properties that are available in the editor UI.

 

message.enabled


-- example
self.messages.MIDI[1].enabled = false
since 1.2.6.185

A boolean value. Enable or disable the message.

See Editor · Messages · MIDI.

 

message.send


-- example
self.messages.MIDI[1].send = false
since 1.2.6.185

A boolean value. Enable or disable the sending of the message.

See Editor · Messages · MIDI.

 

message.receive


-- example
self.messages.MIDI[1].receive = false
since 1.2.6.185

A boolean value. Enable or disable the receiving of the message.

See Editor · Messages · MIDI.

 

message.feedback


-- example
self.messages.MIDI[1].feedback = false
since 1.2.6.185

A boolean value. Enable or disable allowing message feedback (sending) immediately after receiving.

See Editor · Messages · MIDI.

 

message.connections


-- example
local firstMessage = self.messages.MIDI[1]
firstMessage.connections[1] = false
firstMessage.connections[3] = true
print(#firstMessage.connections)
> 5
since 1.2.6.185

A list of boolean values for each of the connections the message should be sent or received on.

This list currently has five entries, but the number is subject to change in a future release and will always be the same number as connections available in the MIDI connection configuration.

See Editor · Messages · MIDI.


Functions

 

message:trigger()


-- example
self.messages.MIDI[1]:trigger()
since 1.2.9.200

Trigger and potentially send the message.

Process the message in the same way as if one of its configured triggers had been set. If both the Enabled and Send fields of the message are enabled, the message will be sent on its configured connections.

See Editor · Messages · MIDI.

 

message:data()


-- example
local message_data = self.messages.MIDI[1]:data()
sendMIDI(message_data) -- send on all connections
sendMIDI(message_data, {true, false, false, false, false}) -- send on first connection
sendMIDI(message_data, self.messages.MIDI[1].connections) -- send on message's configured connections
since 1.2.9.200

Return the message data prepared for sending.

Process the message based on its current configuration and return the message data in the format used by the sendMIDI and onReceiveMIDI functions (ie a list of byte values making up the MIDI message).

Note: The Enabled and Send fields will not be considered.

See Script · Global Functions · MIDI Messages.

 


OSCMessage

An object representing a single OSC message in a control's list of OSC messages.


Fields

The following fields allow to dynamically configure some of the same properties that are available in the editor UI.

 

message.enabled


-- example
self.messages.OSC[1].enabled = false
since 1.2.6.185

A boolean value. Enable or disable the message.

See Editor · Messages · OSC.

 

message.send


-- example
self.messages.OSC[1].send = false
since 1.2.6.185

A boolean value. Enable or disable the sending of the message.

See Editor · Messages · OSC.

 

message.receive


-- example
self.messages.OSC[1].receive = false
since 1.2.6.185

A boolean value. Enable or disable the receiving of the message.

See Editor · Messages · OSC.

 

message.feedback


-- example
self.messages.OSC[1].feedback = false
since 1.2.6.185

A boolean value. Enable or disable allowing message feedback (sending) immediately after receiving.

See Editor · Messages · OSC.

 

message.connections


-- example
local firstMessage = self.messages.OSC[1]
firstMessage.connections[1] = false
firstMessage.connections[3] = true
print(#firstMessage.connections)
> 5
since 1.2.6.185

A list of boolean values for each of the connections the message should be sent or received on.

This list currently has five entries, but the number is subject to change in a future release and will always be the same number as connections available in the OSC connection configuration.

See Editor · Messages · OSC.


Functions

 

message:trigger()


-- example
self.messages.OSC[1]:trigger()
since 1.2.9.200

Trigger and potentially send the message.

Process the message in the same way as if one of its configured triggers had been set. If both the Enabled and Send fields of the message are enabled, the message will be sent on its configured connections.

See Editor · Messages · OSC.

 

message:data()


-- example
local message_data = self.messages.OSC[1]:data()
sendOSC(message_data) -- send on all connections
sendOSC(message_data, {true, false, false, false, false}) -- send on first connection
sendOSC(message_data, self.messages.OSC[1].connections) -- send on message's configured connections
since 1.2.9.200

Return the message data prepared for sending.

Process the message based on its current configuration and return the message data in the format used by the sendOSC and onReceiveOSC functions.

Note: The Enabled and Send fields will not be considered.

See Script · Global Functions · OSC Messages.

 


LocalMessage

An object representing a single Local message in a control's list of Local messages.


Fields

The following fields allow to dynamically configure some of the same properties that are available in the editor UI.

 

message.enabled


-- example
self.messages.LOCAL[1].enabled = false
since 1.2.6.185

A boolean value. Enable or disable the message.

See Editor · Messages · Local.


Functions

 

message:trigger()


-- example
self.messages.LOCAL[1]:trigger()
since 1.2.9.200

Trigger and potentially send the message.

Process the message in the same way as if one of its configured triggers had been set. If the Enabled field of the message is enabled, the message will be sent.

See Editor · Messages · LOCAL.

 


GamePadMessage

An object representing a single Gamepad message in a control's list of Gamepad messages.

The following fields allow to dynamically configure some of the same properties that are available in the editor UI.

 

message.enabled


-- example
self.messages.GAMEPAD[1].enabled = false
since 1.2.6.185

A boolean value. Enable or disable the message.

See Editor · Messages · Gamepad.

 

message.connections


-- example
local firstMessage = self.messages.GAMEPAD[1]
firstMessage.connections[1] = false
firstMessage.connections[3] = true
print(#firstMessage.connections)
> 4
since 1.2.6.185

A list of boolean values for each of the connections the message received on.

This list currently has four entries, but the number is subject to change in a future release and will always be the same number as connections available in the Gamepad connection configuration.

See Editor · Messages · Gamepad.

 


Cookie Policy

We use cookies to deliver website content. By continuing without changing your preferences, you agree to our use of cookies.