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

View file

@ -1,6 +1,7 @@
SUBDIRS=cards pcm
cfg_files = alsa.conf
cfg_files = alsa.conf \
sndo-mixer.alisp
EXTRA_DIST = $(cfg_files)

View file

@ -23,7 +23,18 @@ cfg_files = aliases.conf \
VIA8233A.conf \
VX222.conf \
VXPocket.conf \
VXPocket440.conf
VXPocket440.conf \
\
aliases.alisp
EXTRA_DIST = $(cfg_files)
alsa_DATA = $(cfg_files)
SI7018dir = $(datadir)/alsa/cards/SI7018
SI7018_files = \
SI7018/sndoc-mixer.alisp \
SI7018/sndop-mixer.alisp
SI7018_DATA = $(SI7018_files)
EXTRA_DIST =
$(cfg_files) \
$(SI7018_files)

View file

@ -0,0 +1,4 @@
(defun sndoc_mixer_open (hctl)
(princ "sndoc_mixer_open\n")
0
)

View file

@ -0,0 +1,4 @@
(defun sndop_mixer_open (hctl)
(princ "sndop_mixer_open\n")
0
)

View file

@ -0,0 +1,25 @@
(setq snd_card_aliases_array
(
("YMF724" . "YMF744")
("YMF724F" . "YMF744")
("YMF740" . "YMF744")
("YMF740C" . "YMF744")
("YMF754" . "YMF744")
("CMIPCI" . "CMI8338")
("CMI8738" . "CMI8338")
("CMI8738-MC4" . "CMI8738-MC6")
("E-mu APS" . "EMU10K1")
("GUS Max" . "GUS")
("GUS ACE" . "GUS")
("GUS Extreme" . "GUS")
("AMD InterWave" . "GUS")
("Dynasonic 3-D" . "GUS")
("InterWave STB" . "GUS")
)
)
(defun snd_card_alias (cardname)
(setq r (assq cardname snd_card_aliases_array))
(setq r (if (null r) cardname r))
(unsetq r)
)

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"))