Currently I'm working on a Fasted OSC implementation in combination with OSC Touch.

Currently I’m working on a Fasted OSC implementation in combination with OSC Touch. Fastled + CNMAT’s OSC: https://github.com/CNMAT/OSC
The work is nearly done, ready to show the world. One thing, my code is far from generic, especially regarding multisliders . For example, I’m using the following lot’s of times:
if(ID == 1) msg1.route("/all/val/1", set_val);
if(ID == 2) msg1.route("/all/val/2", set_val);
if(ID == 3) msg1.route("/all/val/3", set_val);
if(ID == 4) msg1.route("/all/val/4", set_val);
if(ID == 5) msg1.route("/all/val/5", set_val);
if(ID == 6) msg1.route("/all/val/6", set_val);

In other languages we would do something like:
msg1.route("/all/val/"+ID, set_val);

But this doesn’t seem to work. Is there anybody who can help me improve this or give me tips?

You could use sprintf for this:

char path[16];
sprintf(path, “/all/val/%d”, ID);
msg1.route(path, set_val);

Or if ID will always be between 1 and 9, you could “cheat”:

char path[11] = “/all/val/0”;
path[9] = ID + ‘0’;
msg1.route(path, set_val);

Great both work superb!! thanks :wink:

We even have a nice String class: https://www.arduino.cc/en/Reference/StringObject with overloaded append operators. So this should work (untested!): http://msg1.route(String("/all/val/")+ID, set_val);

Thanks @Thomas_Runge that doesn’t work in this case