OSC: Multiple Bundles in a Bundle problem


#1

Seems that JUCE osc can’t handle multiple bundles in a single bundle, or I’m doing something stupid.
When I do the following code, a juce console app receiver give me the error:

OSCFormatError: OSC input stream format error: wrong element content size encountered while reading

Here’s the code

        OSCBundle frameData;
    frameData.setTimeTag(0);
    
    OSCMessage sizeMsg(params.oscAddress +  "blob/size");sizeMsg.addInt32(42);
    OSCBundle::Element sizeMsgElement(sizeMsg);
    OSCBundle sizeBundle;
    sizeBundle.setTimeTag(0);
    sizeBundle.addElement(sizeMsgElement);
    OSCBundle::Element sizeBundleElement(sizeBundle);
    
    OSCMessage sizeMsg2(params.oscAddress +  "abc/def");sizeMsg.addInt32(42);
    OSCBundle::Element sizeMsgElement2(sizeMsg2);
    OSCBundle sizeBundle2;
    sizeBundle2.setTimeTag(0);
    sizeBundle2.addElement(sizeMsgElement2);
    OSCBundle::Element sizeBundleElement2(sizeBundle2);

    frameData.addElement(sizeBundleElement);
    frameData.addElement(sizeBundleElement2);
    
    
    send(frameData);

Any ideas to get multiple bundles in a bundle?


#2

You’re not doing anything daft - I’ve had a look and this is, unfortunately, a JUCE bug.


#3

I’m on it, hopefully will have a fix soon.


#4

I pushed a fix. JUCE should now deal correctly with arbitrary amounts of nested OSC bundles.

Please update to the newest tip and try to run your code again.