changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/ffi/alsa/pkg.lisp

changeset 698: 96958d3eb5b0
parent: 7e3c88fff062
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 ;;; alsa.lisp --- low-level bindings to ALSA
2 
3 ;;; Commentary:
4 
5 ;;; Code:
6 (defpackage :alsa
7  (:use :cl :std :sb-alien)
8  (:import-from :sb-unix :off-t)
9  (:export ))
10 
11 (in-package :alsa)
12 
13 (define-alien-loader "asound" t "/usr/lib/")
14 
15 (defconstant %seek-set 0)
16 (defconstant %seek-cur 1)
17 (defconstant %seek-end 2)
18 
19 (define-alien-type snd-pcm (* t))
20 (define-alien-type snd-output (* t))
21 
22 (define-alien-type snd-pcm-stream int)
23 (define-alien-type snd-pcm-mode int)
24 
25 (define-alien-routine snd-pcm-open int (pcm (* snd-pcm)) (name c-string) (ty snd-pcm-stream) (mode snd-pcm-mode))
26 
27 (define-alien-routine snd-pcm-close int (pcm snd-pcm))
28 
29 (define-alien-routine snd-strerror c-string (errnum int))
30 
31 ;; TODO
32 (define-alien-type snd-pcm-format int)
33 
34 (define-alien-type snd-pcm-access int)
35 
36 (define-alien-routine snd-pcm-set-params int
37  (pcm snd-pcm)
38  (format snd-pcm-format)
39  (access snd-pcm-access)
40  (channels unsigned-int)
41  (rate unsigned-int)
42  (soft-resample int)
43  (latency unsigned-int))
44 
45 (define-alien-routine snd-pcm-recover int
46  (pcm snd-pcm)
47  (err int)
48  (silent int))
49 
50 (define-alien-type snd-pcm-sframes long)
51 (define-alien-type snd-pcm-uframes unsigned-long)
52 
53 (define-alien-routine snd-pcm-writei snd-pcm-sframes
54  (pcm snd-pcm)
55  (buffer (* t))
56  (size snd-pcm-uframes))
57 
58 (define-alien-routine snd-output-stdio-attach int
59  (outputp (* snd-output))
60  (file (* t))
61  (close int))
62 
63 (define-alien-routine snd-pcm-dump int
64  (pcm snd-pcm)
65  (out snd-output))
66 
67 (define-alien-variable stdout (* t))
68 
69