basic bundle support + minimal example#1
Conversation
|
Hey, this looks pretty cool, great job on this. I'll check out the new functions -- I wish more (any ?) Linux apps supported bundles. Maybe a quick c test with liblo using bundles would be enough. Thx, Doug |
|
I've played with it, looks good. My suggestion: the .isBundle() function should return the timetag if true, nil if false. Here's a possible version: BTW, my .unpackTIME() function was working incorrectly, at least with liblo. It needed the unpack format strings to force big endian. ('>I>I', instead of 'II'). I didn't see that before, but I don't recall if timetag code was tested outside of Löve2d. Extracting the 8 byte timetag directly in .isBundle() could be (should be?) moved to another function, as well, for reuse. I expect to merge your pull fairly soon, and make those changes after. Having added this, I'll work on sending bundles... |
|
Still will merge the pull shortly. I'll do that, then update the tag. Afterwards, I have new functions that unpack nested bundles recursively (and some support functions for searching and flattening the nested results to simple table lists). After a bit of more testing, I'll update the project with the recursive functions and re-tag. So your contributions will be integrated (and noted in the source). You really bumped me back into working on this! Until then, here are the new base library functions: Bundles don't have names / labels, so I figure (other than searching the msg address) attaching the timetag and "level" (sub-bundle depth) to each msg is adequate for differentiating between other bundles... |
|
Nice work! I didn't realize bundles could be recursive in OSC. Flattening them is, I think, the right call |
|
The function that flattens the results table: It's kinda cool, as this function flattens both the raw results from oLvosc.oscUnpackBundle() and the results from my bundleSearch() function. It's pretty simple to call resultsToList() after unpacking a bundle, and it appeals to me to let the end user decide if they can use the nested table. There's also a bundleView() function that prints the nested table to the shell. It's output looks like: Of course you could easily do this with the level information in a flattened list... :-) I can certainly add resultsToList() to the oLvosc library, rather than just as an external example function. |
|
Code for creating valid bundle packets, for the oLvosc library. Not fully tested, but seems to be working OK... |
This library is exactly what I needed for my project (löve2d + non-blocking/threaded sockets) but it was missing bundle support. I thought I would take a crack at it and thankfully it didn't take too many lines to get it done. I followed the solution for bundles in https://github.com/mhroth/tinyosc and took advantage of as much of the code you already wrote
Main additions:
isBundle(udpM)- looks for the#bundleprefixoscUnpackBundle- likeoscUnpackbut returns a table 1 or more tuples{oscADDR, oscTYPE, oscDATA}I updated the
oscdump.luaexample to include bundle support