We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I would like to reuse an OSCBundle object, because I don't want to keep blocking the entire loop while waiting for a SLIP message.
loop
The first bundle works, but all successive bundles give an error. I get the same result with a static OSCBundle, local to loop, or a global OSCBundle
Here's a short program that demonstrates this problem:
#include <OSCBundle.h> void setup() { Serial.begin(115200); while (!Serial); } const uint8_t data[] = { 0x23, 0x62, 0x75, 0x6E, 0x64, 0x6C, 0x65, 0x00, // #bundle· 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // time = 0 0x00, 0x00, 0x00, 0x18, // size = 24 0x2F, 0x74, 0x72, 0x61, 0x63, 0x6B, 0x2F, 0x31, // /track/1 0x2F, 0x6D, 0x75, 0x74, 0x65, 0x00, 0x00, 0x00, // /mute··· 0x2C, 0x66, 0x00, 0x00, // ,f·· 0x00, 0x00, 0x00, 0x00 // value = 0.0 }; void muteHandler(OSCMessage &msg) { Serial.println("Mute"); } auto getOSCErrorName(OSCErrorCode error) { switch(error) { case OSC_OK: return F("OSC_OK"); case BUFFER_FULL: return F("BUFFER_FULL"); case INVALID_OSC: return F("INVALID_OSC"); case ALLOCFAILED: return F("ALLOCFAILED"); case INDEX_OUT_OF_BOUNDS: return F("INDEX_OUT_OF_BOUNDS"); } } // OSCBundle bundleIN; // doesn't work void loop() { // OSCBundle bundleIN; // works static OSCBundle bundleIN; // doesn't work bundleIN.fill(data, sizeof(data)/sizeof(*data)); if (!bundleIN.hasError()) { bundleIN.dispatch("/track/*/mute", muteHandler); } else { Serial.print("Error: "); Serial.println(getOSCErrorName(bundleIN.getError())); } bundleIN.empty(); delay(2000); }
Output:
Mute Error: INVALID_OSC Error: INVALID_OSC ...
As you can see, the first iteration correctly dispatches the mute message, but all successive bundles give an INVALID_OSC error.
INVALID_OSC
How can I resolve this?
The text was updated successfully, but these errors were encountered:
Found it. Add this line: decodeState = STANDBY; to this function: OSCBundle& OSCBundle::empty()
decodeState = STANDBY;
OSCBundle& OSCBundle::empty()
Sorry, something went wrong.
No branches or pull requests
I would like to reuse an OSCBundle object, because I don't want to keep blocking the entire
loop
while waiting for a SLIP message.The first bundle works, but all successive bundles give an error. I get the same result with a static OSCBundle, local to loop, or a global OSCBundle
Here's a short program that demonstrates this problem:
Output:
As you can see, the first iteration correctly dispatches the mute message, but all successive bundles give an
INVALID_OSC
error.How can I resolve this?
The text was updated successfully, but these errors were encountered: