Update of /cvsroot/alsa/alsa-lib/src/conf In directory sc8-pr-cvs1:/tmp/cvs-serv29050/src/conf
Modified Files: sndo-mixer.alisp Log Message: More changes to the ordinary mixer API Index: sndo-mixer.alisp =================================================================== RCS file: /cvsroot/alsa/alsa-lib/src/conf/sndo-mixer.alisp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- sndo-mixer.alisp 9 Sep 2003 19:24:37 -0000 1.1 +++ sndo-mixer.alisp 13 Oct 2003 12:06:45 -0000 1.2 @@ -1,3 +1,7 @@ +; +; Toplevel configuration for the ALSA Ordinary Mixer Interface +; + (defun sndo_include (hctl stream) (setq info (Acall "ctl_card_info" (Acall "hctl_ctl" hctl))) (if (= (Aerror info) 0) @@ -7,75 +11,78 @@ (setq file (+ (path "data") "/alsa/cards/" (snd_card_alias driver) "/sndo" stream "-mixer.alisp")) (setq r (include file)) (when (= r -2) (Asyserr "unable to find file " file)) - (unsetq driver file r) ) (setq r (Aerror info)) - (unsetq info r) ) + (unsetq info driver file r) +) + +(defun sndo_mixer_open_fcn (stream) + (setq fcn (+ "sndo" stream "_mixer_open")) + (setq r (if (exfun fcn) (call fcn hctl) 0)) + (when (= r 0) + (setq hctls (if hctls (cons hctls (cons hctl)) hctl)) + ) + (unsetq fcn r) +) + +(defun sndo_mixer_open_hctl (card stream) + (setq hctl (Acall "hctl_open" (+ "hw:" (str card)) nil)) + (setq r (Aerror hctl)) + (when (= r 0) + (setq hctl (Aresult hctl)) + (setq r (sndo_include hctl stream)) + (when (= r 0) (setq r (sndo_mixer_open_fcn stream))) + ) + (unsetq hctl r) +) + +(defun sndo_mixer_open_virtual (pcm stream) + (setq name (Acall "pcm_name" pcm)) + (setq file (+ (path "data") "/alsa/virtual/" name "/sndo" stream "-mixer.alisp")) + (setq r (include file)) + (when (= r -2) (Asyserr "unable to find file " file)) + (when (= r 0) (setq r (sndo_mixer_open_fcn stream))) + (unsetq name file r) ) (defun sndo_mixer_open1 (pcm stream) (setq info (Acall "pcm_info" pcm)) (setq r (Aerror info)) (when (= r 0) - (progn - (setq info (Aresult info)) - (setq card (cdr (assq "card" info))) - (setq r - (if (< card 0) - (+ (Acall "pcm_name" pcm) stream) - (+ "hw:" (str card)) - ) + (setq info (Aresult info)) + (setq card (cdr (assq "card" info))) + (setq r + (if (< card 0) + (sndo_mixer_open_virtual pcm stream) + (sndo_mixer_open_hctl card stream) ) - (unsetq card) ) ) - (unsetq info r) + (unsetq info card r) ) (defun sndo_mixer_open (ppcm cpcm) - (setq pname (sndo_mixer_open1 ppcm "p")) - (setq cname (sndo_mixer_open1 cpcm "c")) - (setq phctl (Acall "hctl_open" pname nil)) - (if (= (Aerror phctl) 0) + (setq r (sndo_mixer_open1 ppcm "p")) + (when (= r 0) (setq r (sndo_mixer_open1 cpcm "c"))) + (when (!= r 0) (sndo_mixer_close)) + (unsetq r) +) + +(defun sndo_mixer_close1 (hctl stream) + (when hctl (progn - (setq phctl (Aresult phctl)) - (setq chctl (Acall "hctl_open" cname nil)) - (if (= (Aerror chctl) 0) - (progn - (setq chctl (Aresult chctl)) - (setq hctls (cons phctl (cons chctl))) - (setq r (sndo_include phctl "p")) - (when (= r 0) (setq r (sndo_include chctl "c"))) - (when (= r 0) (setq r (if (exfun sndop_mixer_open) (sndop_mixer_open phctl) 0))) - (when (= r 0) - (progn - (setq r (if (exfun sndoc_mixer_open) (sndoc_mixer_open chctl) 0)) - (unless (= r 0) (sndop_close phctl)) - ) - ) - (unless (= r 0) (sndo_close)) - (unsetq phctl chctl) - (gc) - (unsetq r) - ) - (progn - (Acall "hctl_close" (Aresult phctl)) - (setq r (Aerror chctl)) - (unsetq r) - ) - ) + (setq fcn (+ "sndo" stream "_mixer_close")) + (when (exfun fcn) (call fcn hctl)) + (unsetq fcn) + (Acall "hctl_close" hctl) ) - (setq r (Aerror phctl)) - (unsetq r) ) ) (defun sndo_mixer_close nil - (cond (exfun sndop_close) (sndop_close (nth 0 hctls))) - (cond (exfun sndoc_close) (sndoc_close (nth 1 hctls))) - (Acall "hctl_close" (nth 0 hctls)) - (Acall "hctl_close" (nth 1 hctls)) + (sndo_mixer_close1 (nth 1 hctls) "c") + (sndo_mixer_close1 (nth 0 hctls) "p") (unsetq hctls) ) ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ Alsa-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-cvslog