NAME
Net::LibLO - Perl interface for liblo Lightweight OSC library
SYNOPSIS
use Net::LibLO;
my $lo = new Net::LibLO( );
$lo->add_method( "/reply", 's', \&my_handler );
$lo->send( 'osc://localhost:5600/', '/foo/bar', 's', 'Hello World' );
DESCRIPTION
Net::LibLO class is used to send and recieve OSC messages using LibLO (the Lightweight OSC library). The coding style is slightly different to the C interface to LibLO, because it makes use of perl's Object Oriented functionality.
- new( [port], [protocol] )
-
Create a new LibLO object for sending a recieving messages. If the
portis missing, then a random port number is chosen. If theprotocolis missing, than UDP is used. - send( dest, bundle )
-
Send a bundle to the sepecified destination.
destcan either be a Net::LibLO::Address object, a URL or a port.bundleshould be a Net::LibLO::Bundle object. - send( dest, path, message )
-
Send a message to the sepecified destination.
destcan either be a Net::LibLO::Address object, a URL or a port.messageshould be a Net::LibLO::Message object. - send( dest, path, typespec, params... )
-
Construct and send a message to the sepecified destination.
destcan either be a Net::LibLO::Address object, a URL or a port.pathis the path to send the message to.typespecandparamsare passed through to create the new message. - recv()
-
Block and wait to receive a single message. Returns the length of the message in bytes or number less than 1 on failure. Length of message is returned, whether the message has been handled by a method or not.
- recv_noblock( [timeout] )
-
Look for an OSC message waiting to be received. Waits for
timeoutmilliseconds for a message and then returns the length of the message, or 0 if there was no message. Use a value of 0 to return immediatly. - add_method( path, typespec, handler, userdata )
-
Add an OSC method to the specifed server.
pathis the OSC path to register the method to. Ifundefis passed the method will match all paths.typespecis OSC typespec that the method accepts. Incoming messages with similar typespecs (e.g. ones with numerical types in the same position) will be coerced to the typespec given here.handleris a reference to the method handler callback subroutine that will be called if a matching message is received.user_datais a value that will be passed to the callback subroutine, when its invoked matching from this method. - my_handler( serv, mesg, path, typespec, userdata, @params )
-
This is order of parameters that will be passed to your method handler subroutines.
servis the Net::LibLO object that the method is registered with.mesgis a Net::LibLO::Message object for the incoming message.pathis the path the incoming message was sent to.typespecIf you specided types in your method creation call then this will match those and the incoming types will have been coerced to match, otherwise it will be the types of the arguments of the incoming message.userdataThis contains the userdata value passed in the call toadd_methodparamsis an array of values associated with the message - get_port()
-
Returns the port the socket is bound to.
- get_url()
-
Returns the full URL for talking to this server.
SEE ALSO
AUTHOR
Nicholas J. Humfrey <njh@aelius.com>
COPYRIGHT AND LICENSE
Copyright (C) 2005 Nicholas J. Humfrey
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.