OSCraw — Listen for all OSC messages at a given port.


On each k-cycle looks to see if an OSC message has been received at a given port and copies its contents to a string array. All messages are copied. If a bundle of messages is received, the output array will contain all of the messages in it.


Smess[],klen OSCraw iport


iport -- a port where messages are going to be received from.


Smess[] -- an array of strings containing the message components: address, types, and data items. If the array does not exist (ie. has not been initialised), one will be created with size 2. Arrays cannot grow with the size of the message, so if a message with more than 2 items (ie. with any data items) is to be fully copied into the output, a larger array needs to initialised before it is used. If a message has more items than an array has space for, it is truncated.

klen -- number of items placed in the output array. It is 0 if no message has been received, and at least 2 if a message has been received (address, types are the minimum items).

Example 712. Example.

The following CSD file demonstrates how a message is received by OSCraw:

-o dac

instr	1
 kwhen  init 0
 kmetro metro 1
 kwhen += kmetro
 OSCsend kwhen, "",7771, "/foo/bar", "f", kwhen

instr 2
Smess[] init 3
Smess,ka OSCraw 7771
kn = 0
while kn < ka do
  printf ": %s ", kn+1, Smess[kn]
  kn += 1
printf "%d items\n", ka, kn
if ka > 0 kgoto top

i1 0 10
i2 0 10

See also

OSC (Open Sound Control)

More information on this opcode: http://www.youtube.com/watch?v=JX1C3TqP_9Y , made by Andrés Cabrera


Authors: Oeyvind Brandtsegg, Victor Lazzarini

types aAG are new in Csound 6.07