From c7a22c9e4a4f5090c43c8aaaf0d3d3c5b2c3839b Mon Sep 17 00:00:00 2001 From: nik gaffney Date: Mon, 7 Mar 2005 18:09:57 +0800 Subject: [PATCH] roscid darcs-hash:20050307100957-2648a-88dd27d3a86b2c718ef38e3bb089556683b3eedd.gz --- osc-examples.lisp | 18 +++++++++--------- osc.lisp | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/osc-examples.lisp b/osc-examples.lisp index abd6011..07b550f 100644 --- a/osc-examples.lisp +++ b/osc-examples.lisp @@ -34,10 +34,9 @@ "a basic test function which attempts to decode osc stuff a given port. default ogreOSC port is 4178" - (let ((s (make-instance - 'inet-socket :type :datagram :protocol :udp)) + (let ((s (make-udp-socket)) (buffer (make-sequence '(vector (unsigned-byte 8)) 1024))) - (socket-bind s #(127 0 0 1) port) + (socket-bind s #(0 0 0 0) port) (format t "listening on localhost port ~A~%~%" port) (unwind-protect (loop do @@ -49,12 +48,10 @@ (defun osc-reflector (listen-port send-ip send-port) "reflector.. . listens on a given port and sends out on another note ip#s need to be in the format #(127 0 0 1) for now.. ." - (let ((in (make-instance - 'inet-socket :type :datagram :protocol :udp)) - (out (make-instance - 'inet-socket :type :datagram :protocol :udp)) + (let ((in (make-udp-socket)) + (out (make-udp-socket)) (buffer (make-sequence '(vector (unsigned-byte 8)) 512))) - (socket-bind in #(127 0 0 1) listen-port) + (socket-bind in #(0 0 0 0) listen-port) (socket-connect out send-ip send-port) (let ((stream (socket-make-stream @@ -70,6 +67,9 @@ (when out (socket-close out)))))) +(defun make-udp-socket() + (make-instance 'inet-socket :type :datagram :protocol :udp)) + (defun stream-t1 (osc-message stream) "writes a given message to a stream. keep in mind that when using a buffered stream any funtion writing to the stream should call (finish-output stream) @@ -83,4 +83,4 @@ `(progn (write-sequence (osc:encode-message ,@args) ,stream) (finish-output ,stream))) -;end \ No newline at end of file +;end diff --git a/osc.lisp b/osc.lisp index c4b3bd5..2b6fe7e 100644 --- a/osc.lisp +++ b/osc.lisp @@ -204,7 +204,7 @@ #-(or sbcl cmucl) (error "cant decode floats using this implementation")) (defun decode-int32 (s) - (declare (type (simple-array (unsigned-byte 8) s))) + (declare (type (vector (unsigned-byte 8) s))) "4 byte > 32 bit int > two's compliment (in network byte order)" (let ((i (+ (ash (elt s 0) 24) (ash (elt s 1) 16)