add optional buffer-length to decode-bundle
Ignore-this: 81b0d2e19b287a2ee0b335be9bc0ec4e darcs-hash:20100314165447-16a00-c453301fefca88843434b78fec07ba04fcfb6910
This commit is contained in:
parent
8af92db17f
commit
9fe4513df5
1 changed files with 10 additions and 5 deletions
15
osc.lisp
15
osc.lisp
|
@ -133,14 +133,19 @@
|
|||
;;
|
||||
;;; ;; ;; ; ; ; ; ; ;
|
||||
|
||||
(defun decode-bundle (data)
|
||||
"decodes an osc bundle into a list of decoded-messages, which has
|
||||
an osc-timetagas its first element"
|
||||
(defun decode-bundle (data &optional bundle-length)
|
||||
"Decodes an osc bundle into a list of decoded-messages, which has an
|
||||
osc-timetagas its first element. An optional buffer-length argument
|
||||
can be supplied (i.e. the length value returned by socket-receive),
|
||||
otherwise the entire buffer is decoded - in which case, if you are
|
||||
reusing buffers, you are responsible for ensuring that the buffer does
|
||||
not contain stale data."
|
||||
(unless bundle-length
|
||||
(setf bundle-length (length data)))
|
||||
(let ((contents '()))
|
||||
(if (equalp 35 (elt data 0)) ; a bundle begins with '#'
|
||||
(let ((timetag (subseq data 8 16))
|
||||
(i 16)
|
||||
(bundle-length (length data)))
|
||||
(i 16))
|
||||
(loop while (< i bundle-length)
|
||||
do (let ((mark (+ i 4))
|
||||
(size (decode-int32
|
||||
|
|
Loading…
Reference in a new issue