thomasfredericks / MicroOsc

MicroOsc is a minimal Open Sound Control (OSC) library for Arduino
MIT License
16 stars 2 forks source link

Building dynamically OSC Addresses #10

Open joschy3D opened 7 months ago

joschy3D commented 7 months ago

Hi there, nice Library ;) I found it is not possible to build an OSC Address in a For-Loop with string operations. Example: "/Test" + String(i) -> not working Also: NewOSC = "/Test" + String(i) NewOSC will also throw an error

Would be nice to have the possibility to build the OSC Addresses more dynamically. I have to build 32 OSC Addresses in a sketch and I have to use a case-switch.

Cheers

thomasfredericks commented 7 months ago

HI,

In issue #6 I helped a user with something very similar.

MicroOsc does not support String objects, you must convert them to C strings. That is the error you are getting.

But, to generate a String objects on the fly is very common for computer code, but not recommended on a micro-controller for memory fragmentation and speed issues.

Here are some of my recommendations to improve the speed and reliability of OSC parsing code: