Hi, I have ported the Open Sound Control package to Pharo 9.0. Since
the Catalog Browser is marked as legacy, I was wondering how to
submit the patch. Is there a git repository? I attached the
fileout to this email in case anybody wants to take a look at the
package or knows how/where to add it to Pharo 9.0, Patch Note: OSC relies on the removed RWTextOrBinaryStream class
which has very specific behavior that I could not emulate using
the available stream and codec classes, so I pulled in the class
from Squeak 5,
renamed it to OSCStream and added it to the OSC package. This
seemed to be the easiest way to do it without changing the OSC
implementation, but I welcome any suggestions for a cleaner
solution. Günter OSC.st (44K) Download Attachment |
> On 21 May 2021, at 14:02, Günter Khyo via Pharo-dev <[hidden email]> wrote: > > Hi, > > I have ported the Open Sound Control package to Pharo 9.0. Since the Catalog Browser is marked as legacy, I was wondering how to submit the patch. Is there a git repository? I attached the fileout to this email in case anybody wants to take a look at the package or knows how/where to add it to Pharo 9.0, > > Patch Note: > > OSC relies on the removed RWTextOrBinaryStream class which has very specific behavior that I could not emulate using the available stream and codec classes, so I pulled in the class from Squeak 5, renamed it to OSCStream and added it to the OSC package. This seemed to be the easiest way to do it without changing the OSC implementation, but I welcome any suggestions for a cleaner solution. I am curious, what was the specific behaviour that you could not emulate ? > Günter > > <OSC.st> |
A RWTextOrBinaryStream instance can operate in binary or ascii
mode, the mode can be switched at any time by sending ascii
or binary, and some methods are mode-sensitive, e.g., contents
will respond with a ByteArray in binary mode and a ByteString in
ascii mode. (OSC uses ASCII encoding for addresses and strings,
and binary formats for numbers and blobs.) On 5/21/21 3:00 PM, Sven Van
Caekenberghe wrote:
On 21 May 2021, at 14:02, Günter Khyo via Pharo-dev [hidden email] wrote: Hi, I have ported the Open Sound Control package to Pharo 9.0. Since the Catalog Browser is marked as legacy, I was wondering how to submit the patch. Is there a git repository? I attached the fileout to this email in case anybody wants to take a look at the package or knows how/where to add it to Pharo 9.0, Patch Note: OSC relies on the removed RWTextOrBinaryStream class which has very specific behavior that I could not emulate using the available stream and codec classes, so I pulled in the class from Squeak 5, renamed it to OSCStream and added it to the OSC package. This seemed to be the easiest way to do it without changing the OSC implementation, but I welcome any suggestions for a cleaner solution.I am curious, what was the specific behaviour that you could not emulate ?Günter <OSC.st> |
Hi Günter,
Thanks for answering, I expected that you would mention this aspect. I don't know about OSC, but from your description it sounds like it basically is a binary protocol, where some sequences of bytes are to be interpreted as ASCII encoded strings. I would just work on binary streams and do the encoding/decoding as needed. ASCII is trivial, you can either do: ZnCharacterEncoder ascii encodeString: 'OSC' or 'OSC' asByteArray And the inverse is either ZnCharacterEncoder ascii decodeBytes: #[79 83 67]. or #[79 83 67] asString. The OSC spec says: OSC-string A sequence of non-null ASCII characters followed by a null, followed by 0-3 additional null characters to make the total number of bits a multiple of 32. One approach could be: #writeOSCString: string on: stream stream nextPutAll: (ZnCharacterEncoder ascii encodeString: string). stream nextPut: 0. (string size + 1) // 4 timesRepeat: [ stream nextPut: 0 ] #readOSCStringFrom: stream | string | string := ByteArray streamContents: [ :out | [ stream peekFor: 0 ] whileFalse: [ out nextPut: stream next ] ]. (string size + 1) // 4 timesRepeat: [ stream next ]. ^ ZnCharacterEncoder ascii decodeBytes: string My point being that you probably don't need RWTextOrBinaryStream at all. Of course, if you ported existing code and don't want to change it much, your solution is acceptable. Sven > On 21 May 2021, at 15:39, Günter Khyo <[hidden email]> wrote: > > A RWTextOrBinaryStream instance can operate in binary or ascii mode, the mode can be switched at any time by sending ascii or binary, and some methods are mode-sensitive, e.g., contents will respond with a ByteArray in binary mode and a ByteString in ascii mode. (OSC uses ASCII encoding for addresses and strings, and binary formats for numbers and blobs.) > > The OSC testcases and the parser rely on this behavior. > > On 5/21/21 3:00 PM, Sven Van Caekenberghe wrote: >> >>> On 21 May 2021, at 14:02, Günter Khyo via Pharo-dev <[hidden email]> >>> wrote: >>> >>> Hi, >>> >>> I have ported the Open Sound Control package to Pharo 9.0. Since the Catalog Browser is marked as legacy, I was wondering how to submit the patch. Is there a git repository? I attached the fileout to this email in case anybody wants to take a look at the package or knows how/where to add it to Pharo 9.0, >>> >>> Patch Note: >>> >>> OSC relies on the removed RWTextOrBinaryStream class which has very specific behavior that I could not emulate using the available stream and codec classes, so I pulled in the class from Squeak 5, renamed it to OSCStream and added it to the OSC package. This seemed to be the easiest way to do it without changing the OSC implementation, but I welcome any suggestions for a cleaner solution. >>> >> I am curious, what was the specific behaviour that you could not emulate ? >> >> >>> Günter >>> >>> <OSC.st> >>> |
In reply to this post by Pharo Smalltalk Developers mailing list
Hi gunter
I’m maintaining OSC and TUIO Please do some PR if something does not work. S
|
The old travis was telling that the code works in 6.1, 7 and 8.0
I added GithubActions for Pharo 80 and I will see. S
|
I checked and all the tests pass on Pharo80.
Now I did a little pass on the tests. I do not have the time to migrate this lib to P9. But I would accept Pull Requests :) S.
|
In reply to this post by Sven Van Caekenberghe-2
Hi Sven,
Thanks for your response! That's a much nicer solution. Indeed, I did not want to change the implementation (for now) even though I don't really like the moded behavior RWTextOrBinaryStream and it was removed for good reason. I would like to suggest to use the port with that ugly wart as it is for now, so that others can use OSC. When I get around to it, I will use your suggestions to retrofit the package and add some more documentation. Günter On 5/21/21 5:18 PM, Sven Van Caekenberghe wrote: > Hi Günter, > > Thanks for answering, I expected that you would mention this aspect. > > I don't know about OSC, but from your description it sounds like it basically is a binary protocol, where some sequences of bytes are to be interpreted as ASCII encoded strings. > > I would just work on binary streams and do the encoding/decoding as needed. > > ASCII is trivial, you can either do: > > ZnCharacterEncoder ascii encodeString: 'OSC' > > or > > 'OSC' asByteArray > > And the inverse is either > > ZnCharacterEncoder ascii decodeBytes: #[79 83 67]. > > or > > #[79 83 67] asString. > > The OSC spec says: > > OSC-string > A sequence of non-null ASCII characters followed by a null, followed by 0-3 additional null characters to make the total number of bits a multiple of 32. > > One approach could be: > > #writeOSCString: string on: stream > > stream nextPutAll: (ZnCharacterEncoder ascii encodeString: string). > stream nextPut: 0. > (string size + 1) // 4 timesRepeat: [ stream nextPut: 0 ] > > #readOSCStringFrom: stream > > | string | > string := ByteArray streamContents: [ :out | > [ stream peekFor: 0 ] whileFalse: [ out nextPut: stream next ] ]. > (string size + 1) // 4 timesRepeat: [ stream next ]. > ^ ZnCharacterEncoder ascii decodeBytes: string > > My point being that you probably don't need RWTextOrBinaryStream at all. > > Of course, if you ported existing code and don't want to change it much, your solution is acceptable. > > Sven > >> On 21 May 2021, at 15:39, Günter Khyo <[hidden email]> wrote: >> >> A RWTextOrBinaryStream instance can operate in binary or ascii mode, the mode can be switched at any time by sending ascii or binary, and some methods are mode-sensitive, e.g., contents will respond with a ByteArray in binary mode and a ByteString in ascii mode. (OSC uses ASCII encoding for addresses and strings, and binary formats for numbers and blobs.) >> >> The OSC testcases and the parser rely on this behavior. >> >> On 5/21/21 3:00 PM, Sven Van Caekenberghe wrote: >>>> On 21 May 2021, at 14:02, Günter Khyo via Pharo-dev <[hidden email]> >>>> wrote: >>>> >>>> Hi, >>>> >>>> I have ported the Open Sound Control package to Pharo 9.0. Since the Catalog Browser is marked as legacy, I was wondering how to submit the patch. Is there a git repository? I attached the fileout to this email in case anybody wants to take a look at the package or knows how/where to add it to Pharo 9.0, >>>> >>>> Patch Note: >>>> >>>> OSC relies on the removed RWTextOrBinaryStream class which has very specific behavior that I could not emulate using the available stream and codec classes, so I pulled in the class from Squeak 5, renamed it to OSCStream and added it to the OSC package. This seemed to be the easiest way to do it without changing the OSC implementation, but I welcome any suggestions for a cleaner solution. >>>> >>> I am curious, what was the specific behaviour that you could not emulate ? >>> >>> >>>> Günter >>>> >>>> <OSC.st> >>>> |
In reply to this post by ducasse
Hi Stef, Great! I'll send you a pull-request for the "hotfix" this
evening. As I mentioned to Sven, I'll do some rework on the
implementation and documentation when I find the time. Günter On 5/21/21 5:55 PM, ducasse wrote:
I checked and all the tests pass on Pharo80. |
Thanks.
I do not think that it is good to reintroduce this super ugly class. at the minimum it should be in a separate branch. S
|
Agreed. I'll do the rework and send a pull-request when it's
finished. On 5/21/21 6:23 PM, ducasse wrote:
Thanks. |
In reply to this post by ducasse
I am 100% confident that we can fix this easily (i.e. portability across 7, 8 or 9), there is not a lot of code and it looks pretty straightforward at first sight.
> On 21 May 2021, at 18:23, ducasse <[hidden email]> wrote: > > Thanks. > I do not think that it is good to reintroduce this super ugly class. at the minimum it should be in a separate branch. > > S > >> On 21 May 2021, at 18:06, Günter Khyo via Pharo-dev <[hidden email]> wrote: >> >> Hi Stef, >> >> Great! I'll send you a pull-request for the "hotfix" this evening. As I mentioned to Sven, I'll do some rework on the implementation and documentation when I find the time. >> >> Günter >> >> On 5/21/21 5:55 PM, ducasse wrote: >>> I checked and all the tests pass on Pharo80. >>> Now I did a little pass on the tests. >>> I do not have the time to migrate this lib to P9. >>> But I would accept Pull Requests :) >>> >>> S. >>> >>>> On 21 May 2021, at 17:46, ducasse <[hidden email]> wrote: >>>> >>>> The old travis was telling that the code works in 6.1, 7 and 8.0 >>>> I added GithubActions for Pharo 80 and I will see. >>>> >>>> S >>>> >>>>> On 21 May 2021, at 17:40, ducasse <[hidden email]> wrote: >>>>> >>>>> Hi gunter >>>>> >>>>> I’m maintaining OSC >>>>> https://github.com/Ducasse/OSC >>>>> and TUIO >>>>> https://github.com/Ducasse/TUIO >>>>> >>>>> Please do some PR if something does not work. >>>>> >>>>> S >>>>> >>>>>> On 21 May 2021, at 14:02, Günter Khyo via Pharo-dev <[hidden email]> wrote: >>>>>> >>>>>> Hi, >>>>>> >>>>>> I have ported the Open Sound Control package to Pharo 9.0. Since the Catalog Browser is marked as legacy, I was wondering how to submit the patch. Is there a git repository? I attached the fileout to this email in case anybody wants to take a look at the package or knows how/where to add it to Pharo 9.0, >>>>>> >>>>>> Patch Note: >>>>>> >>>>>> OSC relies on the removed RWTextOrBinaryStream class which has very specific behavior that I could not emulate using the available stream and codec classes, so I pulled in the class from Squeak 5, renamed it to OSCStream and added it to the OSC package. This seemed to be the easiest way to do it without changing the OSC implementation, but I welcome any suggestions for a cleaner solution. >>>>>> >>>>>> Günter >>>>>> >>>>>> <OSC.st> >>>>> >>>> >>> > |
Sven,
Sounds good! Since you are more experienced, would you like to do the changes? On 5/21/21 6:30 PM, Sven Van Caekenberghe wrote: > I am 100% confident that we can fix this easily (i.e. portability across 7, 8 or 9), there is not a lot of code and it looks pretty straightforward at first sight. > >> On 21 May 2021, at 18:23, ducasse <[hidden email]> wrote: >> >> Thanks. >> I do not think that it is good to reintroduce this super ugly class. at the minimum it should be in a separate branch. >> >> S >> >>> On 21 May 2021, at 18:06, Günter Khyo via Pharo-dev <[hidden email]> wrote: >>> >>> Hi Stef, >>> >>> Great! I'll send you a pull-request for the "hotfix" this evening. As I mentioned to Sven, I'll do some rework on the implementation and documentation when I find the time. >>> >>> Günter >>> >>> On 5/21/21 5:55 PM, ducasse wrote: >>>> I checked and all the tests pass on Pharo80. >>>> Now I did a little pass on the tests. >>>> I do not have the time to migrate this lib to P9. >>>> But I would accept Pull Requests :) >>>> >>>> S. >>>> >>>>> On 21 May 2021, at 17:46, ducasse <[hidden email]> wrote: >>>>> >>>>> The old travis was telling that the code works in 6.1, 7 and 8.0 >>>>> I added GithubActions for Pharo 80 and I will see. >>>>> >>>>> S >>>>> >>>>>> On 21 May 2021, at 17:40, ducasse <[hidden email]> wrote: >>>>>> >>>>>> Hi gunter >>>>>> >>>>>> I’m maintaining OSC >>>>>> https://github.com/Ducasse/OSC >>>>>> and TUIO >>>>>> https://github.com/Ducasse/TUIO >>>>>> >>>>>> Please do some PR if something does not work. >>>>>> >>>>>> S >>>>>> >>>>>>> On 21 May 2021, at 14:02, Günter Khyo via Pharo-dev <[hidden email]> wrote: >>>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> I have ported the Open Sound Control package to Pharo 9.0. Since the Catalog Browser is marked as legacy, I was wondering how to submit the patch. Is there a git repository? I attached the fileout to this email in case anybody wants to take a look at the package or knows how/where to add it to Pharo 9.0, >>>>>>> >>>>>>> Patch Note: >>>>>>> >>>>>>> OSC relies on the removed RWTextOrBinaryStream class which has very specific behavior that I could not emulate using the available stream and codec classes, so I pulled in the class from Squeak 5, renamed it to OSCStream and added it to the OSC package. This seemed to be the easiest way to do it without changing the OSC implementation, but I welcome any suggestions for a cleaner solution. >>>>>>> >>>>>>> Günter >>>>>>> >>>>>>> <OSC.st> |
In reply to this post by ducasse
Thanks to Sven's tips I fixed the package and ditched the hacky
Stream class. I also cleaned up some messy parts in the
implementation. I noticed that the current implementation does not
handle blobs and the server packet processing logic could be
improved. Also, I am not sure whether recursive bundles are
handled correctly (more test cases needed) and to which extent
they are used in OSC applications, so one would have to do a fair
bit of polishing for an "industry grade" implementation. In any case, if there are any users that would like to use and
test OSC, I am happy to take feedback and make necessary
additions/modifications. Stef, I'll send you a pull request tomorrow, now I have to catch
some sleep. On 5/21/21 6:23 PM, ducasse wrote:
Thanks. OSC.st (33K) Download Attachment |
Thanks for the PR.
I do not know if you saw but there is also the Tuio package (I added a smoke test) because there was no test. But normally it uses OSC. s
|
Free forum by Nabble | Edit this page |