Closed bitzl closed 5 years ago
@bitzl could you possibly work around this using serde
to serialize your type (perhaps via bincode
or serde_json
) to bytes and use the Blob
variant to send your data, then deserialize on the other end using the aforementioned crates? This way you can work with almost arbitrary data without having to add any further complexity to the rosc
crate itself. We ran a networked laser installation a while back using this same technique with rosc
.
@mitchmindtree That would mean parsing byte arrays into floats using the SuperCollider language (that's not Rust, so Serde wouldn't work on that side, see https://supercollider.github.io/). Right now I'm not sure if that's even possible, but I'll check. Thank's for the suggestion!
PR #6 would be an experimental draft how the encoding could look like.
@mitchmindtree This is a clever idea, maybe I will pick this up for some other project, thanks!
@bitzl Thank you for providing the draft implementation, I will try to review it today. Contributions are always welcome.
Resolved with PR #6.
The OSC specification allows to send arrays of values. The tag
[
marks the start of an array type definition followed by the type tags of each value until it is closed by a]
tag.Why is this useful? In my case, I'd need to send a list of frequencies (float values) to a Supercollider synth. The number of frequencies can vary, so a fixed number of fields would be an ugly workaround.
Note that nesting isn't exactly specified (it's "the tags following are for the data", but also "until a close brace tag is reached"), so I assume it's fine to go with whatever is easier to implement.
I'm happy to help. A recursive type would look nice, but I'm not sure if that's the best way to go: