void OscSender::sendBundle(Bundle& bundle){ static const int OUTPUT_BUFFER_SIZE = 32768; char buffer[OUTPUT_BUFFER_SIZE]; ::osc::OutboundPacketStream p(buffer, OUTPUT_BUFFER_SIZE); appendBundle(bundle, p); socket->Send(p.Data(), p.Size()); }
void send(const char* address, float msg, UdpTransmitSocket& transmit_socket){ osc::OutboundPacketStream p( buffer, OUTPUT_BUFFER_SIZE ); p << osc::BeginBundleImmediate << osc::BeginMessage( address ) << msg << osc::EndMessage << osc::EndBundle; transmit_socket.Send( p.Data(), p.Size() ); }
void OscSender::sendMessage(Message& message){ static const int OUTPUT_BUFFER_SIZE = 16384; char buffer[OUTPUT_BUFFER_SIZE]; ::osc::OutboundPacketStream p(buffer, OUTPUT_BUFFER_SIZE); p << ::osc::BeginBundleImmediate; appendMessage(message, p); p << ::osc::EndBundle; socket->Send(p.Data(), p.Size()); }
int send_osc(UdpTransmitSocket &transmitSocket, int state){ printf("\nSending OSC: %d\n", state); dots = 0; char buffer[OUTPUT_BUFFER_SIZE]; osc::OutboundPacketStream p( buffer, OUTPUT_BUFFER_SIZE ); p << osc::BeginBundleImmediate << osc::BeginMessage( "/ontrak" ) << state << osc::EndMessage << osc::EndBundle; transmitSocket.Send( p.Data(), p.Size() ); return 0; }
void OscOutput::transmitEliteControlMessage(int controlNumber, float controlValue, String address, int port) { const char* ipAddress = address.toUTF8(); UdpTransmitSocket transmitSocket (IpEndpointName(ipAddress, port)); char buffer[OUTPUT_BUFFER_SIZE]; osc::OutboundPacketStream p (buffer,OUTPUT_BUFFER_SIZE); p << osc::BeginBundleImmediate << osc::BeginMessage( "/alpha" ) << controlNumber << controlValue << osc::EndMessage << osc::EndBundle; transmitSocket.Send(p.Data(), p.Size()); }
int main() { int width = 51 * 6; // lengths of strips int height = 4; uint8_t* buffer = (uint8_t*)malloc(width * height * 3); createNetwork(buffer, width, height); initEffects(width, height); while (1) { clearEffect(buffer); //runTestEffect(buffer); //runFlameEffect(buffer); runWaterfallEffect(buffer); applyFixups(buffer, width, height); #if OSC_OUTPUT_ENABLED for (int ii = 0; ii < width; ii++) { for (int jj = 0; jj < height; jj++) { oscStream << osc::BeginBundleImmediate; oscStream << osc::BeginMessage("led"); oscStream << ii * 3 << (height - jj - 1) * 10 << (ii + 1) * 3 << (height - jj) * 10; int s = (jj * width + ii) * 3; for (int c = 0; c < 3; c++) { oscStream << buffer[s + c]; } oscStream << osc::EndMessage; oscStream << osc::EndBundle; oscSocket.Send(oscStream.Data(), oscStream.Size()); oscStream.Clear(); } } #endif for (int ii = 0; ii < supplies.size(); ii++) { supplies[ii]->go(); } usleep(70); } free(buffer); return 0; }