2003-10-13 12:06:45 +00:00
|
|
|
;
|
|
|
|
|
; Toplevel configuration for the ALSA Ordinary Mixer Interface
|
|
|
|
|
;
|
|
|
|
|
|
2003-09-09 19:24:35 +00:00
|
|
|
(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))
|
|
|
|
|
)
|
|
|
|
|
(setq r (Aerror info))
|
|
|
|
|
)
|
2003-10-13 12:06:45 +00:00
|
|
|
(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)
|
2003-09-09 19:24:35 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defun sndo_mixer_open1 (pcm stream)
|
|
|
|
|
(setq info (Acall "pcm_info" pcm))
|
|
|
|
|
(setq r (Aerror info))
|
|
|
|
|
(when (= r 0)
|
2003-10-13 12:06:45 +00:00
|
|
|
(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)
|
2003-09-09 19:24:35 +00:00
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
2003-10-13 12:06:45 +00:00
|
|
|
(unsetq info card r)
|
2003-09-09 19:24:35 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defun sndo_mixer_open (ppcm cpcm)
|
2003-10-13 12:06:45 +00:00
|
|
|
(setq r (sndo_mixer_open1 ppcm "p"))
|
|
|
|
|
(when (= r 0) (setq r (sndo_mixer_open1 cpcm "c")))
|
|
|
|
|
(when (!= r 0) (sndo_mixer_close))
|
2003-12-21 18:25:57 +00:00
|
|
|
(unsetq sndo_mixer_open sndo_mixer_open1
|
|
|
|
|
sndo_mixer_open_virtual sndo_mixer_open_fcn
|
|
|
|
|
sndo_include r)
|
2003-10-13 12:06:45 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defun sndo_mixer_close1 (hctl stream)
|
|
|
|
|
(when hctl
|
2003-09-09 19:24:35 +00:00
|
|
|
(progn
|
2003-10-13 12:06:45 +00:00
|
|
|
(setq fcn (+ "sndo" stream "_mixer_close"))
|
|
|
|
|
(when (exfun fcn) (call fcn hctl))
|
|
|
|
|
(unsetq fcn)
|
|
|
|
|
(Acall "hctl_close" hctl)
|
2003-09-09 19:24:35 +00:00
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(defun sndo_mixer_close nil
|
2003-10-13 12:06:45 +00:00
|
|
|
(sndo_mixer_close1 (nth 1 hctls) "c")
|
|
|
|
|
(sndo_mixer_close1 (nth 0 hctls) "p")
|
2003-09-09 19:24:35 +00:00
|
|
|
(unsetq hctls)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(include (+ (path "data") "/alsa/cards/aliases.alisp"))
|