1 ;; This is the main script for the pcm-dispatch tool
2 ;; last main-arg nominates the configuration file
6 ; load contexts libasound and ALSA
10 CONFIGFILE (println (main-args -1))
11 CONFIGTEXT (read-file CONFIGFILE)
12 CONFIG (println (read-expr CONFIGTEXT))
13 PCM-LIST (println (rest (assoc "PCM-LIST" CONFIG)))
16 (define (open-pcm PCM)
17 (ALSA:snd_pcm_open PCM libasound:SND_PCM_STREAM_PLAYBACK 0))
19 ;; Find first usable PCM
20 (setf PCM (unless (dolist (PCM PCM-LIST (open-pcm PCM)))
21 (die 1 "No PCM available")))
23 (println (list 'PCM PCM))