OSClisten — Listen for OSC messages to a particular path.
On each k-cycle looks to see if an OSC message has been send to a given path of a given type.
ihandle -- a handle returned by an earlier call to OSCinit, to associate OSClisten with a particular port number.
idest -- a string that is the destination address. This takes the form of a file name with directories. Csound uses this address to decide if messages are meant for csound.
itype -- a string that indicates the types of the optional arguments that are to be read. The string can contain the characters "cdfhis" which stand for character, double, float, 64-bit integer, 32-bit integer, and string. All types other than 's' require a k-rate variable, while 's' requires a string variable.
A handler is inserted into the listener (see OSCinit) to intercept messages of this pattern.
kans -- set to 1 if a new message was received, or zero if not. If multiple messages are received in a single control period, the messages are buffered, and OSClisten can be called again until zero is returned.
If there was a message the xdata variables are set to the incoming values, as interpretted by the itype parameter. Note that although the xdata variables are on the right of an operation they are actually outputs, and so must be variables of type k, gk, S, or gS, and may need to be declared with init, or = in the case of string variables, before calling OSClisten.
The example shows a pair of floating point numbers being received on port 7770.
sr = 44100 ksmps = 100 nchnls = 2 gihandle OSCinit 7770 instr 1 kf1 init 0 kf2 init 0 nxtmsg: kk OSClisten gihandle, "/foo/bar", "ff", kf1, kf2 if (kk == 0) goto ex printk 0,kf1 printk 0,kf2 kgoto nxtmsg ex: endin