added snd_hctl_ctl() function

ordinary mixer:
  - revised Ordinary Mixer I/O type
  - sndo_mixer_open() take PCMs rather than strings to pass
    the real relationship
  - an initial version of toplevel alisp script
more alisp development:
  - renamed a* functions to A* functions (acall -> Acall etc.)
  - many improvements (unset*, exfun, Acall pcm_info, Asnderr, Asyserr)
This commit is contained in:
Jaroslav Kysela 2003-09-09 19:24:35 +00:00
parent 668a300229
commit 60585e25fc
16 changed files with 535 additions and 165 deletions

82
src/conf/sndo-mixer.alisp Normal file
View file

@ -0,0 +1,82 @@
(defun sndo_include (hctl stream)
(setq info (Acall "ctl_card_info" (Acall "hctl_ctl" hctl)))
(if (= (Aerror info) 0)
(progn
(setq info (Aresult info))
(setq driver (cdr (assq "driver" (unsetq info))))
(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)
)
)
(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))
)
)
(unsetq card)
)
)
(unsetq info 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)
(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 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))
(unsetq hctls)
)
(include (+ (path "data") "/alsa/cards/aliases.alisp"))