I have tried now for some time to make an OscMessage with vuo.framework but could not succeed. It would be nice to see any working example.

I have tried VuoOscMessage_make(), VuoOscMessage_makeFromJson(), VuoOscMessage_makeFromString()

Here is my simple test code to create message {"address":"/foo", "data":[1.23]}:

struct json_object *dataObject = json_object_new_array();
json_object_array_add(dataObject, json_object_new_double(1.23));
struct json_object *messageObject = json_object_new_object();
json_object_object_add(messageObject, "address", json_object_new_string("/foo"));
json_object_object_add(messageObject, "data", dataObject);
VuoOscMessage testMessage = VuoOscMessage_makeFromJson(messageObject);
VuoText testMessageDebug = VuoText_make(json_object_to_json_string(messageObject));

testMessageDebug outputs nicely text {"address":"/foo", "data":[1.23]}. testMessage outputs VuoOscMessage with correct address "/foo", but value is [?]. If I send that message to OSC OSCTestApp gets null values

What I'm doing wrong?


@timwessman, great to hear

jstrecker's picture
Submitted by

timwessman, great to hear that you're coding with the Vuo framework. Try this:

void nodeEvent(VuoOutputData(VuoOscMessage) message)
    struct json_object *data[1] = { json_object_new_double(1.23) };
    VuoOscType     dataTypes[1] = { VuoOscType_Auto };
    *message = VuoOscMessage_make(VuoText_make("/foo"), 1, data, dataTypes);

Yessss...Thanks a lot!! Now

timwessman's picture
Submitted by

Yessss...Thanks a lot!! Now it works.

Its great that there is possibility to code with Vuo Framework. Sometimes its much easier and more efficient to write some code than draw thousands of virtual wires.

(rebooting Vuo editor and reloading project after every code change is anoying, but I hope it will be fixed someday)