SPAOP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | List of all members
wonderlo::WonderOscSender Class Reference

A lowrappers::Address implementing the wonder::OscSender interface. More...

#include <WonderOscSender.h>

Inheritance diagram for wonderlo::WonderOscSender:
Inheritance graph
[legend]
Collaboration diagram for wonderlo::WonderOscSender:
Collaboration graph
[legend]

Public Member Functions

 WonderOscSender (const std::string &host, const std::string &port, int proto=LO_UDP)
 Constructor. More...
 
 WonderOscSender (lo_address addr, bool isOwner=true)
 Constructor. More...
 
 WonderOscSender (const WonderOscSender &other)
 Copy constructor. More...
 
virtual ~WonderOscSender ()
 Destructor. More...
 
void setAddress (const std::string &newHost, const std::string &newPort)
 Sets the destination address where this OscSender will send to. More...
 
std::string url () const
 Returns an url representing the destination address where this OscSender will send to. More...
 
std::string hostname () const
 Returns the hostname (or IP) of the destination address where this OscSender will send to. More...
 
std::string port () const
 Returns the destination port (or service name) where this OscSender will send to. More...
 
int getTtl () const
 Returns the time-to-live value for messages sent by this sender. More...
 
void setTtl (uint8_t ttl)
 Sets the time-to-live value for messages sent by this sender. More...
 
std::string getIface () const
 Returns the name of the network interface that will be used for sending messages. More...
 
void setIfaceByIp (const std::string &ip)
 Sets the network interface to use for sending to this address by its IP. More...
 
void sendSourceActivate (int id)
 Sends the /WONDER/source/activate message. More...
 
void sendSourceDeactivate (int id)
 Sends the /WONDER/source/deactivate message. More...
 
void sendSourceType (int id, int type)
 Sends the /WONDER/source/type message. More...
 
void sendSourcePosition (int id, float x, float y)
 Sends the /WONDER/source/position message. More...
 
void sendSourcePosition (int id, float x, float y, float duration)
 Sends the /WONDER/source/position message with a duration parameter. More...
 
void sendSourcePosition (int id, float x, float y, float duration, float timestamp)
 Sends the /WONDER/source/position message with a duration and a timestamp parameter. More...
 
void sendSourceAngle (int id, float angle)
 Sends the /WONDER/source/angle message. More...
 
void sendSourceName (int id, const std::string &name)
 Sends the /WONDER/source/name message, changing the source's name. More...
 
void sendSourceColor (int id, uint8_t r, uint8_t g, uint8_t b)
 Sends the /WONDER/source/color message, changing the colour to be used for that source in any GUI. More...
 
void sendSourceRotatingDirection (int id, int inverted)
 Sends the /WONDER/source/rotationDirection message, changing the rotation direction of the source. More...
 
void sendSourceScalingDirection (int id, int inverted)
 Sends the /WONDER/source/scalingDirection message, changing the scaling direction of the source. More...
 
void sendSourceDopplerEffect (int id, int on)
 Sends the /WONDER/source/dopplerEffect message, switching the doppler effect for this source on or off. More...
 
void sendListenerPosition (int listenerID, float x, float y)
 Sends the /WONDER/listener/position message, changing the position of the listener which is used to determine which speakers are used for focused sources. More...
 
void sendGlobalRenderpolygon (const std::string &roomName, int noOfVertices, wonder::Room::Vertex *vertices)
 Sends the /WONDER/global/renderpolygon message. More...
 
void sendStreamVisualConnect ()
 Sends the /WONDER/stream/visual/connect message. More...
 
void sendStreamVisualConnect (const std::string &name)
 Sends the /WONDER/stream/visual/connect message. More...
 
void sendStreamVisualConnect (const std::string &host, const std::string &port)
 Sends the /WONDER/stream/visual/connect message. More...
 
void sendStreamVisualDisconnect ()
 Sends the /WONDER/stream/visual/disconnect message. More...
 
void sendStreamVisualPing (int count)
 Sends the /WONDER/stream/visual/ping message. More...
 
void sendStreamVisualPong (int count)
 Sends the /WONDER/stream/visual/pong message. More...
 
void sendReply (const std::string &replyToMessage, int state, const std::string &message)
 Sends the /WONDER/reply message. More...
 
void sendProjectCreateWithScore (const std::string &projectName)
 Sends the /WONDER/project/createWithScore message. More...
 
void sendProjectCreate (const std::string &projectName)
 Sends the /WONDER/project/create message. More...
 
void sendProjectLoad (const std::string &projectName)
 Sends the /WONDER/project/load message. More...
 
void sendProjectSave ()
 Sends the /WONDER/project/save message without a parameter. More...
 
void sendProjectSave (const std::string &projectName)
 Sends the /WONDER/project/save message with a projectName parameter. More...
 
void sendPluginStandalone (const bool standAlone)
 Sends the /WONDER/plugin/standalone message. More...
 
- Public Member Functions inherited from lowrappers::Address
 Address (const std::string &host, const std::string &port, int proto=LO_UDP)
 Constructor. More...
 
 Address (lo_address addr, bool isOwner=true)
 Constructor. More...
 
virtual ~Address ()
 Destructor. More...
 
 Address (const Address &other)
 Copy constructor. More...
 
bool setAddress (const std::string &newHost, const std::string &newPort)
 Updates this Address to send to a new destination. More...
 
int getTtl () const
 Returns the time-to-live value for this Address. More...
 
void setTtl (uint8_t ttl)
 Sets the time-to-live value for this Address. More...
 
std::string getIface () const
 Returns the name of the network interface that will be used for sending to this address. More...
 
void setIfaceByIp (const std::string &ip)
 Sets the network interface to use for sending to this address. More...
 
std::string url () const
 An URL describing this address. More...
 
std::string hostname () const
 The hostname of this adress. More...
 
std::string port () const
 The port/service name of this adress. More...
 
int send (const std::string &path, const std::string types,...) const
 Sends a OSC formatted message to this address. More...
 
int send (const std::string &path, const Message &msg) const
 Sends a OSC formatted message to this address. More...
 
int send (const std::string &path, const lo_message msg) const
 Sends a Liblo lo_message to this address. More...
 
int sendVAList (const std::string &path, const std::string &types, va_list args) const
 Sends a OSC formatted message to this address. More...
 
int sendFrom (const ServerThread &from, const std::string &path, const std::string types,...) const
 Sends a OSC formatted message to this address, from the same socket as the specified server. More...
 
int sendFrom (const ServerThread &from, const std::string &path, const Message &msg) const
 Sends a OSC formatted message to this address, from the same socket as the specified server. More...
 
int sendFrom (const ServerThread &from, const std::string &path, const lo_message msg) const
 Sends a Liblo lo_message to this address, from the same socket that a specified ServerThread is listening on. More...
 
int sendVAListFrom (const ServerThread &from, const std::string &path, const std::string &types, va_list args) const
 Sends a OSC formatted message to this address, from the same socket that a specified ServerThread is listening on. More...
 
- Public Member Functions inherited from wonder::OscSender
virtual ~OscSender ()
 Destructor. More...
 
virtual void sendSourceColor (int sourceID, Colour colour)
 Sends the /WONDER/source/color message, changing the colour to be used for that source in any GUI. More...
 
void sendFullSourceInfo (const Source &src)
 Sends out all source-related information for one Source object (type, position, angle, colour, doppler effect setting and name). More...
 

Protected Member Functions

virtual void wonderSend (const MessageWithPath &msg)
 This method is used to send OSC messages from the various methods inherited from wonder::OscSender. More...
 

Detailed Description

A lowrappers::Address implementing the wonder::OscSender interface.

Constructor & Destructor Documentation

wonderlo::WonderOscSender::WonderOscSender ( const std::string &  host,
const std::string &  port,
int  proto = LO_UDP 
)

Constructor.

Parameters
hostA valid hostname or ip string (see the liblo documentation for what exactly is supported).
portA validport number or service name (see the liblo documentation for what exactly is supported).
protoThe protocol to use (LO_UDP, LO_TCP or LO_UNIX). See the liblo documentation for details - LO_UDP should be used for communication with the current version of WONDER.
wonderlo::WonderOscSender::WonderOscSender ( lo_address  addr,
bool  isOwner = true 
)

Constructor.

Parameters
addrThe address to sent to.
isOwnerSpecifies who is responsible for freeing the lo_address addr (by calling lo_address_free). If set to true, this WonderOscSenderobject will call lo_address_free on addr when it is destroyed or when a new Address is set. If set to false, the responsibility to call lo_address_free remains with the caller of this constructor.
wonderlo::WonderOscSender::WonderOscSender ( const WonderOscSender other)

Copy constructor.

Will create a new copy of the lo_address stored within other, so the new WonderOscSender will be owner of its lo_address while other's ownership status will remain unchanged.

Parameters
otherThe WonderOscSender to be copied.
wonderlo::WonderOscSender::~WonderOscSender ( )
virtual

Destructor.

Will call lo_address_delete on the lo_address stored internally if this WonderOscSender object is the owner of the lo_address.

Member Function Documentation

std::string wonderlo::WonderOscSender::getIface ( ) const
virtual

Returns the name of the network interface that will be used for sending messages.

This is relevant for sending multicast messages.

Returns
The name of the network interface that will be used for sending to this address. Might be "(null)" if no interface has been set.

Implements wonder::OscSender.

int wonderlo::WonderOscSender::getTtl ( ) const
virtual

Returns the time-to-live value for messages sent by this sender.

Returns
The time-to-live value for messages sent by this sender.

Implements wonder::OscSender.

std::string wonderlo::WonderOscSender::hostname ( ) const
virtual

Returns the hostname (or IP) of the destination address where this OscSender will send to.

Returns
The hostname (or IP) of the destination address where this OscSender will send to.

Implements wonder::OscSender.

std::string wonderlo::WonderOscSender::port ( ) const
virtual

Returns the destination port (or service name) where this OscSender will send to.

Returns
The destination port (or service name) where this OscSender will send to.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendGlobalRenderpolygon ( const std::string &  roomName,
int  noOfVertices,
wonder::Room::Vertex vertices 
)
virtual

Sends the /WONDER/global/renderpolygon message.

The message contains information about the positioning of the WFS speaker array of the current setup.

Parameters
roomNameA string containing the name of the transmitted room setup.
noOfVerticesThe number of vertices transmitted.
verticesAn array of three-dimensional vertex coordinates of noOfVertices length. The array is expected to be ordered in a way that vertices[x] and vertices[(x+1)noOfVertices()] are the two endpoints of an array of speakers.
See Also
Room

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendListenerPosition ( int  listenerID,
float  x,
float  y 
)
virtual

Sends the /WONDER/listener/position message, changing the position of the listener which is used to determine which speakers are used for focused sources.

Parameters
listenerIDThe ID of the listener.
xThe x-coordinate of the listener's position.
yThe y-coordinate of the listener's position.
Warning
So far, this command is only supported by a version of WONDER developed at HAW Hamburg.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendPluginStandalone ( const bool  standAlone)
virtual

Sends the /WONDER/plugin/standalone message.

This is used to change the communication mode of the SourceController class: In "standalone" mode, the SourceController sends the source controlling messages to its peers (via multicast) only. If standalone is off ("linked to wonder" mode), the SourceController sends those messages to cWONDER.

Parameters
standAlonetrue for "standalone" mode, false for "linked to wonder" mode.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendProjectCreate ( const std::string &  projectName)
virtual

Sends the /WONDER/project/create message.

This tells cWONDER to create a new project (which does not include a score from the ScorePlayer).

Check the corresponding /WONDER/reply message for possible error codes. (Codes may be: 0 for success, 1 for empty project name, 2 for "project already exists, 3 for any other error (including file i/o)).

Parameters
projectNameThe name of the new project.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendProjectCreateWithScore ( const std::string &  projectName)
virtual

Sends the /WONDER/project/createWithScore message.

This tells cWONDER to create a new project that includes a score from the ScorePlayer.

Check the corresponding /WONDER/reply message for possible error codes. (Codes may be: 0 for success, 1 for empty project name, 2 for "project already exists, 3 for any other error (including file i/o)).

Parameters
projectNameThe name of the new project.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendProjectLoad ( const std::string &  projectName)
virtual

Sends the /WONDER/project/load message.

This tells cWONDER to restore an existing project.

Check the corresponding /WONDER/reply message for possible error codes. (Codes may be: 0 for success, 1 for "file not found", 2 or 3 for various project loading errors (see the message's string for details)).

Parameters
projectNameThe name of the project to be loaded.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendProjectSave ( )
virtual

Sends the /WONDER/project/save message without a parameter.

This tells cWONDER to store the current project under its current name.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendProjectSave ( const std::string &  projectName)
virtual

Sends the /WONDER/project/save message with a projectName parameter.

This tells cWONDER to store the current project under the given name.

Parameters
projectNameThe name under which the project shall be stored.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendReply ( const std::string &  replyToMessage,
int  state,
const std::string &  message 
)
virtual

Sends the /WONDER/reply message.

This is can be used for any replies to incoming messages, confirming successfull execution or transmitting an error message.

Parameters
replyToMessageThe OSC path of the message that triggered this reply.
state0 for confirmations of successfull operations, != 0 for error messages.
messageThe actual reply text.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendSourceActivate ( int  sourceID)
virtual

Sends the /WONDER/source/activate message.

This will activate the specified source within WONDER.

Parameters
sourceIDThe wonder-specific ID of the source to be activated. May range from 0 to N-1 where N is the total number of sources supported by the current WONDER installation.
See Also
sendSourceDeactivate

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendSourceAngle ( int  sourceID,
float  angle 
)
virtual

Sends the /WONDER/source/angle message.

This sets a planewave source's direction.

Parameters
sourceIDThe wonder-specific ID of the source to be changed. May range from 0 to N-1 where N is the total number of sources supported by the current WONDER installation.
angleThe direction of the planewave source as an angle (in degrees). The zero degrees position is "to the right" (aka eastward aka 3 o'clock direction), an increase in angle rotates the direction clockwise.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendSourceColor ( int  sourceID,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)
virtual

Sends the /WONDER/source/color message, changing the colour to be used for that source in any GUI.

Parameters
sourceIDThe wonder-specific ID of the source to be changed. May range from 0 to N-1 where N is the total number of sources supported by the current WONDER installation.
rThe red value of the new colour.
gThe green value of the new colour.
bThe blue value of the new colour.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendSourceDeactivate ( int  sourceID)
virtual

Sends the /WONDER/source/deactivate message.

This will deactivate the specified source within WONDER.

Parameters
sourceIDThe wonder-specific ID of the source to be deactivated. May range from 0 to N-1 where N is the total number of sources supported by the current WONDER installation.
See Also
sendSourceActivate

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendSourceDopplerEffect ( int  sourceID,
int  on 
)
virtual

Sends the /WONDER/source/dopplerEffect message, switching the doppler effect for this source on or off.

Parameters
sourceIDThe wonder-specific ID of the source to be changed. May range from 0 to N-1 where N is the total number of sources supported by the current WONDER installation.
on1 for on, 0 for off.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendSourceName ( int  sourceID,
const std::string &  name 
)
virtual

Sends the /WONDER/source/name message, changing the source's name.

The name is only relevant for UI representaions of the source, within the rendering, only the ID is used.

Parameters
sourceIDThe wonder-specific ID of the source to be changed. May range from 0 to N-1 where N is the total number of sources supported by the current WONDER installation.
nameThe new name of the source.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendSourcePosition ( int  sourceID,
float  x,
float  y 
)
virtual

Sends the /WONDER/source/position message.

This will set the source's position immediately.

Parameters
sourceIDThe wonder-specific ID of the source to be moved. May range from 0 to N-1 where N is the total number of sources supported by the current WONDER installation.
xThe x-axis coordinate (in meters).
yThe y-axis coordinate (in meters).

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendSourcePosition ( int  sourceID,
float  x,
float  y,
float  duration 
)
virtual

Sends the /WONDER/source/position message with a duration parameter.

This will immediately make the source start move from its current position to the specified position where it will arrive within the specified duration.

Parameters
sourceIDThe wonder-specific ID of the source to be moved. May range from 0 to N-1 where N is the total number of sources supported by the current WONDER installation.
xThe x-axis coordinate (in meters).
yThe y-axis coordinate (in meters).
durationHow long it will take for the source to arrive at the specified position (in seconds).

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendSourcePosition ( int  sourceID,
float  x,
float  y,
float  duration,
float  timestamp 
)
virtual

Sends the /WONDER/source/position message with a duration and a timestamp parameter.

This will make the source start move from its current position at the moment specified by the timestamp to the specified position where it will arrive within the specified duration.

Parameters
sourceIDThe wonder-specific ID of the source to be moved. May range from 0 to N-1 where N is the total number of sources supported by the current WONDER installation.
xThe x-axis coordinate (in meters).
yThe y-axis coordinate (in meters).
durationHow long it will take for the source to arrive at the specified position (in seconds).
timestampThe moment when the source will start to move (in seconds from "now" - "now" being the moment when this message is received by cWONDER).
Warning
For this command to work, an instance of the time base helper application jfWONDER must be running and connected to cWONDER. Generally, the WONDER system can be run without jfWONDER running - in that case, there is no time base and this command will never be executed. Since there are no warnings issued by cWONDER about jfWONDER not running, make sure that jfWONDER is running when using this command.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendSourceRotatingDirection ( int  sourceID,
int  inverted 
)
virtual

Sends the /WONDER/source/rotationDirection message, changing the rotation direction of the source.

As of WONDER version 3.1.0, this is only used by xWONDER in the context of rotating source groups.

Parameters
sourceIDThe wonder-specific ID of the source to be changed. May range from 0 to N-1 where N is the total number of sources supported by the current WONDER installation.
inverted1 for "inverted", 0 for "not inverted".

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendSourceScalingDirection ( int  sourceID,
int  inverted 
)
virtual

Sends the /WONDER/source/scalingDirection message, changing the scaling direction of the source.

As of WONDER version 3.1.0, this is only used by xWONDER in the context of source groups.

Parameters
sourceIDThe wonder-specific ID of the source to be changed. May range from 0 to N-1 where N is the total number of sources supported by the current WONDER installation.
inverted1 for "inverted", 0 for "not inverted".

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendSourceType ( int  sourceID,
int  type 
)
virtual

Sends the /WONDER/source/type message.

This will set the source's type (either "planewave" or "point").

Parameters
sourceIDThe wonder-specific ID of the source to be changed. May range from 0 to N-1 where N is the total number of sources supported by the current WONDER installation.
type0 for a planewave source, 1 for a point source.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendStreamVisualConnect ( )
virtual

Sends the /WONDER/stream/visual/connect message.

Once this is sent (to cWONDER), cWONDER will start sending the "visual stream" to the IP & port where this message was sent from.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendStreamVisualConnect ( const std::string &  name)
virtual

Sends the /WONDER/stream/visual/connect message.

Once this is sent (to cWONDER), cWONDER will start sending the "visual stream" to the IP & port where this message was sent from.

Parameters
nameA name that identifies the sender. cWONDER keeps a list of connected stream clients. This list will contain the client's IP & port along with this name.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendStreamVisualConnect ( const std::string &  host,
const std::string &  port 
)
virtual

Sends the /WONDER/stream/visual/connect message.

Once this is sent (to cWONDER), cWONDER will start sending the "visual stream" to the specified address

Parameters
hostA valid hostname. (Since cWONDER uses the liblo library for sending OSC, what exactly is supported (IPv6?) depends on the liblo version being used for the WONDER system in use.)
portA valid port. (Since cWONDER uses the liblo library for sending OSC, you should see the liblo documentation for details on what exactly is supported.)

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendStreamVisualDisconnect ( )
virtual

Sends the /WONDER/stream/visual/disconnect message.

Once this is sent (to cWONDER), cWONDER is expected to stop sending the "visual stream" to the IP & port where this message was sent from.

Warning
Currently not supported by cWONDER. Although /WONDER/stream/visual/disconnect is listed in WONDER's OSC_and_Commandline_Overview.ods spreadsheet, the command isn't actually supported (at least not by WONDER version 3.1.0).

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendStreamVisualPing ( int  count)
virtual

Sends the /WONDER/stream/visual/ping message.

This is sent by instances who send out a "visual stream" (like cWONDER or VisualHub).

Parameters
countAn integer value chosen by the sender.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::sendStreamVisualPong ( int  count)
virtual

Sends the /WONDER/stream/visual/pong message.

This is sent by clients who receive a "visual stream" as reply to /WONDER/stream/visual/ping.

Parameters
countThe integer value that was received with the incoming /WONDER/stream/visual/ping message.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::setAddress ( const std::string &  newHost,
const std::string &  newPort 
)
virtual

Sets the destination address where this OscSender will send to.

Parameters
newHostA valid hostname or ip string (what exactly is supported (IPv6?) may depend on what OSC library is used to implement this interface).
newPortA valid port number or service name (what exactly is supported may depend on what OSC library is used to implement this interface).

Implements wonder::OscSender.

void wonderlo::WonderOscSender::setIfaceByIp ( const std::string &  ip)
virtual

Sets the network interface to use for sending to this address by its IP.

Parameters
ipThe IP of the local interface where the messages shall be sent from.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::setTtl ( uint8_t  ttl)
virtual

Sets the time-to-live value for messages sent by this sender.

This is required for sending UDP multicast messages.

Parameters
ttlThe time-to-live value for messages sent by this sender.

Implements wonder::OscSender.

std::string wonderlo::WonderOscSender::url ( ) const
virtual

Returns an url representing the destination address where this OscSender will send to.

Returns
An url representing the destination address where this OscSender will send to.

Implements wonder::OscSender.

void wonderlo::WonderOscSender::wonderSend ( const MessageWithPath msg)
protectedvirtual

This method is used to send OSC messages from the various methods inherited from wonder::OscSender.

By overriding it, derived classes can change the way those messages are sent (e.g. from which port they are sent). This implementation simply passes MessageWithPath object on to lowrappers::Address::send.

Parameters
msgThe Message to be sent.
See Also
lowrappers::Address::send, WonderOscServerSender::wonderSend

Reimplemented in wonderlo::WonderOscSenderThread, and wonderlo::WonderOscServerSender.