hoijui / JavaOSC

OSC content format/"protocol" library for JVM languages
http://www.illposed.com/software/javaosc.html
BSD 3-Clause "New" or "Revised" License
157 stars 44 forks source link

encoding and decoding 'c' char type #26

Closed 7890 closed 5 years ago

7890 commented 8 years ago

Hi, i think the handling of how OSC type char is written and read back needs a closer look. Using char works (in some cases) for sending and receiving when both sender and receiver are using the JavaOSC library. Sending a char with JavaOSC to a liblo receiver doesn't work. The OSC spec says a char is sent as 32 bits. JavaOSC first writes the char and then aligns to 4 byte boundary, giving a000 while other libs try to read 000a. I'm not sure which one is more correct. The further problem is that JavaOSC reads back a char as a single byte (thus all following args will be offset by the 3 padding bytes and will be wrong). Please have a look at this possible solution: https://github.com/7890/java_osc/commit/619d7be245c74d4ba09bf2e6d93839bfd03112eb It seems to work to send 'c' at any position to and from liblo, to and from JavaOSC. Greetings + thanks for creating this easy-to-use library! Thomas

hoijui commented 5 years ago

It is fixed on the develop branch, here: 6114144c3733c795ecc882a042fab483bf1e615e (Not yet released)

Thank you @7890 ! .. I can not tell you why I did not use your commits directly back then, I am sorry! :/ all the best!