Created
October 10, 2019 08:27
-
-
Save universax/f8ec6d61d2d338ec2ab1dff95172966a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//--------------------------------- | |
// OSC | |
//--------------------------------- | |
#include "OscReceivedElements.h" | |
#include "OscPacketListener.h" | |
#include "OscOutboundPacketStream.h" | |
#include "UdpSocket.h" | |
#include "IpEndpointName.h" | |
void sendOSCMessage(int id, float x, float y, float z) | |
{ | |
// Set IPAddress and Port | |
const std::string ipAddress = "127.0.0.1"; | |
const int port = 8000; | |
UdpTransmitSocket transmitSocket(IpEndpointName(ipAddress.c_str(), port)); | |
//Buffer | |
char buffer[6144]; | |
osc::OutboundPacketStream p(buffer, 6144); | |
p << osc::BeginBundleImmediate | |
//Head | |
<< osc::BeginMessage("/position") << id << x << y << z << osc::EndMessage | |
<< osc::EndBundle; | |
transmitSocket.Send(p.Data(), p.Size()); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment