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

A thread implementing the wonder::OscSenderThread interface. More...

#include <WonderOscSenderThread.h>

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

Public Member Functions

 WonderOscSenderThread (const std::string &host, const std::string &port, int proto=LO_UDP)
 Constructor. More...
 
virtual ~WonderOscSenderThread ()
 Destructor. More...
 
void start ()
 Starts the thread. More...
 
void stop ()
 Stops the thread. More...
 
void join ()
 Joins the thread. More...
 
- Public Member Functions inherited from thread::Thread
 Thread ()
 Constructor. More...
 
virtual ~Thread ()
 Destructor. More...
 
void start ()
 Starts the Thread. More...
 
void stop ()
 Sets the internal flag stopped_ to true. More...
 
void join ()
 Joins the thread. 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...
 
- Public Member Functions inherited from wonderlo::WonderOscSender
 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...
 

Protected Member Functions

void run ()
 Within its run method, this thread will continously wait for the internal message queue to be filled and the send any messages that are added to the queue. More...
 
void sendMethod (const MessageWithPath &msg)
 This method is used by this thread within its run method to send the MessageWithPath objects it picks up from the message queue. More...
 
void enqueMessage (const MessageWithPath *msg)
 Enqueues a message into the internal message delivery queue. More...
 
void wonderSend (const MessageWithPath &msg)
 Overriding VSSender::wonderSend, this changes the way OSC messages are sent from the various methods inherited from wonder::OscSender. More...
 
- Protected Member Functions inherited from thread::Thread
bool isStopped () const
 Returns true if the thread was stopped. More...
 

Detailed Description

A thread implementing the wonder::OscSenderThread interface.

Messages to be sent are added to an internal delivery queue (guarded by a mutex) from where the thread will pick them up and send them.

Calls from WonderOscSender to the two wonderSend methods (which are reimplemented here) will enque fully assembled MessageWithPath objects in the internal queue.

Constructor & Destructor Documentation

wonderlo::WonderOscSenderThread::WonderOscSenderThread ( 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::WonderOscSenderThread::~WonderOscSenderThread ( )
virtual

Destructor.

Member Function Documentation

void wonderlo::WonderOscSenderThread::enqueMessage ( const MessageWithPath msg)
protected

Enqueues a message into the internal message delivery queue.

Parameters
msgthe message to be enqued. Will be deleted by the sending thread.
void wonderlo::WonderOscSenderThread::join ( )
virtual

Joins the thread.

Implements wonder::OscSenderThread.

void wonderlo::WonderOscSenderThread::run ( )
protectedvirtual

Within its run method, this thread will continously wait for the internal message queue to be filled and the send any messages that are added to the queue.

To ensure that the thread will exit when stop is called, the waiting for incoming messages will be interrupted every MSG_WAIT_INTERVAL milliseconds. (Internally, this is done by calling wait_for on the queue's std::condition_variable.)

Implements thread::Thread.

void wonderlo::WonderOscSenderThread::sendMethod ( const MessageWithPath msg)
protected

This method is used by this thread within its run method to send the MessageWithPath objects it picks up from the message queue.

By overriding this method, the way the thread sends out those messages can be changed. This default implementation simply calls lowrappers::Address::send(msg.path, msg).

Parameters
msgThe message to be sent.
void wonderlo::WonderOscSenderThread::start ( )
virtual

Starts the thread.

Implements wonder::OscSenderThread.

void wonderlo::WonderOscSenderThread::stop ( )
virtual

Stops the thread.

Implements wonder::OscSenderThread.

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

Overriding VSSender::wonderSend, this changes the way OSC messages are sent from the various methods inherited from wonder::OscSender.

This reimplementation simply enques a copy of the message in an internal message queue from where the sending thread will pick them up and send them.

Parameters
msgThe Message to be sent.
See Also
lowrappers::Address::sendFrom, WonderOscSender::wonderSend

Reimplemented from wonderlo::WonderOscSender.