# hs.osc

Open Sound Control (OSC) support.

This extension allows you to create both OSC Servers and Clients.

This extension was thrown together by Chris Hocking for CommandPost.

This extension uses F53OSC.

F53OSC LICENSE: Copyright (c) 2010-2020 Figure 53 LLC, https://figure53.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


# API Overview

Constructors - API calls which return an object, typically one that offers API methods

  • newClient
  • newServer

Methods - API calls which can only be made on an object returned by a constructor

  • callback
  • host
  • isActive
  • listeningPort
  • port
  • send
  • start
  • stop

# API Documentation

# Constructors

# newClient

Signature hs.osc.newClient(host, port) -> oscObject
Type Constructor
Description Creates a new OSC Client.
Parameters
  • host - A string of the host path.
  • port - A number of the port.
Returns
  • An hs.osc object or nil if an error occured.
Notes None
Examples None
Source extensions/osc/libosc.m line 167

# newServer

Signature hs.osc.newServer(listeningPort) -> oscObject
Type Constructor
Description Creates a new OSC Server.
Parameters
  • listeningPort - A number for the listening port.
Returns
  • An hs.osc object or nil if an error occured.
Notes None
Examples None
Source extensions/osc/libosc.m line 136

# Methods

# callback

Signature hs.osc:callback(callbackFn) -> oscObject
Type Method
Description Sets or removes a callback function for a OSC Server.
Parameters
  • callbackFn - a function to set as the callback for this OSC Server. If the value provided is nil, any currently existing callback function is removed.
Returns
  • The hs.osc object
Notes
  • The callback function should expect 3 arguments and should not return anything:
  • oscObject - The OSC object that triggered the callback.
  • addressParts - A table of address parts.
  • arguments - A table of arguments.
Examples None
Source extensions/osc/libosc.m line 202

# host

Signature hs.osc:host() -> string
Type Method
Description Returns the host path of a OSC Client.
Parameters
  • None
Returns
  • The host as a string.
Notes None
Examples None
Source extensions/osc/libosc.m line 278

# isActive

Signature hs.osc:isActive() -> boolean
Type Method
Description Gets whether or not a OSC Server or Client is active.
Parameters
  • None
Returns
  • true if open, otherwise false.
Notes None
Examples None
Source extensions/osc/libosc.m line 361

# listeningPort

Signature hs.osc:listeningPort() -> number
Type Method
Description Returns the listening port of a OSC Server.
Parameters
  • None
Returns
  • The port as a number.
Notes None
Examples None
Source extensions/osc/libosc.m line 244

# port

Signature hs.osc:port() -> number
Type Method
Description Returns the port of a OSC Client.
Parameters
  • None
Returns
  • The port as a number.
Notes None
Examples None
Source extensions/osc/libosc.m line 261

# send

Signature hs.osc:send(address, arguments) -> oscObject
Type Method
Description Sends a message from an OSC Client.
Parameters
  • address - A string of the OSC address.
  • arguments - A table of arguments.
Returns
  • The hs.osc object.
Notes None
Examples None
Source extensions/osc/libosc.m line 331

# start

Signature hs.osc:start() -> oscObject
Type Method
Description Starts an OSC Server or Client.
Parameters
  • None
Returns
  • The hs.osc object.
Notes None
Examples None
Source extensions/osc/libosc.m line 295

# stop

Signature hs.osc:stop() -> oscObject
Type Method
Description Stops an OSC Server or Client.
Parameters
  • None
Returns
  • The hs.osc object.
Notes None
Examples None
Source extensions/osc/libosc.m line 313