Update of /project/cello/cvsroot/cello/cl-openal In directory clnet:/tmp/cvs-serv7090/cl-openal
Modified Files: cl-openal-config.lisp cl-openal-demo.lisp cl-openal-init.lisp cl-openal.lisp cl-openal.lpr wav-handling.lisp Log Message:
--- /project/cello/cvsroot/cello/cl-openal/cl-openal-config.lisp 2006/05/17 16:14:29 1.1 +++ /project/cello/cvsroot/cello/cl-openal/cl-openal-config.lisp 2006/05/27 06:01:38 1.2 @@ -32,10 +32,10 @@ :type "dll"))
(defparameter *alut-dynamic-lib* - (make-pathname :directory '(:absolute "0dvx" "user" "dynlib") + (make-pathname :directory '(:absolute "0dev" "user" "dynlib") :name "alut" :type "dll"))
(defparameter *audio-files* (make-pathname - :directory '(:absolute "cell-cultures" "user" "sounds") + :directory '(:absolute "0dev" "user" "sounds") :type "wav")) --- /project/cello/cvsroot/cello/cl-openal/cl-openal-demo.lisp 2006/05/17 20:38:14 1.2 +++ /project/cello/cvsroot/cello/cl-openal/cl-openal-demo.lisp 2006/05/27 06:01:38 1.3 @@ -3,8 +3,8 @@ (defconstant num_buffers 7) (defparameter g-buffers (fgn-alloc 'al-uint num_buffers))
-(defun cl-openal-test () - (let ((w$ (list "/0dvx/user/sounds/jshootme.wav" ))) +(defun cl-openal-test-many () + (let ((w$ (list "/0dev/user/sounds/jshootme.wav" ))) (cl-openal-init) (apply 'wav-play-till-end (lambda (dur sources) @@ -16,6 +16,8 @@ (sleep 1) (cl-openal-shutdown))
+(defun cl-openal-test () + (wav-play-till-end nil "/0dev/user/sounds/jshootme.wav"))
--- /project/cello/cvsroot/cello/cl-openal/cl-openal-init.lisp 2006/05/26 22:08:56 1.3 +++ /project/cello/cvsroot/cello/cl-openal/cl-openal-init.lisp 2006/05/27 06:01:38 1.4 @@ -24,13 +24,8 @@
(in-package :cl-openal)
- (defparameter *openal-initialized-p* nil)
-(defun hex (dec) - (let ((*print-base* 16.)(*print-radix* t)) - (princ dec))) - (defun cl-openal-init () ;;(return-from cl-openal-init nil) (when *openal-initialized-p* @@ -38,10 +33,10 @@
(xoa)
- (assert (cffi-uffi-compat:load-foreign-library (namestring *al-dynamic-lib*)) + (assert (use-foreign-library OpenAL) () "Failed to load OpenAL dynamic lib ~a" *al-dynamic-lib*)
- (assert (cffi-uffi-compat:load-foreign-library (namestring *alut-dynamic-lib*)) + (assert (use-foreign-library ALut) () "Failed to load alut dynamic lib ~a" *alut-dynamic-lib*)
(format t "~&Open AL loaded") --- /project/cello/cvsroot/cello/cl-openal/cl-openal.lisp 2006/05/17 20:38:14 1.2 +++ /project/cello/cvsroot/cello/cl-openal/cl-openal.lisp 2006/05/27 06:01:38 1.3 @@ -26,7 +26,7 @@
(defpackage #:cl-openal (:nicknames #:oal) - (:use #:common-lisp #:cffi #:ffx) + (:use #:common-lisp #:cffi #:cffi-extender) (:export #:xoa #:al-chk @@ -41,6 +41,19 @@
(in-package :cl-openal)
+(define-foreign-library OpenAL + (:darwin (:framework "OpenAL")) + (:windows (:or "/windows/system32/openal32.dll"))) + +(define-foreign-library ALut + (:darwin (:framework "ALut")) + (:windows (:or "/windows/system32/alut.dll"))) + +(defparameter *audio-files* + (make-pathname + :directory '(:absolute "0dev" "user" "sounds") + :type "wav")) + #+doit (xoa)
--- /project/cello/cvsroot/cello/cl-openal/cl-openal.lpr 2006/05/26 22:08:56 1.3 +++ /project/cello/cvsroot/cello/cl-openal/cl-openal.lpr 2006/05/27 06:01:38 1.4 @@ -5,8 +5,7 @@ (defpackage :CL-OPENAL)
(define-project :name :cl-openal - :modules (list (make-instance 'module :name "cl-openal-config.lisp") - (make-instance 'module :name "cl-openal.lisp") + :modules (list (make-instance 'module :name "cl-openal.lisp") (make-instance 'module :name "altypes.lisp") (make-instance 'module :name "al.lisp") (make-instance 'module :name "alctypes.lisp") --- /project/cello/cvsroot/cello/cl-openal/wav-handling.lisp 2006/05/17 20:38:14 1.2 +++ /project/cello/cvsroot/cello/cl-openal/wav-handling.lisp 2006/05/27 06:01:38 1.3 @@ -47,6 +47,10 @@ (al-delete-sources sct sv) (fgn-free sv)))
+(defun wav-play-start (wav-path) + (assert (probe-file wav-path)) + (source-wav-play-start (car (al-source-gen 1)) wav-path)) + (defun wav-play-till-end (callback &rest wav-names) (when (cl-openal-init) (let ((sources (al-source-gen (length wav-names)))) @@ -76,7 +80,8 @@ (let ((buffer (wav-to-buffer wav-path))) (source-buffer-load source buffer) (al-source-play source) - (al-chk "al-Source-Play")))) + (al-chk "al-Source-Play") + source)))
(defun wav-to-buffer (wav-path) (when (cl-openal-init)