llloret / osmid

osmid is a tool to bridge MIDI and OSC. It is currently in use in Sonic Pi
Other
72 stars 12 forks source link

Sanitise OSC paths #42

Closed samaaron closed 7 years ago

samaaron commented 7 years ago

Adhering to the OSC spec as described here: http://opensoundcontrol.org/spec-1_0

The following characters are not allowed in the names of OSC paths: ' ' space 32

number sign 35

*   asterisk          42
,   comma             44
/   forward slash     47
?   question mark     63
[   open bracket      91
]   close bracket     93
{   open curly brace  123
}   close curly brace 125

We now replace these chars with underscores. Additionally the paths are converted to lower case.

llloret commented 7 years ago

Hi, @samaaron, thanks for the PR.

Just one question: do you want to have both the Port name and the ID as part of the OSC address? I thought you only wanted to have the id...

samaaron commented 7 years ago

@llloret at the moment the port ID is required to differentiate between two similarly named ports. However, it would be nice to be able to drop the ID and append a -2, -3 string to the end of the port name in the situation where multiple similarly named ports are connected. Would this be easy to add?

llloret commented 7 years ago

Thank you, @samaaron