osc icon indicating copy to clipboard operation
osc copied to clipboard

[FR] add to examples file

Open kflak opened this issue 1 year ago • 5 comments

Hi,

I'm working through the examples file, and I've run into two roadblocks:

  1. I am not able to find a way to close a socket once it's opened
  2. It would be great to see how to actually pull apart a bundle and do something with it. Right now I just get a message object, but I don't really know how to open it up and see what's inside.

kflak avatar Nov 23 '24 07:11 kflak

if you are using usocket have a look at socket-close function. in one of the examples, sending is wrapped in unwind-protect which should automatically close the socket after each message is sent. if you want to keep it open to send more messages, you can close the socket explicitly when complete.

    (unwind-protect
	 (socket-send s b (length b))
      (when s (socket-close s)))))

A bundle should be just a list of messages, so if you are using decode-bundle you can try accessing each element of the list (for example). have a look at osc-dispatch.lisp to see how you can setup functions to respond to various incoming osc messages.

The examples are a bit sparse.

zzkt avatar Nov 23 '24 10:11 zzkt

...and If you do have any simple examples feel free to add them.

zzkt avatar Nov 23 '24 11:11 zzkt

Thanks! Will give it a try when I have a free moment :-) Keeping the issue open for now, will add to the examples once I have something to add...

kflak avatar Nov 23 '24 11:11 kflak

No problem. I'm planning to put together a more detailed manual and add a few more examples for the 1.0 release (see #19) but the development cycle is still pretty glacial...

zzkt avatar Nov 23 '24 12:11 zzkt

Take it nice and slow :-) I managed to get it working. For some reason I didn't get a list the first time I tried, but now I'm getting a nice, beautiful list that makes it easy to parse and do stuff with. I am also keeping the port open until I close it manually.

kflak avatar Nov 24 '24 08:11 kflak