Delete alsalisp code

Install of the alsalisp binary has been disabled since 2006 (in commit
8d382ccd), and building of it was disabled by default in 2018 (in commit
32ceab21), so it is reasonable to assume that nobody is using it.

Use within the alsa-lib project is limited to an aliases file that looks
like it is intended as an example, plus some very small .alisp files
associated with the SiS SI7018 PCI sound card which has not been
manufactured in years. These too have not been installed since 2018 when
commit 32ceab21 disabled building of the alsalisp binary.

In preparing this change, I searched the Github issue tracker for
"lisp", "alisp" and "alsalisp", and found no complaints about the above
changes. I also did a Github code search for projects that might be
including the `alisp.h` header and found none. Therefore I think this
code can be safely deleted and nobody is likely to object.

Closes: https://github.com/alsa-project/alsa-lib/pull/448
Signed-off-by: Simon Howard <fraggle@soulsphere.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Simon Howard 2025-04-02 09:56:23 -04:00 committed by Jaroslav Kysela
parent 0d2acc2084
commit 647c001321
25 changed files with 3 additions and 5499 deletions

1
.gitignore vendored
View file

@ -35,7 +35,6 @@ include/version.h
include/alsa
include/asoundlib.h
utils/alsa-lib.spec
alsalisp/alsalisp
aserver/aserver
m4/libtool.m4
m4/ltoptions.m4

View file

@ -10,11 +10,6 @@ endif
if BUILD_PCM_PLUGIN_SHM
SUBDIRS += aserver
endif
if BUILD_MIXER
if BUILD_ALISP
SUBDIRS += alsalisp
endif
endif
SUBDIRS += test utils
EXTRA_DIST=README.md ChangeLog INSTALL TODO NOTES configure gitcompile libtool \
depcomp version MEMORY-LEAK m4/attributes.m4

View file

@ -1,8 +0,0 @@
noinst_PROGRAMS = alsalisp
alsalisp_SOURCES = alsalisp.c
alsalisp_LDADD = ../src/libasound.la
all: alsalisp
AM_CPPFLAGS=-I$(top_srcdir)/include -I$(top_srcdir)/src/alisp

View file

@ -1,110 +0,0 @@
/*
* ALSA lisp implementation
* Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <err.h>
#include "asoundlib.h"
#include "alisp.h"
static int verbose = 0;
static int warning = 0;
static int debug = 0;
static void interpret_filename(const char *file)
{
struct alisp_cfg cfg;
snd_input_t *in;
snd_output_t *out;
int err;
memset(&cfg, 0, sizeof(cfg));
if (file != NULL && strcmp(file, "-") != 0) {
if ((err = snd_input_stdio_open(&in, file, "r")) < 0) {
fprintf(stderr, "unable to open filename '%s' (%s)\n", file, snd_strerror(err));
return;
}
} else {
if ((err = snd_input_stdio_attach(&in, stdin, 0)) < 0) {
fprintf(stderr, "unable to attach stdin '%s' (%s)\n", file, snd_strerror(err));
return;
}
}
if (snd_output_stdio_attach(&out, stdout, 0) < 0) {
snd_input_close(in);
fprintf(stderr, "unable to attach stdout (%s)\n", strerror(errno));
return;
}
cfg.verbose = verbose;
cfg.warning = warning;
cfg.debug = debug;
cfg.in = in;
cfg.out = cfg.eout = cfg.vout = cfg.wout = cfg.dout = out;
err = alsa_lisp(&cfg, NULL);
if (err < 0)
fprintf(stderr, "alsa lisp returned error %i (%s)\n", err, strerror(err));
else if (verbose)
printf("file %s passed ok via alsa lisp interpreter\n", file);
snd_output_close(out);
snd_input_close(in);
}
static void usage(void)
{
fprintf(stderr, "usage: alsalisp [-vdw] [file...]\n");
exit(1);
}
int main(int argc, char **argv)
{
int c;
while ((c = getopt(argc, argv, "vdw")) != -1) {
switch (c) {
case 'v':
verbose = 1;
break;
case 'd':
debug = 1;
break;
case 'w':
warning = 1;
break;
case '?':
default:
usage();
/* NOTREACHED */
}
}
argc -= optind;
argv += optind;
if (argc < 1)
interpret_filename(NULL);
else
while (*argv)
interpret_filename(*argv++);
return 0;
}

View file

@ -1,91 +0,0 @@
(setq card (Acall 'card_next -1))
(setq card (Aresult card))
(while (>= card 0)
(progn
(princ "found card: " card "\n")
(princ " name : " (Aresult (Acall 'card_get_name card)) "\n")
(princ " longname: " (Aresult (Acall 'card_get_longname card)) "\n")
(setq card (Acall 'card_next card))
(setq card (Aresult card))
)
)
(unsetq card)
(princ "card_get_index test (SI7018): " (Acall 'card_get_index "SI7018") "\n")
(princ "card_get_index test (ABCD): " (Acall 'card_get_index "ABCD") "\n")
(setq hctl (Acall 'hctl_open 'default nil))
(if (= (Aerror hctl) 0)
(progn
(princ "open success: " hctl "\n")
(setq hctl (Ahandle hctl))
(princ "open hctl: " hctl "\n")
(setq hctl (Acall 'hctl_close hctl))
(if (= hctl 0)
(princ "close success\n")
(princ "close failed: " hctl "\n")
)
)
(progn
(princ "open failed: " hctl "\n")
)
)
(unsetq hctl)
(setq ctl (Acall 'ctl_open 'default nil))
(if (= (Aerror ctl) 0)
(progn
(princ "ctl open success: " ctl "\n")
(setq ctl (Ahandle ctl))
(setq info (Aresult (Acall 'ctl_card_info ctl)))
(princ "ctl card info: " info "\n")
(princ "ctl card info (mixername): " (cdr (assq "mixername" info)) "\n")
(unsetq info)
(setq hctl (Acall 'hctl_open_ctl ctl))
(if (= (Aerror hctl) 0)
(progn
(princ "hctl open success: " hctl "\n")
(setq hctl (Ahandle hctl))
(princ "open hctl: " hctl "\n")
(princ "load hctl: " (Acall 'hctl_load hctl) "\n")
(princ "first : " (Acall 'hctl_first_elem hctl) "\n")
(princ "last : " (Acall 'hctl_last_elem hctl) "\n")
(princ "next (first): " (Acall 'hctl_elem_next (Acall 'hctl_first_elem hctl)) "\n")
(princ "prev (last) : " (Acall 'hctl_elem_prev (Acall 'hctl_last_elem hctl)) "\n")
(setq elem (Acall 'hctl_first_elem hctl))
(while elem
(progn
(setq info (Acall 'hctl_elem_info elem))
(princ info "\n")
(setq value (Acall 'hctl_elem_read elem))
(princ value "\n")
(when (equal (cdr (assq "name" (car (cdr (assq "id" (Aresult info)))))) "Master Playback Volume")
(princ "write Master: " (Acall 'hctl_elem_write elem (20 20)) "\n")
)
(unsetq info value)
(gc)
(setq elem (Acall 'hctl_elem_next elem))
)
)
(unsetq elem)
(setq hctl (Acall 'hctl_close hctl))
(if (= hctl 0)
(princ "hctl close success\n")
(princ "hctl close failed: " hctl "\n")
)
)
(progn
(princ "hctl open failed: " hctl "\n")
(Acall 'ctl_close ctl)
)
)
(unsetq hctl)
)
(progn
(princ "ctl open failed: " ctl "\n")
)
)
(unsetq ctl)
(&stat-memory)
(&dump-memory "memory.dump")

View file

@ -1,26 +0,0 @@
(princ "Hello ALSA world\n")
(princ "One " 1 "\n")
(princ "Two " (+ 1 1) "\n")
(defun myprinc (o) (progn (princ o)))
(myprinc "Printed via myprinc function!\n")
(unsetq myprinc)
(defun printnum (from to) (while (<= from to) (princ " " from) (setq from (+ from 1))))
(princ "Numbers 1-10: ") (printnum 1 10) (princ "\n")
(unsetq printnum)
(defun factorial (n) (if (> n 1) (* n (factorial (- n 1))) 1))
(princ "Factorial of 10: " (factorial 10) "\n")
(princ "Float test 1.1 + 1.35 = " (+ 1.1 1.35) "\n")
(princ "Factorial of 10.0: " (factorial 10.0) "\n")
(princ "Factorial of 20.0: " (factorial 20.0) "\n")
(unsetq factorial)
(setq alist '((one . first) (two . second) (three . third)))
(princ "alist = " alist "\n")
(princ "alist assoc one = " (assoc 'one alist) "\n")
(princ "alist rassoc third = " (rassoc 'third alist) "\n")
(unsetq alist)
(&stat-memory)

View file

@ -1 +0,0 @@
(princ "itest.lisp file included!\n")

View file

@ -1,382 +0,0 @@
;
; Test code for all basic alsa lisp commands.
; The test is indended to find memory leaks.
;
; Copyright (c) 2003 Jaroslav Kysela <perex@perex.cz>
; License: GPL v2 (http://www.gnu.org/licenses/gpl.html)
;
;
; Basic commands
;
(!=) (&check-memory)
(!= 0) (&check-memory)
(!= 0 1) (&check-memory)
(!= 1 1) (&check-memory)
(!= 0 1 2) (&check-memory)
(!= 'aaaa 'bbbb) (&check-memory)
(%) (&check-memory)
(% 11) (&check-memory)
(% 11 5) (&check-memory)
(% 11.5 5.1) (&check-memory)
(% 11.5 5.1 2.2) (&check-memory)
(% 'aaaa 'bbbb) (&check-memory)
(&check-memory) (&check-memory)
(&check-memory "abcd") (&check-memory)
(&dump-memory "-") (&check-memory)
(&dump-memory) (&check-memory)
(&dump-objects "-") (&check-memory)
(&dump-objects) (&check-memory)
(&stat-memory) (&check-memory)
(&stat-memory "abcd") (&check-memory)
(*) (&check-memory)
(* 1) (&check-memory)
(* 1 2) (&check-memory)
(* 1.1 2.2) (&check-memory)
(* 1.1 2.2 3.3) (&check-memory)
(* 'aaaa) (&check-memory)
(+) (&check-memory)
(+ 1) (&check-memory)
(+ 1 2) (&check-memory)
(+ 1.1 2.2) (&check-memory)
(+ 1.1 2.2 3.3) (&check-memory)
(+ 'aaaa) (&check-memory)
(+ 'aaaa 'bbbb) (&check-memory)
(+ "aaaa") (&check-memory)
(+ "aaaa" "bbbb") (&check-memory)
(+ "aaaa" "bbbb" "cccc") (&check-memory)
(-) (&check-memory)
(- 1) (&check-memory)
(- 1 2) (&check-memory)
(- 1.1 2.2) (&check-memory)
(- 1.1 2.2 3.3) (&check-memory)
(- 'aaaa) (&check-memory)
(- 'aaaa 'bbbb) (&check-memory)
(/) (&check-memory)
(/ 1) (&check-memory)
(/ 1 2) (&check-memory)
(/ 1.1 2.2) (&check-memory)
(/ 1.1 2.2 3.3) (&check-memory)
(/ 'aaaa) (&check-memory)
(/ 'aaaa 'bbbb) (&check-memory)
(<) (&check-memory)
(< 0) (&check-memory)
(< 0 1) (&check-memory)
(< 1 0) (&check-memory)
(< 0 1 2) (&check-memory)
(<=) (&check-memory)
(<= 0) (&check-memory)
(<= 0 1) (&check-memory)
(<= 1 0) (&check-memory)
(<= 0 1 2) (&check-memory)
(=) (&check-memory)
(= 0) (&check-memory)
(= 0 1) (&check-memory)
(= 1 1) (&check-memory)
(= 0 1 2) (&check-memory)
(>) (&check-memory)
(> 0) (&check-memory)
(> 0 1) (&check-memory)
(> 1 0) (&check-memory)
(> 0 1 2) (&check-memory)
(>= 0) (&check-memory)
(>= 0 1) (&check-memory)
(>= 1 0) (&check-memory)
(>= 0 1 2) (&check-memory)
(and) (&check-memory)
(and 0) (&check-memory)
(and 1) (&check-memory)
(and 0 0 0) (&check-memory)
(quote a) (&check-memory)
(assoc) (&check-memory)
(assoc 'one) (&check-memory)
(assoc 'one '((one . first))) (&check-memory)
(assoc 'one '((two . second))) (&check-memory)
(assoc 'one '((one . first) (two . second))) (&check-memory)
(assq) (&check-memory)
(assq 'one) (&check-memory)
(assq "one" '(("one" . "first"))) (&check-memory)
(assq "one" '(("two" . "second"))) (&check-memory)
(assq "one" '(("one" . "first") ("two" . "second"))) (&check-memory)
(atom) (&check-memory)
(atom 'one) (&check-memory)
(atom "one") (&check-memory)
(atom "one" 'two) (&check-memory)
(funcall) (&check-memory)
(car) (&check-memory)
(car '(one . two)) (&check-memory)
(cdr) (&check-memory)
(cdr '(one . two)) (&check-memory)
(concat) (&check-memory)
(concat 'aaaa) (&check-memory)
(concat 'aaaa 'bbbb) (&check-memory)
(concat "aaaa") (&check-memory)
(concat "aaaa" "bbbb") (&check-memory)
(concat "aaaa" "bbbb" "cccc") (&check-memory)
(cond) (&check-memory)
(cond 0) (&check-memory)
(cond 0 1) (&check-memory)
(cond 0 1 2) (&check-memory)
(cond 0 1 2 3) (&check-memory)
(cond (0 'a) (1 'b) (0 'd)) (&check-memory)
(cond 1) (&check-memory)
(cond 1 1) (&check-memory)
(cond 1 1 2) (&check-memory)
(cond 1 1 2 3) (&check-memory)
(cons) (&check-memory)
(cons "a") (&check-memory)
(cons "a" "b") (&check-memory)
(cons "a" "b" "c") (&check-memory)
(eq) (&check-memory)
(eq 1) (&check-memory)
(eq 0 0) (&check-memory)
(eq "a" "b") (&check-memory)
(eq "a" "b" "c") (&check-memory)
(equal) (&check-memory)
(equal 1) (&check-memory)
(equal 0 0) (&check-memory)
(equal "a" "b") (&check-memory)
(equal "a" "b" "c") (&check-memory)
(exfun) (&check-memory)
(exfun 'abcd) (&check-memory)
(exfun 'abcd 'ijkl) (&check-memory)
(format) (&check-memory)
(format 1) (&check-memory)
(format 'a) (&check-memory)
(format "a" "b" "c") (&check-memory)
(format "1.2") (&check-memory)
(format "%c" 43) (&check-memory)
(format "%d" 12) (&check-memory)
(format "%i" 12) (&check-memory)
(format "%f" 12.1) (&check-memory)
(format "%s" "abcd") (&check-memory)
(format "%s %i %i" "abcd" 1 2) (&check-memory)
(garbage-collect) (&check-memory)
(gc) (&check-memory)
(if) (&check-memory)
(if t) (&check-memory)
(if t 'a) (&check-memory)
(if t 'a 'b) (&check-memory)
(if nil) (&check-memory)
(if nil 'a) (&check-memory)
(if nil 'a 'b) (&check-memory)
(include "itest.lisp") (&check-memory)
(list) (&check-memory)
(list "a") (&check-memory)
(list "a" "b") (&check-memory)
(list "a" "b" "c") (&check-memory)
(not) (&check-memory)
(not 0) (&check-memory)
(not nil) (&check-memory)
(not t) (&check-memory)
(not 'a) (&check-memory)
(not 'a 'b 'c 'd) (&check-memory)
(nth) (&check-memory)
(nth 2) (&check-memory)
(nth 2 nil) (&check-memory)
(nth 2 '(('one 'two 'three))) (&check-memory)
(null) (&check-memory)
(null 0) (&check-memory)
(null nil) (&check-memory)
(null t) (&check-memory)
(null 'a) (&check-memory)
(null 'a 'b 'c 'd) (&check-memory)
(or) (&check-memory)
(or 0) (&check-memory)
(or 1) (&check-memory)
(or 0 0 0) (&check-memory)
(path) (&check-memory)
(path 0) (&check-memory)
(path 1) (&check-memory)
(path 0 0 0) (&check-memory)
(path "data") (&check-memory)
(princ) (&check-memory)
(princ "\nabcd\n") (&check-memory)
(princ "a" "b" "c\n") (&check-memory)
(prog1) (&check-memory)
(prog1 1) (&check-memory)
(prog1 1 2 3 4) (&check-memory)
(prog2) (&check-memory)
(prog2 1) (&check-memory)
(prog2 1 2 3 4) (&check-memory)
(progn) (&check-memory)
(progn 1) (&check-memory)
(progn 1 2 3 4) (&check-memory)
(quote) (&check-memory)
(quote a) (&check-memory)
(rassoc) (&check-memory)
(rassoc 'first) (&check-memory)
(rassoc 'first '((one . first))) (&check-memory)
(rassoc 'first '((two . second))) (&check-memory)
(rassoc 'first '((one . first) (two . second))) (&check-memory)
(rassq) (&check-memory)
(rassq "first") (&check-memory)
(rassq "first" '(("one" . "first"))) (&check-memory)
(rassq "first" '(("two" . "second"))) (&check-memory)
(rassq "first" '(("one" . "first") ("two" . "second"))) (&check-memory)
(set) (&check-memory)
(set "a") (unset "a") (&check-memory)
(set "a" 1) (unset "a") (&check-memory)
(set a 1) (unset a) (&check-memory)
(set "a" 1 2) (unset "a") (&check-memory)
(setf) (&check-memory)
(setf a) (unsetf a) (&check-memory)
(setf a 1) (unsetf a) (&check-memory)
(setf a 1 2) (unsetf a) (&check-memory)
(setq) (&check-memory)
(setq a) (unsetq a) (&check-memory)
(setq a 1) (unsetq a) (&check-memory)
(setq a 1 2) (unsetq a) (&check-memory)
(string-equal) (&check-memory)
(string-equal 1) (&check-memory)
(string-equal "a") (&check-memory)
(string-equal "a" "a") (&check-memory)
(string-equal "a" "b") (&check-memory)
(string-equal "a" "b" "c") (&check-memory)
(string-to-integer) (&check-memory)
(string-to-integer 1) (&check-memory)
(string-to-integer 1.5) (&check-memory)
(string-to-integer "a") (&check-memory)
(string-to-integer "a" "a") (&check-memory)
(string-to-integer "a" "b") (&check-memory)
(string-to-integer "a" "b" "c") (&check-memory)
(string-to-float) (&check-memory)
(string-to-float 1) (&check-memory)
(string-to-float 1.5) (&check-memory)
(string-to-float "a") (&check-memory)
(string-to-float "a" "a") (&check-memory)
(string-to-float "a" "b") (&check-memory)
(string-to-float "a" "b" "c") (&check-memory)
(string=) (&check-memory)
(string= 1) (&check-memory)
(string= "a") (&check-memory)
(string= "a" "a") (&check-memory)
(string= "a" "b") (&check-memory)
(string= "a" "b" "c") (&check-memory)
(unless) (&check-memory)
(unless 1) (&check-memory)
(unless 0 1 2) (&check-memory)
(unless t 2 3 4) (&check-memory)
(unless nil 2 3 4) (&check-memory)
(unset) (&check-memory)
(unset "a") (&check-memory)
(unsetf) (&check-memory)
(unsetf a) (&check-memory)
(unsetf a b) (&check-memory)
(unsetq) (&check-memory)
(unsetq a) (&check-memory)
(unsetq a b) (&check-memory)
(when) (&check-memory)
(when 0) (&check-memory)
(when 0 1) (&check-memory)
(when t 1) (&check-memory)
(when nil 1) (&check-memory)
(while) (&check-memory)
(while nil) (&check-memory)
(while nil 1) (&check-memory)
(while nil 1 2 3 4) (&check-memory)
;
; more complex command sequences
;
(setq abcd "abcd")
(unsetq abcd)
(&check-memory)
(setq abcd (("abcd" . "efgh") ("1234" . "5678")))
(unsetq abcd)
(&check-memory)
(defun myfun () (princ "a\n"))
(exfun 'myfun)
(unsetq myfun)
(&check-memory)
(defun myfun () (princ "a\n"))
(funcall 'myfun)
(funcall 'myfun 'aaaaa)
(unsetq myfun)
(&check-memory)
(defun myfun (o) (princ o "a\n"))
(funcall 'myfun)
(funcall 'myfun 'aaaaa)
(unsetq myfun)
(&check-memory)
(defun myfun (o p) (princ o p "\n"))
(funcall 'myfun)
(funcall 'myfun 'aaaaa)
(funcall 'myfun 'aaaaa 'bbbbb)
(unsetq myfun)
(&check-memory)
(defun printnum (from to) (while (<= from to) (princ " " from) (setq from (+ from 1))))
(princ "Numbers 1-10:") (printnum 1 10) (princ "\n")
(unsetq printnum)
;
; game over
;
(princ "*********************\n")
(princ "OK, all tests passed!\n")
(princ "*********************\n")
(&stat-memory)

View file

@ -419,10 +419,6 @@ AC_ARG_ENABLE(ucm,
AC_ARG_ENABLE(topology,
AS_HELP_STRING([--disable-topology], [disable the DSP topology component]),
[build_topology="$enableval"], [build_topology="yes"])
AC_ARG_ENABLE(alisp,
AS_HELP_STRING([--enable-alisp], [enable the alisp component]),
[build_alisp="$enableval"], [build_alisp="no"])
test "$softfloat" = "yes" && build_alisp="no"
AC_ARG_ENABLE(old-symbols,
AS_HELP_STRING([--disable-old-symbols], [disable old obsoleted symbols]),
[keep_old_symbols="$enableval"], [keep_old_symbols="yes"])
@ -496,7 +492,6 @@ AM_CONDITIONAL([BUILD_HWDEP], [test x$build_hwdep = xyes])
AM_CONDITIONAL([BUILD_SEQ], [test x$build_seq = xyes])
AM_CONDITIONAL([BUILD_UCM], [test x$build_ucm = xyes])
AM_CONDITIONAL([BUILD_TOPOLOGY], [test x$build_topology = xyes])
AM_CONDITIONAL([BUILD_ALISP], [test x$build_alisp = xyes])
AM_CONDITIONAL([BUILD_MIXER_MODULES], [test x$build_mixer_modules = xyes])
AM_CONDITIONAL([BUILD_MIXER_PYMODULES], [test x$build_mixer_pymodules = xyes])
@ -773,13 +768,13 @@ AC_CONFIG_FILES(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
src/pcm/Makefile src/pcm/scopes/Makefile \
src/rawmidi/Makefile src/timer/Makefile \
src/hwdep/Makefile src/seq/Makefile src/ucm/Makefile \
src/alisp/Makefile src/topology/Makefile \
src/topology/Makefile \
src/conf/Makefile \
src/conf/cards/Makefile \
src/conf/ctl/Makefile \
src/conf/pcm/Makefile \
modules/Makefile modules/mixer/Makefile modules/mixer/simple/Makefile \
alsalisp/Makefile aserver/Makefile \
aserver/Makefile \
test/Makefile test/lsb/Makefile \
utils/Makefile utils/alsa-lib.spec utils/alsa.pc utils/alsa-topology.pc)

View file

@ -5,7 +5,6 @@ set -e
bits32=
cbits32=
modules=
alisp=
lto=
if [ $# -ne 0 ]; then
endloop=
@ -20,10 +19,6 @@ if [ $# -ne 0 ]; then
modules=yes
echo "Forced mixer modules build..."
shift ;;
alisp)
alisp=yes
echo "Forced alisp code build..."
shift ;;
python2)
python2=yes
echo "Forced python2 interpreter build..."
@ -71,10 +66,6 @@ if [ "$modules" = "yes" ]; then
args="$args --enable-mixer-pymods"
fi
if [ "$alisp" = "yes" ]; then
args="$args --enable-alisp"
fi
if [ "$python2" = "yes" ]; then
args="$args --enable-python2"
fi

View file

@ -58,10 +58,6 @@ if BUILD_TOPOLOGY
alsainclude_HEADERS += topology.h
endif
if BUILD_ALISP
alsainclude_HEADERS += alisp.h
endif
noinst_HEADERS = alsa sys.h search.h list.h aserver.h local.h alsa-symbols.h \
asoundlib-head.h asoundlib-tail.h bswap.h type_compat.h

View file

@ -1,55 +0,0 @@
/*
* ALSA lisp implementation
* Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
struct alisp_cfg {
int verbose: 1,
warning: 1,
debug: 1;
snd_input_t *in; /* program code */
snd_output_t *out; /* program output */
snd_output_t *eout; /* error output */
snd_output_t *vout; /* verbose output */
snd_output_t *wout; /* warning output */
snd_output_t *dout; /* debug output */
};
struct alisp_instance;
struct alisp_object;
struct alisp_seq_iterator;
struct alisp_cfg *alsa_lisp_default_cfg(snd_input_t *input);
void alsa_lisp_default_cfg_free(struct alisp_cfg *cfg);
int alsa_lisp(struct alisp_cfg *cfg, struct alisp_instance **instance);
void alsa_lisp_free(struct alisp_instance *instance);
int alsa_lisp_function(struct alisp_instance *instance, struct alisp_seq_iterator **result,
const char *id, const char *args, ...)
#ifndef DOC_HIDDEN
__attribute__ ((format (printf, 4, 5)))
#endif
;
void alsa_lisp_result_free(struct alisp_instance *instance,
struct alisp_seq_iterator *result);
int alsa_lisp_seq_first(struct alisp_instance *instance, const char *id,
struct alisp_seq_iterator **seq);
int alsa_lisp_seq_next(struct alisp_seq_iterator **seq);
int alsa_lisp_seq_count(struct alisp_seq_iterator *seq);
int alsa_lisp_seq_integer(struct alisp_seq_iterator *seq, long *val);
int alsa_lisp_seq_pointer(struct alisp_seq_iterator *seq, const char *ptr_id, void **ptr);

View file

@ -46,7 +46,6 @@ extern "C" {
#define SND_ERROR_BEGIN 500000 /**< Lower boundary of sound error codes. */
#define SND_ERROR_INCOMPATIBLE_VERSION (SND_ERROR_BEGIN+0) /**< Kernel/library protocols are not compatible. */
#define SND_ERROR_ALISP_NIL (SND_ERROR_BEGIN+1) /**< Lisp encountered an error during acall. */
const char *snd_strerror(int errnum);

View file

@ -51,13 +51,6 @@ if BUILD_UCM
SUBDIRS += ucm
libasound_la_LIBADD += ucm/libucm.la
endif
if BUILD_ALISP
if VERSIONED_SYMBOLS
VERSION_CPPFLAGS += -DHAVE_ALISP_SYMS
endif
SUBDIRS += alisp
libasound_la_LIBADD += alisp/libalisp.la
endif
SUBDIRS += conf
libasound_la_LIBADD += @ALSA_DEPLIBS@
@ -102,7 +95,4 @@ topology/libtopology.la:
instr/libinstr.la:
$(MAKE) -C instr libinstr.la
alisp/libalisp.la:
$(MAKE) -C alisp libalisp.la
AM_CPPFLAGS=-I$(top_srcdir)/include

View file

@ -129,19 +129,9 @@ ALSA_0.9.3 {
} ALSA_0.9.0;
ALSA_0.9.5 {
#ifdef HAVE_ALISP_SYMS
global:
@SYMBOL_PREFIX@alsa_lisp;
#endif
} ALSA_0.9.3;
ALSA_0.9.7 {
#ifdef HAVE_ALISP_SYMS
global:
@SYMBOL_PREFIX@alsa_lisp_*;
#endif
} ALSA_0.9.5;
ALSA_1.1.6 {

View file

@ -1,11 +0,0 @@
EXTRA_LTLIBRARIES = libalisp.la
EXTRA_DIST = alisp_snd.c
libalisp_la_SOURCES = alisp.c
noinst_HEADERS = alisp_local.h
all: libalisp.la
AM_CPPFLAGS=-I$(top_srcdir)/include

File diff suppressed because it is too large Load diff

View file

@ -1,151 +0,0 @@
/*
* ALSA lisp implementation
* Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
*
* Based on work of Sandro Sigala (slisp-1.2)
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "list.h"
enum alisp_tokens {
ALISP_IDENTIFIER,
ALISP_INTEGER,
ALISP_FLOAT,
ALISP_FLOATE,
ALISP_STRING
};
enum alisp_objects {
ALISP_OBJ_INTEGER,
ALISP_OBJ_FLOAT,
ALISP_OBJ_IDENTIFIER,
ALISP_OBJ_STRING,
ALISP_OBJ_POINTER,
ALISP_OBJ_CONS,
ALISP_OBJ_LAST_SEARCH = ALISP_OBJ_CONS,
ALISP_OBJ_NIL,
ALISP_OBJ_T,
};
struct alisp_object;
#define ALISP_TYPE_MASK 0xf0000000
#define ALISP_TYPE_SHIFT 28
#define ALISP_REFS_MASK 0x0fffffff
#define ALISP_REFS_SHIFT 0
#define ALISP_MAX_REFS (ALISP_REFS_MASK>>ALISP_REFS_SHIFT)
#define ALISP_MAX_REFS_LIMIT ((ALISP_MAX_REFS + 1) / 2)
struct alisp_object {
struct list_head list;
unsigned int type_refs; /* type and count of references */
union {
char *s;
long i;
double f;
const void *ptr;
struct {
struct alisp_object *car;
struct alisp_object *cdr;
} c;
} value;
};
static inline enum alisp_objects alisp_get_type(struct alisp_object *p)
{
return (p->type_refs >> ALISP_TYPE_SHIFT);
}
static inline void alisp_set_type(struct alisp_object *p, enum alisp_objects type)
{
p->type_refs &= ~ALISP_TYPE_MASK;
p->type_refs |= (unsigned int)type << ALISP_TYPE_SHIFT;
}
static inline int alisp_compare_type(struct alisp_object *p, enum alisp_objects type)
{
return ((unsigned int)type << ALISP_TYPE_SHIFT) ==
(p->type_refs & ALISP_TYPE_MASK);
}
static inline void alisp_set_refs(struct alisp_object *p, unsigned int refs)
{
p->type_refs &= ~ALISP_REFS_MASK;
p->type_refs |= refs & ALISP_REFS_MASK;
}
static inline unsigned int alisp_get_refs(struct alisp_object *p)
{
return p->type_refs & ALISP_REFS_MASK;
}
static inline unsigned int alisp_inc_refs(struct alisp_object *p)
{
unsigned r = alisp_get_refs(p) + 1;
alisp_set_refs(p, r);
return r;
}
static inline unsigned int alisp_dec_refs(struct alisp_object *p)
{
unsigned r = alisp_get_refs(p) - 1;
alisp_set_refs(p, r);
return r;
}
struct alisp_object_pair {
struct list_head list;
const char *name;
struct alisp_object *value;
};
#define ALISP_LEX_BUF_MAX 16
#define ALISP_OBJ_PAIR_HASH_SHIFT 4
#define ALISP_OBJ_PAIR_HASH_SIZE (1<<ALISP_OBJ_PAIR_HASH_SHIFT)
#define ALISP_OBJ_PAIR_HASH_MASK (ALISP_OBJ_PAIR_HASH_SIZE-1)
#define ALISP_FREE_OBJ_POOL 512 /* free objects above this pool */
struct alisp_instance {
int verbose: 1,
warning: 1,
debug: 1;
/* i/o */
snd_input_t *in;
snd_output_t *out;
snd_output_t *eout; /* error output */
snd_output_t *vout; /* verbose output */
snd_output_t *wout; /* warning output */
snd_output_t *dout; /* debug output */
/* lexer */
int charno;
int lineno;
int lex_buf[ALISP_LEX_BUF_MAX];
int *lex_bufp;
char *token_buffer;
int token_buffer_max;
int thistoken;
/* object allocator / storage */
long free_objs;
long used_objs;
long max_objs;
struct list_head free_objs_list;
struct list_head used_objs_list[ALISP_OBJ_PAIR_HASH_SIZE][ALISP_OBJ_LAST_SEARCH + 1];
/* set object */
struct list_head setobjs_list[ALISP_OBJ_PAIR_HASH_SIZE];
};

View file

@ -1,936 +0,0 @@
/*
* ALSA lisp implementation - sound related commands
* Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "../control/control_local.h"
struct acall_table {
const char *name;
struct alisp_object * (*func) (struct alisp_instance *instance, struct acall_table * item, struct alisp_object * args);
void * xfunc;
const char *prefix;
};
/*
* helper functions
*/
static inline int get_integer(struct alisp_object * obj)
{
if (alisp_compare_type(obj, ALISP_OBJ_INTEGER))
return obj->value.i;
return 0;
}
static inline const void *get_pointer(struct alisp_object * obj)
{
if (alisp_compare_type(obj, ALISP_OBJ_POINTER))
return obj->value.ptr;
return NULL;
}
static const char *get_string(struct alisp_object * obj, const char * deflt)
{
if (obj == &alsa_lisp_t)
return "true";
if (alisp_compare_type(obj, ALISP_OBJ_STRING) ||
alisp_compare_type(obj, ALISP_OBJ_IDENTIFIER))
return obj->value.s;
return deflt;
}
struct flags {
const char *key;
unsigned int mask;
};
static unsigned int get_flags(struct alisp_instance * instance,
struct alisp_object * obj,
const struct flags * flags,
unsigned int deflt)
{
const char *key;
int invert;
unsigned int result;
const struct flags *ptr;
struct alisp_object *n;
if (obj == &alsa_lisp_nil)
return deflt;
result = deflt;
do {
key = get_string(obj, NULL);
if (key) {
invert = key[0] == '!';
key += invert;
ptr = flags;
while (ptr->key) {
if (!strcmp(ptr->key, key)) {
if (invert)
result &= ~ptr->mask;
else
result |= ptr->mask;
break;
}
ptr++;
}
}
delete_tree(instance, car(obj));
obj = cdr(n = obj);
delete_object(instance, n);
} while (obj != &alsa_lisp_nil);
return result;
}
static const void *get_ptr(struct alisp_instance * instance,
struct alisp_object * obj,
const char *_ptr_id)
{
const char *ptr_id;
const void *ptr;
ptr_id = get_string(car(obj), NULL);
if (ptr_id == NULL) {
delete_tree(instance, obj);
return NULL;
}
if (strcmp(ptr_id, _ptr_id)) {
delete_tree(instance, obj);
return NULL;
}
ptr = get_pointer(cdr(obj));
delete_tree(instance, obj);
return ptr;
}
static struct alisp_object * new_lexpr(struct alisp_instance * instance, int err)
{
struct alisp_object * lexpr;
lexpr = new_object(instance, ALISP_OBJ_CONS);
if (lexpr == NULL)
return NULL;
lexpr->value.c.car = new_integer(instance, err);
if (lexpr->value.c.car == NULL) {
delete_object(instance, lexpr);
return NULL;
}
lexpr->value.c.cdr = new_object(instance, ALISP_OBJ_CONS);
if (lexpr->value.c.cdr == NULL) {
delete_object(instance, lexpr->value.c.car);
delete_object(instance, lexpr);
return NULL;
}
return lexpr;
}
static struct alisp_object * add_cons(struct alisp_instance * instance,
struct alisp_object *lexpr,
int cdr, const char *id,
struct alisp_object *obj)
{
struct alisp_object * p1, * p2;
if (lexpr == NULL || obj == NULL) {
delete_tree(instance, obj);
return NULL;
}
if (cdr) {
p1 = lexpr->value.c.cdr = new_object(instance, ALISP_OBJ_CONS);
} else {
p1 = lexpr->value.c.car = new_object(instance, ALISP_OBJ_CONS);
}
lexpr = p1;
if (p1 == NULL) {
delete_tree(instance, obj);
return NULL;
}
p1->value.c.car = new_object(instance, ALISP_OBJ_CONS);
if ((p2 = p1->value.c.car) == NULL)
goto __err;
p2->value.c.car = new_string(instance, id);
if (p2->value.c.car == NULL) {
__err:
if (cdr)
lexpr->value.c.cdr = NULL;
else
lexpr->value.c.car = NULL;
delete_tree(instance, p1);
delete_tree(instance, obj);
return NULL;
}
p2->value.c.cdr = obj;
return lexpr;
}
static struct alisp_object * add_cons2(struct alisp_instance * instance,
struct alisp_object *lexpr,
int cdr, struct alisp_object *obj)
{
struct alisp_object * p1;
if (lexpr == NULL || obj == NULL) {
delete_tree(instance, obj);
return NULL;
}
if (cdr) {
p1 = lexpr->value.c.cdr = new_object(instance, ALISP_OBJ_CONS);
} else {
p1 = lexpr->value.c.car = new_object(instance, ALISP_OBJ_CONS);
}
lexpr = p1;
if (p1 == NULL) {
delete_tree(instance, obj);
return NULL;
}
p1->value.c.car = obj;
return lexpr;
}
static struct alisp_object * new_result1(struct alisp_instance * instance,
int err, const char *ptr_id, void *ptr)
{
struct alisp_object * lexpr, * p1;
if (err < 0)
ptr = NULL;
lexpr = new_object(instance, ALISP_OBJ_CONS);
if (lexpr == NULL)
return NULL;
lexpr->value.c.car = new_integer(instance, err);
if (lexpr->value.c.car == NULL) {
delete_object(instance, lexpr);
return NULL;
}
p1 = add_cons(instance, lexpr, 1, ptr_id, new_pointer(instance, ptr));
if (p1 == NULL) {
delete_object(instance, lexpr);
return NULL;
}
return lexpr;
}
static struct alisp_object * new_result2(struct alisp_instance * instance,
int err, int val)
{
struct alisp_object * lexpr, * p1;
if (err < 0)
val = 0;
lexpr = new_lexpr(instance, err);
if (lexpr == NULL)
return NULL;
p1 = lexpr->value.c.cdr;
p1->value.c.car = new_integer(instance, val);
if (p1->value.c.car == NULL) {
delete_object(instance, lexpr);
return NULL;
}
return lexpr;
}
static struct alisp_object * new_result3(struct alisp_instance * instance,
int err, const char *str)
{
struct alisp_object * lexpr, * p1;
if (err < 0)
str = "";
lexpr = new_lexpr(instance, err);
if (lexpr == NULL)
return NULL;
p1 = lexpr->value.c.cdr;
p1->value.c.car = new_string(instance, str);
if (p1->value.c.car == NULL) {
delete_object(instance, lexpr);
return NULL;
}
return lexpr;
}
/*
* macros
*/
/*
* HCTL functions
*/
typedef int (*snd_int_pp_strp_int_t)(void **rctl, const char *name, int mode);
typedef int (*snd_int_pp_p_t)(void **rctl, void *handle);
typedef int (*snd_int_p_t)(void *rctl);
typedef char * (*snd_str_p_t)(void *rctl);
typedef int (*snd_int_intp_t)(int *val);
typedef int (*snd_int_str_t)(const char *str);
typedef int (*snd_int_int_strp_t)(int val, char **str);
typedef void *(*snd_p_p_t)(void *handle);
static struct alisp_object * FA_int_pp_strp_int(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
const char *name;
int err, mode;
void *handle;
struct alisp_object *p1, *p2;
static const struct flags flags[] = {
{ "nonblock", SND_CTL_NONBLOCK },
{ "async", SND_CTL_ASYNC },
{ "readonly", SND_CTL_READONLY },
{ NULL, 0 }
};
name = get_string(p1 = eval(instance, car(args)), NULL);
if (name == NULL)
return &alsa_lisp_nil;
mode = get_flags(instance, p2 = eval(instance, car(cdr(args))), flags, 0);
delete_tree(instance, cdr(cdr(args)));
delete_object(instance, cdr(args));
delete_object(instance, args);
delete_tree(instance, p2);
err = ((snd_int_pp_strp_int_t)item->xfunc)(&handle, name, mode);
delete_tree(instance, p1);
return new_result1(instance, err, item->prefix, handle);
}
static struct alisp_object * FA_int_pp_p(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
int err;
void *handle;
const char *prefix1;
struct alisp_object *p1;
if (item->xfunc == &snd_hctl_open_ctl)
prefix1 = "ctl";
else {
delete_tree(instance, args);
return &alsa_lisp_nil;
}
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
handle = (void *)get_ptr(instance, p1, prefix1);
if (handle == NULL)
return &alsa_lisp_nil;
err = ((snd_int_pp_p_t)item->xfunc)(&handle, handle);
return new_result1(instance, err, item->prefix, handle);
}
static struct alisp_object * FA_p_p(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
void *handle;
const char *prefix1;
struct alisp_object * p1;
if (item->xfunc == &snd_hctl_first_elem ||
item->xfunc == &snd_hctl_last_elem ||
item->xfunc == &snd_hctl_elem_next ||
item->xfunc == &snd_hctl_elem_prev)
prefix1 = "hctl_elem";
else if (item->xfunc == &snd_hctl_ctl)
prefix1 = "ctl";
else {
delete_tree(instance, args);
return &alsa_lisp_nil;
}
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
handle = (void *)get_ptr(instance, p1, item->prefix);
if (handle == NULL)
return &alsa_lisp_nil;
handle = ((snd_p_p_t)item->xfunc)(handle);
return new_cons_pointer(instance, prefix1, handle);
}
static struct alisp_object * FA_int_p(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
void *handle;
struct alisp_object * p1;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
handle = (void *)get_ptr(instance, p1, item->prefix);
if (handle == NULL)
return &alsa_lisp_nil;
return new_integer(instance, ((snd_int_p_t)item->xfunc)(handle));
}
static struct alisp_object * FA_str_p(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
void *handle;
struct alisp_object * p1;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
handle = (void *)get_ptr(instance, p1, item->prefix);
if (handle == NULL)
return &alsa_lisp_nil;
return new_string(instance, ((snd_str_p_t)item->xfunc)(handle));
}
static struct alisp_object * FA_int_intp(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
int val, err;
struct alisp_object * p1;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
if (!alisp_compare_type(p1, ALISP_OBJ_INTEGER)) {
delete_tree(instance, p1);
return &alsa_lisp_nil;
}
val = p1->value.i;
delete_tree(instance, p1);
err = ((snd_int_intp_t)item->xfunc)(&val);
return new_result2(instance, err, val);
}
static struct alisp_object * FA_int_str(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
int err;
struct alisp_object * p1;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
if (!alisp_compare_type(p1, ALISP_OBJ_STRING) &&
!alisp_compare_type(p1, ALISP_OBJ_IDENTIFIER)) {
delete_tree(instance, p1);
return &alsa_lisp_nil;
}
err = ((snd_int_str_t)item->xfunc)(p1->value.s);
delete_tree(instance, p1);
return new_integer(instance, err);
}
static struct alisp_object * FA_int_int_strp(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
int err;
char *str;
long val;
struct alisp_object * p1;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
if (!alisp_compare_type(p1, ALISP_OBJ_INTEGER)) {
delete_tree(instance, p1);
return &alsa_lisp_nil;
}
val = p1->value.i;
delete_tree(instance, p1);
err = ((snd_int_int_strp_t)item->xfunc)(val, &str);
return new_result3(instance, err, str);
}
static struct alisp_object * FA_card_info(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
snd_ctl_t *handle;
struct alisp_object * lexpr, * p1;
snd_ctl_card_info_t info = {0};
int err;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
handle = (snd_ctl_t *)get_ptr(instance, p1, item->prefix);
if (handle == NULL)
return &alsa_lisp_nil;
err = snd_ctl_card_info(handle, &info);
lexpr = new_lexpr(instance, err);
if (err < 0)
return lexpr;
p1 = add_cons(instance, lexpr->value.c.cdr, 0, "id", new_string(instance, snd_ctl_card_info_get_id(&info)));
p1 = add_cons(instance, p1, 1, "driver", new_string(instance, snd_ctl_card_info_get_driver(&info)));
p1 = add_cons(instance, p1, 1, "name", new_string(instance, snd_ctl_card_info_get_name(&info)));
p1 = add_cons(instance, p1, 1, "longname", new_string(instance, snd_ctl_card_info_get_longname(&info)));
p1 = add_cons(instance, p1, 1, "mixername", new_string(instance, snd_ctl_card_info_get_mixername(&info)));
p1 = add_cons(instance, p1, 1, "components", new_string(instance, snd_ctl_card_info_get_components(&info)));
if (p1 == NULL) {
delete_tree(instance, lexpr);
return NULL;
}
return lexpr;
}
static struct alisp_object * create_ctl_elem_id(struct alisp_instance * instance, snd_ctl_elem_id_t * id, struct alisp_object * cons)
{
cons = add_cons(instance, cons, 0, "numid", new_integer(instance, snd_ctl_elem_id_get_numid(id)));
cons = add_cons(instance, cons, 1, "iface", new_string(instance, snd_ctl_elem_iface_name(snd_ctl_elem_id_get_interface(id))));
cons = add_cons(instance, cons, 1, "dev", new_integer(instance, snd_ctl_elem_id_get_device(id)));
cons = add_cons(instance, cons, 1, "subdev", new_integer(instance, snd_ctl_elem_id_get_subdevice(id)));
cons = add_cons(instance, cons, 1, "name", new_string(instance, snd_ctl_elem_id_get_name(id)));
cons = add_cons(instance, cons, 1, "index", new_integer(instance, snd_ctl_elem_id_get_index(id)));
return cons;
}
static int parse_ctl_elem_id(struct alisp_instance * instance,
struct alisp_object * cons,
snd_ctl_elem_id_t * id)
{
struct alisp_object *p1;
const char *xid;
if (cons == NULL)
return -ENOMEM;
snd_ctl_elem_id_clear(id);
id->numid = 0;
do {
p1 = car(cons);
if (alisp_compare_type(p1, ALISP_OBJ_CONS)) {
xid = get_string(p1->value.c.car, NULL);
if (xid == NULL) {
/* noop */
} else if (!strcmp(xid, "numid")) {
snd_ctl_elem_id_set_numid(id, get_integer(p1->value.c.cdr));
} else if (!strcmp(xid, "iface")) {
snd_ctl_elem_id_set_interface(id, snd_config_get_ctl_iface_ascii(get_string(p1->value.c.cdr, "0")));
} else if (!strcmp(xid, "dev")) {
snd_ctl_elem_id_set_device(id, get_integer(p1->value.c.cdr));
} else if (!strcmp(xid, "subdev")) {
snd_ctl_elem_id_set_subdevice(id, get_integer(p1->value.c.cdr));
} else if (!strcmp(xid, "name")) {
snd_ctl_elem_id_set_name(id, get_string(p1->value.c.cdr, "?"));
} else if (!strcmp(xid, "index")) {
snd_ctl_elem_id_set_index(id, get_integer(p1->value.c.cdr));
}
}
delete_tree(instance, p1);
cons = cdr(p1 = cons);
delete_object(instance, p1);
} while (cons != &alsa_lisp_nil);
return 0;
}
static struct alisp_object * FA_hctl_find_elem(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
snd_hctl_t *handle;
snd_ctl_elem_id_t id = {0};
struct alisp_object *p1;
handle = (snd_hctl_t *)get_ptr(instance, car(args), item->prefix);
if (handle == NULL) {
delete_tree(instance, cdr(args));
delete_object(instance, args);
return &alsa_lisp_nil;
}
p1 = car(cdr(args));
delete_tree(instance, cdr(cdr(args)));
delete_object(instance, cdr(args));
delete_object(instance, args);
if (parse_ctl_elem_id(instance, eval(instance, p1), &id) < 0)
return &alsa_lisp_nil;
return new_cons_pointer(instance, "hctl_elem", snd_hctl_find_elem(handle, &id));
}
static struct alisp_object * FA_hctl_elem_info(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
snd_hctl_elem_t *handle;
struct alisp_object * lexpr, * p1, * p2;
snd_ctl_elem_info_t info = {0};
snd_ctl_elem_id_t id = {0};
snd_ctl_elem_type_t type;
int err;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
handle = (snd_hctl_elem_t *)get_ptr(instance, p1, item->prefix);
if (handle == NULL)
return &alsa_lisp_nil;
err = snd_hctl_elem_info(handle, &info);
lexpr = new_lexpr(instance, err);
if (err < 0)
return lexpr;
type = snd_ctl_elem_info_get_type(&info);
p1 = add_cons(instance, lexpr->value.c.cdr, 0, "id", p2 = new_object(instance, ALISP_OBJ_CONS));
snd_ctl_elem_info_get_id(&info, &id);
if (create_ctl_elem_id(instance, &id, p2) == NULL) {
delete_tree(instance, lexpr);
return NULL;
}
p1 = add_cons(instance, p1, 1, "type", new_string(instance, snd_ctl_elem_type_name(type)));
p1 = add_cons(instance, p1, 1, "readable", new_integer(instance, snd_ctl_elem_info_is_readable(&info)));
p1 = add_cons(instance, p1, 1, "writable", new_integer(instance, snd_ctl_elem_info_is_writable(&info)));
p1 = add_cons(instance, p1, 1, "volatile", new_integer(instance, snd_ctl_elem_info_is_volatile(&info)));
p1 = add_cons(instance, p1, 1, "inactive", new_integer(instance, snd_ctl_elem_info_is_inactive(&info)));
p1 = add_cons(instance, p1, 1, "locked", new_integer(instance, snd_ctl_elem_info_is_locked(&info)));
p1 = add_cons(instance, p1, 1, "isowner", new_integer(instance, snd_ctl_elem_info_is_owner(&info)));
p1 = add_cons(instance, p1, 1, "owner", new_integer(instance, snd_ctl_elem_info_get_owner(&info)));
p1 = add_cons(instance, p1, 1, "count", new_integer(instance, snd_ctl_elem_info_get_count(&info)));
err = INTERNAL(snd_ctl_elem_info_get_dimensions)(&info);
if (err > 0) {
int idx;
p1 = add_cons(instance, p1, 1, "dimensions", p2 = new_object(instance, ALISP_OBJ_CONS));
for (idx = 0; idx < err; idx++)
p2 = add_cons2(instance, p2, idx > 0, new_integer(instance, INTERNAL(snd_ctl_elem_info_get_dimension)(&info, idx)));
}
switch (type) {
case SND_CTL_ELEM_TYPE_ENUMERATED: {
unsigned int items, item;
items = snd_ctl_elem_info_get_items(&info);
p1 = add_cons(instance, p1, 1, "items", p2 = new_object(instance, ALISP_OBJ_CONS));
for (item = 0; item < items; item++) {
snd_ctl_elem_info_set_item(&info, item);
err = snd_hctl_elem_info(handle, &info);
if (err < 0) {
p2 = add_cons2(instance, p2, item, &alsa_lisp_nil);
} else {
p2 = add_cons2(instance, p2, item, new_string(instance, snd_ctl_elem_info_get_item_name(&info)));
}
}
break;
}
case SND_CTL_ELEM_TYPE_INTEGER:
p1 = add_cons(instance, p1, 1, "min", new_integer(instance, snd_ctl_elem_info_get_min(&info)));
p1 = add_cons(instance, p1, 1, "max", new_integer(instance, snd_ctl_elem_info_get_max(&info)));
p1 = add_cons(instance, p1, 1, "step", new_integer(instance, snd_ctl_elem_info_get_step(&info)));
break;
case SND_CTL_ELEM_TYPE_INTEGER64:
p1 = add_cons(instance, p1, 1, "min64", new_float(instance, snd_ctl_elem_info_get_min64(&info)));
p1 = add_cons(instance, p1, 1, "max64", new_float(instance, snd_ctl_elem_info_get_max64(&info)));
p1 = add_cons(instance, p1, 1, "step64", new_float(instance, snd_ctl_elem_info_get_step64(&info)));
break;
default:
break;
}
if (p1 == NULL) {
delete_tree(instance, lexpr);
return NULL;
}
return lexpr;
}
static struct alisp_object * FA_hctl_elem_read(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
snd_hctl_elem_t *handle;
struct alisp_object * lexpr, * p1 = NULL, * obj;
snd_ctl_elem_info_t info = {0};
snd_ctl_elem_value_t value = {0};
snd_ctl_elem_type_t type;
unsigned int idx, count;
int err;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
handle = (snd_hctl_elem_t *)get_ptr(instance, p1, item->prefix);
if (handle == NULL)
return &alsa_lisp_nil;
err = snd_hctl_elem_info(handle, &info);
if (err >= 0)
err = snd_hctl_elem_read(handle, &value);
lexpr = new_lexpr(instance, err);
if (err < 0)
return lexpr;
type = snd_ctl_elem_info_get_type(&info);
count = snd_ctl_elem_info_get_count(&info);
if (type == SND_CTL_ELEM_TYPE_IEC958) {
count = sizeof(snd_aes_iec958_t);
type = SND_CTL_ELEM_TYPE_BYTES;
}
for (idx = 0; idx < count; idx++) {
switch (type) {
case SND_CTL_ELEM_TYPE_BOOLEAN:
obj = new_integer(instance, snd_ctl_elem_value_get_boolean(&value, idx));
break;
case SND_CTL_ELEM_TYPE_INTEGER:
obj = new_integer(instance, snd_ctl_elem_value_get_integer(&value, idx));
break;
case SND_CTL_ELEM_TYPE_INTEGER64:
obj = new_integer(instance, snd_ctl_elem_value_get_integer64(&value, idx));
break;
case SND_CTL_ELEM_TYPE_ENUMERATED:
obj = new_integer(instance, snd_ctl_elem_value_get_enumerated(&value, idx));
break;
case SND_CTL_ELEM_TYPE_BYTES:
obj = new_integer(instance, snd_ctl_elem_value_get_byte(&value, idx));
break;
default:
obj = NULL;
break;
}
if (idx == 0) {
p1 = add_cons2(instance, lexpr->value.c.cdr, 0, obj);
} else {
p1 = add_cons2(instance, p1, 1, obj);
}
}
if (p1 == NULL) {
delete_tree(instance, lexpr);
return &alsa_lisp_nil;
}
return lexpr;
}
static struct alisp_object * FA_hctl_elem_write(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
snd_hctl_elem_t *handle;
struct alisp_object * p1 = NULL, * obj;
snd_ctl_elem_info_t info = {0};
snd_ctl_elem_value_t value = {0};
snd_ctl_elem_type_t type;
unsigned int idx, count;
int err;
p1 = car(cdr(args));
obj = eval(instance, car(args));
delete_tree(instance, cdr(cdr(args)));
delete_object(instance, cdr(args));
delete_object(instance, args);
handle = (snd_hctl_elem_t *)get_ptr(instance, obj, item->prefix);
if (handle == NULL) {
delete_tree(instance, p1);
return &alsa_lisp_nil;
}
err = snd_hctl_elem_info(handle, &info);
if (err < 0) {
delete_tree(instance, p1);
return new_integer(instance, err);
}
type = snd_ctl_elem_info_get_type(&info);
count = snd_ctl_elem_info_get_count(&info);
if (type == SND_CTL_ELEM_TYPE_IEC958) {
count = sizeof(snd_aes_iec958_t);
type = SND_CTL_ELEM_TYPE_BYTES;
}
idx = -1;
do {
if (++idx >= count) {
delete_tree(instance, p1);
break;
}
obj = car(p1);
switch (type) {
case SND_CTL_ELEM_TYPE_BOOLEAN:
snd_ctl_elem_value_set_boolean(&value, idx, get_integer(obj));
break;
case SND_CTL_ELEM_TYPE_INTEGER:
snd_ctl_elem_value_set_integer(&value, idx, get_integer(obj));
break;
case SND_CTL_ELEM_TYPE_INTEGER64:
snd_ctl_elem_value_set_integer64(&value, idx, get_integer(obj));
break;
case SND_CTL_ELEM_TYPE_ENUMERATED:
snd_ctl_elem_value_set_enumerated(&value, idx, get_integer(obj));
break;
case SND_CTL_ELEM_TYPE_BYTES:
snd_ctl_elem_value_set_byte(&value, idx, get_integer(obj));
break;
default:
break;
}
delete_tree(instance, obj);
p1 = cdr(obj = p1);
delete_object(instance, obj);
} while (p1 != &alsa_lisp_nil);
err = snd_hctl_elem_write(handle, &value);
return new_integer(instance, err);
}
static struct alisp_object * FA_pcm_info(struct alisp_instance * instance, struct acall_table * item, struct alisp_object * args)
{
snd_pcm_t *handle;
struct alisp_object * lexpr, * p1;
snd_pcm_info_t info = {0};
int err;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
handle = (snd_pcm_t *)get_ptr(instance, p1, item->prefix);
if (handle == NULL)
return &alsa_lisp_nil;
err = snd_pcm_info(handle, &info);
lexpr = new_lexpr(instance, err);
if (err < 0)
return lexpr;
p1 = add_cons(instance, lexpr->value.c.cdr, 0, "card", new_integer(instance, snd_pcm_info_get_card(&info)));
p1 = add_cons(instance, p1, 1, "device", new_integer(instance, snd_pcm_info_get_device(&info)));
p1 = add_cons(instance, p1, 1, "subdevice", new_integer(instance, snd_pcm_info_get_subdevice(&info)));
p1 = add_cons(instance, p1, 1, "id", new_string(instance, snd_pcm_info_get_id(&info)));
p1 = add_cons(instance, p1, 1, "name", new_string(instance, snd_pcm_info_get_name(&info)));
p1 = add_cons(instance, p1, 1, "subdevice_name", new_string(instance, snd_pcm_info_get_subdevice_name(&info)));
p1 = add_cons(instance, p1, 1, "class", new_integer(instance, snd_pcm_info_get_class(&info)));
p1 = add_cons(instance, p1, 1, "subclass", new_integer(instance, snd_pcm_info_get_subclass(&info)));
p1 = add_cons(instance, p1, 1, "subdevices_count", new_integer(instance, snd_pcm_info_get_subdevices_count(&info)));
p1 = add_cons(instance, p1, 1, "subdevices_avail", new_integer(instance, snd_pcm_info_get_subdevices_avail(&info)));
//p1 = add_cons(instance, p1, 1, "sync", new_string(instance, snd_pcm_info_get_sync(&info)));
return lexpr;
}
/*
* main code
*/
static const struct acall_table acall_table[] = {
{ "card_get_index", &FA_int_str, (void *)snd_card_get_index, NULL },
{ "card_get_longname", &FA_int_int_strp, (void *)snd_card_get_longname, NULL },
{ "card_get_name", &FA_int_int_strp, (void *)snd_card_get_name, NULL },
{ "card_next", &FA_int_intp, (void *)&snd_card_next, NULL },
{ "ctl_card_info", &FA_card_info, NULL, "ctl" },
{ "ctl_close", &FA_int_p, (void *)&snd_ctl_close, "ctl" },
{ "ctl_open", &FA_int_pp_strp_int, (void *)&snd_ctl_open, "ctl" },
{ "hctl_close", &FA_int_p, (void *)&snd_hctl_close, "hctl" },
{ "hctl_ctl", &FA_p_p, (void *)&snd_hctl_ctl, "hctl" },
{ "hctl_elem_info", &FA_hctl_elem_info, (void *)&snd_hctl_elem_info, "hctl_elem" },
{ "hctl_elem_next", &FA_p_p, (void *)&snd_hctl_elem_next, "hctl_elem" },
{ "hctl_elem_prev", &FA_p_p, (void *)&snd_hctl_elem_prev, "hctl_elem" },
{ "hctl_elem_read", &FA_hctl_elem_read, (void *)&snd_hctl_elem_read, "hctl_elem" },
{ "hctl_elem_write", &FA_hctl_elem_write, (void *)&snd_hctl_elem_write, "hctl_elem" },
{ "hctl_find_elem", &FA_hctl_find_elem, (void *)&snd_hctl_find_elem, "hctl" },
{ "hctl_first_elem", &FA_p_p, (void *)&snd_hctl_first_elem, "hctl" },
{ "hctl_free", &FA_int_p, (void *)&snd_hctl_free, "hctl" },
{ "hctl_last_elem", &FA_p_p, (void *)&snd_hctl_last_elem, "hctl" },
{ "hctl_load", &FA_int_p, (void *)&snd_hctl_load, "hctl" },
{ "hctl_open", &FA_int_pp_strp_int, (void *)&snd_hctl_open, "hctl" },
{ "hctl_open_ctl", &FA_int_pp_p, (void *)&snd_hctl_open_ctl, "hctl" },
{ "pcm_info", &FA_pcm_info, NULL, "pcm" },
{ "pcm_name", &FA_str_p, (void *)&snd_pcm_name, "pcm" },
};
static int acall_compar(const void *p1, const void *p2)
{
return strcmp(((struct acall_table *)p1)->name,
((struct acall_table *)p2)->name);
}
static struct alisp_object * F_acall(struct alisp_instance *instance, struct alisp_object * args)
{
struct alisp_object * p1, *p2;
struct acall_table key, *item;
p1 = eval(instance, car(args));
p2 = cdr(args);
delete_object(instance, args);
if (!alisp_compare_type(p1, ALISP_OBJ_IDENTIFIER) &&
!alisp_compare_type(p1, ALISP_OBJ_STRING)) {
delete_tree(instance, p2);
return &alsa_lisp_nil;
}
key.name = p1->value.s;
if ((item = bsearch(&key, acall_table,
sizeof acall_table / sizeof acall_table[0],
sizeof acall_table[0], acall_compar)) != NULL) {
delete_tree(instance, p1);
return item->func(instance, item, p2);
}
delete_tree(instance, p1);
delete_tree(instance, p2);
lisp_warn(instance, "acall function %s' is undefined", p1->value.s);
return &alsa_lisp_nil;
}
static struct alisp_object * F_ahandle(struct alisp_instance *instance, struct alisp_object * args)
{
struct alisp_object *p1;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
args = car(cdr(p1));
delete_tree(instance, cdr(cdr(p1)));
delete_object(instance, cdr(p1));
delete_tree(instance, car(p1));
delete_object(instance, p1);
return args;
}
static struct alisp_object * F_aerror(struct alisp_instance *instance, struct alisp_object * args)
{
struct alisp_object *p1;
p1 = eval(instance, car(args));
delete_tree(instance, cdr(args));
delete_object(instance, args);
args = car(p1);
if (args == &alsa_lisp_nil) {
delete_tree(instance, p1);
return new_integer(instance, SND_ERROR_ALISP_NIL);
} else {
delete_tree(instance, cdr(p1));
delete_object(instance, p1);
}
return args;
}
static int common_error(snd_output_t **rout, struct alisp_instance *instance, struct alisp_object * args)
{
struct alisp_object * p = args, * p1;
snd_output_t *out;
int err;
err = snd_output_buffer_open(&out);
if (err < 0) {
delete_tree(instance, args);
return err;
}
do {
p1 = eval(instance, car(p));
if (alisp_compare_type(p1, ALISP_OBJ_STRING))
snd_output_printf(out, "%s", p1->value.s);
else
princ_object(out, p1);
delete_tree(instance, p1);
p = cdr(p1 = p);
delete_object(instance, p1);
} while (p != &alsa_lisp_nil);
*rout = out;
return 0;
}
static struct alisp_object * F_snderr(struct alisp_instance *instance, struct alisp_object * args)
{
snd_output_t *out;
char *str;
if (common_error(&out, instance, args) < 0)
return &alsa_lisp_nil;
snd_output_buffer_string(out, &str);
SNDERR(str);
snd_output_close(out);
return &alsa_lisp_t;
}
static struct alisp_object * F_syserr(struct alisp_instance *instance, struct alisp_object * args)
{
snd_output_t *out;
char *str;
if (common_error(&out, instance, args) < 0)
return &alsa_lisp_nil;
snd_output_buffer_string(out, &str);
SYSERR(str);
snd_output_close(out);
return &alsa_lisp_t;
}
static const struct intrinsic snd_intrinsics[] = {
{ "Acall", F_acall },
{ "Aerror", F_aerror },
{ "Ahandle", F_ahandle },
{ "Aresult", F_ahandle },
{ "Asnderr", F_snderr },
{ "Asyserr", F_syserr }
};

View file

@ -1,9 +1,6 @@
SUBDIRS=cards ctl pcm
cfg_files = alsa.conf
if BUILD_ALISP
cfg_files += sndo-mixer.alisp
endif
if BUILD_MODULES
if BUILD_MIXER_MODULES
cfg_files += smixer.conf

View file

@ -60,22 +60,6 @@ cfg_files = aliases.conf \
VXPocket.conf \
VXPocket440.conf
if BUILD_ALISP
cfg_files += aliases.alisp
endif
alsa_DATA = $(cfg_files)
if BUILD_ALISP
SI7018dir = $(alsaconfigdir)/cards/SI7018
SI7018_files = \
SI7018/sndoc-mixer.alisp \
SI7018/sndop-mixer.alisp
SI7018_DATA = $(SI7018_files)
else
SI7018_files=
endif
EXTRA_DIST = \
$(cfg_files) \
$(SI7018_files)
EXTRA_DIST = $(cfg_files)

View file

@ -1,11 +0,0 @@
;
; SiS SI7018 mixer abstract layer
;
; Copyright (c) 2003 Jaroslav Kysela <perex@perex.cz>
; License: GPL v2 (http://www.gnu.org/licenses/gpl.html)
;
(defun sndoc_mixer_open (hctl pcm)
(princ "sndoc_mixer_open: hctl=" hctl " pcm=" pcm "\n")
0
)

View file

@ -1,11 +0,0 @@
;
; SiS SI7018 mixer abstract layer
;
; Copyright (c) 2003 Jaroslav Kysela <perex@perex.cz>
; License: GPL v2 (http://www.gnu.org/licenses/gpl.html)
;
(defun sndop_mixer_open (hctl pcm)
(princ "sndop_mixer_open: hctl=" hctl " pcm=" pcm "\n")
0
)

View file

@ -1,29 +0,0 @@
(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)
)
(defun snd_card_alias_unset ()
(unsetq snd_card_aliases_array snd_card_alias)
)

View file

@ -1,115 +0,0 @@
;
; Toplevel configuration for the ALSA Ordinary Mixer Interface
;
; Copyright (c) 2003 Jaroslav Kysela <perex@perex.cz>
; License: GPL v2 (http://www.gnu.org/licenses/gpl.html)
;
(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 (concat (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))
)
(unsetq info driver file r)
)
(defun sndo_mixer_open_fcn (hctl stream pcm)
(setq fcn (concat "sndo" stream "_mixer_open"))
(setq r (if (exfun fcn) (funcall fcn hctl pcm) 0))
(when (= r 0)
(setq hctls (if hctls (cons hctls (cons hctl)) hctl))
)
(unsetq fcn r)
)
(defun sndo_mixer_open_hctl (name stream pcm)
(setq hctl (Acall "hctl_open" name nil))
(setq r (Aerror hctl))
(when (= r 0)
(setq hctl (Aresult hctl))
(setq r (sndo_include hctl stream))
(if (= r 0)
(setq r (sndo_mixer_open_fcn hctl stream pcm))
(Acall "hctl_close" hctl)
)
)
(unsetq hctl r)
)
(defun sndo_mixer_open_virtual (name stream pcm)
(setq file (concat (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 nil stream pcm)))
(unsetq file r)
)
(defun sndo_mixer_open1 (name stream)
(if (compare-strings name 0 2 "hw:" 0 2)
(sndo_mixer_open_hctl name stream nil)
(sndo_mixer_open_virtual name stream nil)
)
)
(defun sndo_mixer_open (pname cname)
(setq r (sndo_mixer_open1 pname "p"))
(when (= r 0) (setq r (sndo_mixer_open1 cname "c")))
(when (!= r 0) (sndo_mixer_close))
(unsetq sndo_mixer_open
sndo_mixer_open_pcm sndo_mixer_open_pcm1
sndo_mixer_open_virtual sndo_mixer_open_fcn
sndo_include r)
)
(defun sndo_mixer_open_pcm1 (pcm stream)
(setq info (Acall "pcm_info" pcm))
(setq r (Aerror info))
(when (= r 0)
(setq info (Aresult info))
(setq card (cdr (assq "card" info)))
(setq r
(if (< card 0)
(sndo_mixer_open_virtual (Acall "pcm_name" pcm) stream pcm)
(sndo_mixer_open_hctl (format "hw:%i" card) stream pcm)
)
)
)
(unsetq info card r)
)
(defun sndo_mixer_open_pcm (ppcm cpcm)
(setq r (sndo_mixer_open_pcm1 ppcm "p"))
(when (= r 0) (setq r (sndo_mixer_open_pcm1 cpcm "c")))
(when (!= r 0) (sndo_mixer_close))
(unsetq sndo_mixer_open
sndo_mixer_open_pcm sndo_mixer_open_pcm1
sndo_mixer_open_virtual sndo_mixer_open_fcn
sndo_include r)
)
(defun sndo_mixer_close1 (hctl stream)
(when hctl
(progn
(setq fcn (concat "sndo" stream "_mixer_close"))
(when (exfun fcn) (funcall fcn hctl))
(unsetq fcn)
(Acall "hctl_close" hctl)
)
)
)
(defun sndo_mixer_close nil
(sndo_mixer_close1 (nth 1 hctls) "c")
(sndo_mixer_close1 (nth 0 hctls) "p")
(snd_card_alias_unset)
(unsetq hctls)
)
(include (concat (path "data") "/alsa/cards/aliases.alisp"))