darcs-hash:20050307100957-2648a-88dd27d3a86b2c718ef38e3bb089556683b3eedd.gz
This commit is contained in:
nik gaffney 2005-03-07 18:09:57 +08:00
parent 57772e2bd3
commit c7a22c9e4a
2 changed files with 10 additions and 10 deletions

View file

@ -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
;end

View file

@ -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)