OSSIA_Parameter:
Filter:
OSSIA/Classes (extension) | Ossia

OSSIA_Parameter
ExtensionExtension

value-holding nodes

Description

in Ossia, a parameter is a very specific kind of node, which holds values and certain types of attributes.

Class Methods

.new

the main constructor class method for parameters, certain attributes can be directly set at instantiation:

Arguments:

parent_node

required - an OSSIA_Device, OSSIA_Node or OSSIA_Parameter

name

required - the node's identifier on the network

type

required - the type of the values the parameter may hold:

  • Integer,
  • Float,
  • Boolean,
  • Impulse,
  • String,
  • Char
  • Array, or List
  • OSSIA_vec2f,
  • OSSIA_vec3f,
  • OSSIA_vec4f
domain

optional - a min/max range and/or a set of accepted values. Passing an array of two values, e.g.: [0, 127], will set the min/max range.

Passing an array of three values (with the third as an array) will set both min/max range and accepted values, e.g. : [0, 127, [0, 64, 88, 127]] .

A convenience class (OSSIA_domain) also exists.

default_value

optional - sets the value of the parameter at instantiation

bounding_mode

optional - sets the bounds' clipping mode when setting new values (defaults to 'free'):

  • 'free' - no clipping, domain is only indicative
  • 'clip' - clipped to the closest value in the range
  • 'low' - only clips values lower than the min
  • 'high' - only clips values higher than the max
  • 'wrap' - wraps values around the range
  • 'fold' - folds back values into the range
critical

OSCQuery server protocol only - if true, messages will be sent in tcp instead of classic osc-udp, this guarantees that the message will be received on the other end of the network.

repetition_filter

if true, sending the same value multiple times will have no effect, it will only send it the first time.

Returns:

an OSSIA_Parameter

Instance Methods

.access_mode

gets/sets the parameter's access mode.

Arguments:

aSymbol

accepted values are:

  • 'bi', 'both', or 'rw' - parameter value is in read-write mode.
  • 'set', 'w' - parameter value is in write-only mode (set).
  • 'get', 'r' - parameter value is in read-only mode (get).

A convenience class(OSSIA_access_mode) can also be used, e.g. OSSIA_access_mode.get

Returns:

a Symbol with the access mode identifier

.value

sets/gets the parameter's value

Arguments:

value

a value, depending on the parameter's type

Returns:

a value

.sv

shortcut, sets the parameter's value

Arguments:

value

a value

.v

shortcut, gets/sets the parameter's value

.callback

Parameter callbacks will inform you every time a parameter receives a message. On environments that support this, this will enable listening on the remote end. That is, if a remote device has no callbacks, network messages won't be sent upon modification.

Arguments:

aFunction

to be evaluated whenever the parameter updates its value, it is passed the |value| argument, e.g. :

~param.callback = { |value| format("value received: %", value).postln; }

.critical

OSCQuery protocol only - if true, messages will be sent in tcp instead of classic osc-udp, this guarantees that the message will be received on the other end of the network.

.repetition_filter

When the repetition filter is enabled, if the same value is sent twice, the second time will be filtered.

.bounding_mode

sets the bounds' clipping mode when setting new values (defaults to 'free'):

Arguments:

aSymbol

accepted values are:

  • 'free' - no clipping, domain is only indicative
  • 'clip' - clipped to the closest value in the range
  • 'low' - only clips values lower than the min
  • 'high' - only clips values higher than the max
  • 'wrap' - wraps values around the range
  • 'fold' - folds back values into the range

.domain

Domains allow to set a range of accepted values for a given parameter.

Arguments:

aList

a min/max range or a set of accepted values. Passing an array of two values, e.g.: [0, 127], will set the min/max range.

Passing an array of three values (with an Array as the third one), will set both min/max range and accepted values, e.g. [0, 127, [0, 32, 64, 88, 127]]

A convenience class (OSSIA_domain) can also be used.

.priority

Nodes with the highest priority should execute first.

.unit

Units give a semantic meaning to the value of a parameter. See reference for a complete list of units.

Arguments:

aUnit

e.g. OSSIA_color.argb

.aar

convenience method when instantiating new Synth (see OssiaReference for examples)

Returns:

an Array with the parameter's unique name and its current value

.ar

convenience method for audio-rate SynthDef-binding (see OssiaReference for examples)

.kr

convenience method for control-rate SynthDef-binding (see OssiaReference for examples)

Examples