Skip to content

Instantly share code, notes, and snippets.

@universax
Created October 10, 2019 08:27
Show Gist options
  • Save universax/f8ec6d61d2d338ec2ab1dff95172966a to your computer and use it in GitHub Desktop.
Save universax/f8ec6d61d2d338ec2ab1dff95172966a to your computer and use it in GitHub Desktop.
//---------------------------------
// 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