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
On 21 May 2021, at 14:02, Günter Khyo via Pharo-dev pharo-dev@lists.pharo.org 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.)
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 pharo-dev@lists.pharo.org 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 erde@chello.at 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 pharo-dev@lists.pharo.org
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 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 pharo-dev@lists.pharo.org 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>
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 stepharo@netcourrier.com wrote:
Hi gunter
I’m maintaining OSC
https://github.com/Ducasse/OSC https://github.com/Ducasse/OSC
and TUIO
https://github.com/Ducasse/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 <pharo-dev@lists.pharo.org mailto:pharo-dev@lists.pharo.org> 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 http://osc.st/>
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 stepharo@netcourrier.com 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 <stepharo@netcourrier.com mailto:stepharo@netcourrier.com> wrote:
Hi gunter
I’m maintaining OSC
https://github.com/Ducasse/OSC https://github.com/Ducasse/OSC
and TUIO
https://github.com/Ducasse/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 <pharo-dev@lists.pharo.org mailto:pharo-dev@lists.pharo.org> 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 http://osc.st/>
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 erde@chello.at 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 pharo-dev@lists.pharo.org
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 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 <stepharo@netcourrier.com
mailto:stepharo@netcourrier.com> 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 <stepharo@netcourrier.com
mailto:stepharo@netcourrier.com> 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
<pharo-dev@lists.pharo.org mailto:pharo-dev@lists.pharo.org> 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 http://osc.st/>
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 pharo-dev@lists.pharo.org 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 <stepharo@netcourrier.com mailto:stepharo@netcourrier.com> 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 <stepharo@netcourrier.com mailto:stepharo@netcourrier.com> wrote:
Hi gunter
I’m maintaining OSC
https://github.com/Ducasse/OSC https://github.com/Ducasse/OSC
and TUIO
https://github.com/Ducasse/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 <pharo-dev@lists.pharo.org mailto:pharo-dev@lists.pharo.org> 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 http://osc.st/>