jacobclarke92 / TouchOSC-Script-Injector

11 stars 1 forks source link

OSC Connections are set to infinity (ALL) after injection #1

Closed kmitch95120 closed 7 months ago

kmitch95120 commented 9 months ago

I have a TouchOSC template with OSC messages that are set to only send to Connection 1 but when I open the resulting _INJECTED file, they are set to the infinity symbol, in other words, ALL Connections.

I'm using TouchOSC Desktop 1.2.6.185 on a Mac.

kmitch95120 commented 7 months ago

I finally got the time to investigate this and found the source of the issue. TouchOSC stores the connections as a string with each of 5 positions representing an enabled connection (54321). For example, Connection 1 enabled is represented in the XML file as 00001. The XML parser is converting this to 1 as seen in the JSON debug file.

"connections": 1, when it should be "connections": "00001",

This behavior can be controlled with reviveNumbers in module https://deno.land/x/xml@2.0.4/mod.ts

The issue with the XML parser is documented here: https://github.com/lowlighter/xml/issues/29

I'll submit a PR once I've done some testing to confirm this doesn't break anything else.

kmitch95120 commented 7 months ago

It should also be noted that TouchOSC has a bug where it sets connections to ALL when it gets an invalid or corrupted string. At a minimum, it should complain about it.

jacobclarke92 commented 7 months ago

Hey @kmitch95120 thanks for writing all this up. Truthfully I did read your initial message I just hadn't touched this project in a while so the details had left my brain.

I've commited the necessary update after doing some cursory A/B ing using the example project.
Outcome looks promising in that it was identical (except for <?xml version="1" now actually being the correct <?xml version="1.0") but would you mind testing it out on your use case? Just pull in latest changes on master and run npm run dev

kmitch95120 commented 7 months ago

Thumbs up. Works like a charm. I did notice the xml version change when I did a diff between the _INJECTED output of 1.0.3 and my test build. Something else I noticed about my test build was the executable was almost 50% bigger than 1.0.3 executable from your zip file. I'm on an Intel Mac and I'm using the latest deno release (1.40.4).

jacobclarke92 commented 7 months ago

Sweeeet! I've released a new version: https://github.com/jacobclarke92/TouchOSC-Script-Injector/releases/tag/v1.0.4
Thanks for your help!

Not sure why filesize is bigger hey, I did bump a few dep versions while I was at it, if I had to guess a culprit I'd say deno's 'std' lib. In any case I'd say it's pretty inconsequential.