SPAOP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
WonderOscSender.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 Martin Hansen
3  *
4  * This file is part of SPAOP (Spatial Audio Object Positioner).
5  *
6  * SPAOP is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * SPAOP is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with SPAOP. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef WONDEROSCSENDER_H_INCLUDED
21 #define WONDEROSCSENDER_H_INCLUDED
22 
23 #include <iostream>
24 #include "Address.h"
25 #include "OscSender.h"
26 #include "MessageWithPath.h"
27 
28 namespace wonderlo {
29 
34  public virtual wonder::OscSender
35 {
36 public:
37 
48  WonderOscSender(const std::string &host, const std::string &port,
49  int proto = LO_UDP);
50 
60  WonderOscSender(lo_address addr, bool isOwner = true);
61 
68  WonderOscSender(const WonderOscSender& other);
69 
73  virtual ~WonderOscSender();
74 
75  void setAddress(const std::string &newHost, const std::string &newPort);
76 
77  std::string url() const;
78 
79  std::string hostname() const;
80 
81  std::string port() const;
82 
83  int getTtl() const;
84 
85  void setTtl(uint8_t ttl);
86 
87  std::string getIface() const;
88 
89  void setIfaceByIp(const std::string& ip);
90 
91  void sendSourceActivate(int id);
92 
93  void sendSourceDeactivate(int id);
94 
95  void sendSourceType(int id, int type);
96 
97  void sendSourcePosition(int id, float x, float y);
98 
99  void sendSourcePosition(int id, float x, float y, float duration);
100 
101  void sendSourcePosition(int id, float x, float y, float duration, float timestamp);
102 
103  void sendSourceAngle(int id, float angle);
104 
105  void sendSourceName(int id, const std::string& name);
106 
107  void sendSourceColor(int id, uint8_t r, uint8_t g, uint8_t b);
108 
109  void sendSourceRotatingDirection(int id, int inverted);
110 
111  void sendSourceScalingDirection(int id, int inverted);
112 
113  void sendSourceDopplerEffect(int id, int on);
114 
115  void sendListenerPosition(int listenerID, float x, float y);
116 
117  void sendGlobalRenderpolygon(const std::string& roomName,
118  int noOfVertices,
119  wonder::Room::Vertex* vertices);
120 
122 
123  void sendStreamVisualConnect(const std::string& name);
124 
125  void sendStreamVisualConnect(const std::string& host,
126  const std::string& port);
127 
129 
130  void sendStreamVisualPing(int count);
131 
132  void sendStreamVisualPong(int count);
133 
134  void sendReply(const std::string& replyToMessage, int state,
135  const std::string& message);
136 
137  void sendProjectCreateWithScore(const std::string& projectName);
138 
139  void sendProjectCreate(const std::string& projectName);
140 
141  void sendProjectLoad(const std::string& projectName);
142 
143  void sendProjectSave();
144 
145  void sendProjectSave(const std::string& projectName);
146 
147  void sendPluginStandalone(const bool standAlone);
148 
149 protected:
150 
162  virtual void wonderSend(const MessageWithPath &msg);
163 
164 
165 private:
166 
178  virtual void wonderSend(const std::string &path,
179  const std::string types, ...);
180 
181 
182  WonderOscSender &operator= (const WonderOscSender other);
183 };
184 
185 }
186 
187 #endif // WONDEROSCSENDER_H_INCLUDED
An abstract class describing the interface for a class that sends out the WONDER-specific OSC-message...
Definition: OscSender.h:43
A lowrappers::Address implementing the wonder::OscSender interface.
Definition: WonderOscSender.h:33
void sendListenerPosition(int listenerID, float x, float y)
Sends the /WONDER/listener/position message, changing the position of the listener which is used to d...
Definition: WonderOscSender.cpp:144
void sendStreamVisualPing(int count)
Sends the /WONDER/stream/visual/ping message.
Definition: WonderOscSender.cpp:184
void sendProjectSave()
Sends the /WONDER/project/save message without a parameter.
Definition: WonderOscSender.cpp:216
void sendSourceType(int id, int type)
Sends the /WONDER/source/type message.
Definition: WonderOscSender.cpp:94
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...
Definition: WonderOscSender.cpp:124
void sendReply(const std::string &replyToMessage, int state, const std::string &message)
Sends the /WONDER/reply message.
Definition: WonderOscSender.cpp:194
void sendSourceScalingDirection(int id, int inverted)
Sends the /WONDER/source/scalingDirection message, changing the scaling direction of the source...
Definition: WonderOscSender.cpp:134
void sendStreamVisualConnect()
Sends the /WONDER/stream/visual/connect message.
Definition: WonderOscSender.cpp:163
A struct describing a vertex with its three coordinates.
Definition: Room.h:40
int getTtl() const
Returns the time-to-live value for messages sent by this sender.
Definition: WonderOscSender.cpp:64
void sendPluginStandalone(const bool standAlone)
Sends the /WONDER/plugin/standalone message.
Definition: WonderOscSender.cpp:227
std::string getIface() const
Returns the name of the network interface that will be used for sending messages. ...
Definition: WonderOscSender.cpp:74
virtual void wonderSend(const MessageWithPath &msg)
This method is used to send OSC messages from the various methods inherited from wonder::OscSender.
Definition: WonderOscSender.cpp:246
void sendSourceActivate(int id)
Sends the /WONDER/source/activate message.
Definition: WonderOscSender.cpp:84
std::string url() const
Returns an url representing the destination address where this OscSender will send to...
Definition: WonderOscSender.cpp:49
void sendProjectCreate(const std::string &projectName)
Sends the /WONDER/project/create message.
Definition: WonderOscSender.cpp:206
void sendSourceRotatingDirection(int id, int inverted)
Sends the /WONDER/source/rotationDirection message, changing the rotation direction of the source...
Definition: WonderOscSender.cpp:129
A wrapper for Liblo's lo_address.
Definition: Address.h:35
void sendGlobalRenderpolygon(const std::string &roomName, int noOfVertices, wonder::Room::Vertex *vertices)
Sends the /WONDER/global/renderpolygon message.
Definition: WonderOscSender.cpp:149
void sendSourceDopplerEffect(int id, int on)
Sends the /WONDER/source/dopplerEffect message, switching the doppler effect for this source on or of...
Definition: WonderOscSender.cpp:139
void sendProjectLoad(const std::string &projectName)
Sends the /WONDER/project/load message.
Definition: WonderOscSender.cpp:211
void sendSourceAngle(int id, float angle)
Sends the /WONDER/source/angle message.
Definition: WonderOscSender.cpp:114
void sendStreamVisualPong(int count)
Sends the /WONDER/stream/visual/pong message.
Definition: WonderOscSender.cpp:189
void sendStreamVisualDisconnect()
Sends the /WONDER/stream/visual/disconnect message.
Definition: WonderOscSender.cpp:179
virtual ~WonderOscSender()
Destructor.
Definition: WonderOscSender.cpp:35
void sendSourceDeactivate(int id)
Sends the /WONDER/source/deactivate message.
Definition: WonderOscSender.cpp:89
void setAddress(const std::string &newHost, const std::string &newPort)
Sets the destination address where this OscSender will send to.
Definition: WonderOscSender.cpp:44
void sendProjectCreateWithScore(const std::string &projectName)
Sends the /WONDER/project/createWithScore message.
Definition: WonderOscSender.cpp:201
std::string hostname() const
Returns the hostname (or IP) of the destination address where this OscSender will send to...
Definition: WonderOscSender.cpp:54
std::string port() const
Returns the destination port (or service name) where this OscSender will send to. ...
Definition: WonderOscSender.cpp:59
void setIfaceByIp(const std::string &ip)
Sets the network interface to use for sending to this address by its IP.
Definition: WonderOscSender.cpp:79
A lowrappers::Message object that holds additional information about its destination OSC path...
Definition: MessageWithPath.h:31
void sendSourcePosition(int id, float x, float y)
Sends the /WONDER/source/position message.
Definition: WonderOscSender.cpp:99
void setTtl(uint8_t ttl)
Sets the time-to-live value for messages sent by this sender.
Definition: WonderOscSender.cpp:69
WonderOscSender(const std::string &host, const std::string &port, int proto=LO_UDP)
Constructor.
Definition: WonderOscSender.cpp:24
void sendSourceName(int id, const std::string &name)
Sends the /WONDER/source/name message, changing the source's name.
Definition: WonderOscSender.cpp:119