How to set correctly sendBundle()

I have a very basic question. I need to send a package of messages using OSC Bundle. Something similar to this example:

osc::OutboundPacketStream p(buffer, OUTPUT_BUFFER_SIZE);
		p << osc::BeginBundleImmediate
			<< osc::BeginMessage("/qtm/data")
			<< (int64_t)time << (int)time << frameNumber << 0 << 0 << 6 << osc::EndMessage
			<< osc::BeginMessage("/features/timeMS")
			<< (float)time << osc::EndMessage
			<< osc::BeginMessage("/features/bowVioDist")
			<< (float)bowVioDist << osc::EndMessage
			<< osc::BeginMessage("/features/WhichStringAngle")
			<< (float)bowAngle2Violin << osc::EndMessage
...(etc)
            << osc::EndBundle;
		transmitSocket.Send(p.Data(), p.Size());

But using ofxOsc sendBundle(). Searching for examples on OF I still don’t find how to properly set the bundle message. I guess I first need to define a ofxOscBundle myMessage but then how to populate the message to be sent by sendBundle(myMessage)?

this is a function that i use.

void sendBundle_2(){
        
        ofxOscMessage m;
        m.setAddress("/osc/oscillator");
        m.addIntArg(_id);//ID or last digits of ip ?
        m.addIntArg(89); //step
        m.addIntArg(89*100); // maxDist0 - 1023 is the speed, 125 min for chair to move
        m.addIntArg(128); // interval
        m.addIntArg(315); //maxAmp
        m.addFloatArg(0.997); //damp
        m.addIntArg(42); //frame_step_factor
        m.addFloatArg(0.01); //osc dead engery value
        sender.sendMessage(m, true);
        ofLog()<<_id<<" ofxOscMessage /osc/oscillator bundle_2";
    }

Hi Stephan,
Then a simple OSC message like this one is already a bundle?

if(sendOSCData){
ofxOscMessage m;
m.setAddress("/myo");
m.addStringArg("/pointVector");
m.addFloatArg(arm.getPointVector().x);
m.addFloatArg(arm.getPointVector().y);
m.addFloatArg(arm.getPointVector().z);
m.addStringArg("/velocity");
m.addFloatArg(arm.getPointVelocity());
sender.sendMessage(m, false);
}

In it’s most simple form, yes.
OSC Bundles can contain messages or other bundles (containing other messages or other bundles)

But if you feel you need to use ofxOscBundle, there is an example use of it in theofxFacetracker addon -> FaceOSC

1 Like

Right
That example is perfect for what I’m searching, I have it done, Thanks!
Resolved