Hello.
> Added to lispbuilder-sdl:
>
> - (LOAD-IMAGE VECTOR)
> - (LOAD-IMAGE RWOPS)
>
> Added to lispbuilder-sdl-image
>
> - (LOAD-IMAGE VECTOR)
Maybe something similar can be added to sdl-mixer, too. For example,
for me, the following functions seem to work (they are working fine
unter clisp and sbcl for me):
(defun Load-WAV (array)
(cffi:with-foreign-object (mem-array :unsigned-char (length array))
(loop for i from 0 below (length array) do
(setf (cffi:mem-aref mem-array :unsigned-char i) (aref array i)))
(sdl-mixer-cffi::Load-WAV-RW (sdl-cffi::sdl-rw-from-mem mem-array
(length array)) 1)))
(defun load-sample-from-vector (array)
"Loads the sample file saved in this byte-vector. Must be a `WAVE`,
`AIFF`, `RIFF`, `OGG`, or `VOC` file.
Returns the sample as a new [CHUNK](#chunk) object, or NIL on error."
(let ((chunk-fp (Load-WAV array)))
(if (sdl-base:is-valid-ptr chunk-fp)
(make-instance 'sdl-mixer-cffi::chunk :fp chunk-fp)
(error "Cannot load the byte-vector."))))
Unfortunately, for load-music, a function named LOAD-MUS is used,
which seems not to support RWOps. Anyway, I think it is always good to
have the possibility to load things from byte-vectors, i.e., if you
want to load some file through the network, directly into a
byte-vector, without having to involve the filesystem, or if you want
to save the files in the executable (for sbcl this makes sense - the
executables are always 28 Megabytes large). Maybe a similar
Possibility could be added to lispbuilder-sdl-mixer, too.
- Christoph
_______________________________________________
application-builder mailing list
[email protected]
http://www.lispniks.com/mailman/listinfo/application-builder