Initial git import
[sxemacs] / src / media / sound-alsa.h
1 /* sound-alsa.c - play a sound over the alsa server
2
3    Copyright (C) 2006 Sebastian Freundt
4
5 This file is part of SXEmacs
6
7 SXEmacs is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 SXEmacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
19
20
21 /* Synched up with: Not in FSF. */
22
23 #ifndef INCLUDED_sound_alsa_h_
24 #define INCLUDED_sound_alsa_h_
25
26 #include "sound.h"
27 #include <alsa/input.h>
28 #include <alsa/output.h>
29 #include <alsa/conf.h>
30 #include <alsa/global.h>
31 #include <alsa/pcm.h>
32 #include <alsa/error.h>
33
34 typedef struct sound_alsa_data_s sound_alsa_data_t;
35 typedef struct sound_alsa_aj_data_s sound_alsa_aj_data_t;
36
37 struct sound_alsa_data_s {
38         Lisp_Object device;
39         int keep_open;
40         snd_pcm_t *handle;
41         snd_pcm_hw_params_t *hwparams;
42         int lock;
43         sxe_mutex_t mtx;
44 };
45
46 struct sound_alsa_aj_data_s {
47         /* stream props */
48         size_t samplerate;      /* rate used on the device */
49         unsigned int channels;  /* channels used on the device */
50         size_t framesize;       /* resulting framesize */
51         snd_pcm_format_t format;
52         /* coercion stuff */
53         media_sample_format_t *msf;
54         int coe_ch_cnt;
55         audio_coerce_chain_t coe_chain[4];
56         mtype_audio_properties *mtap;
57 };
58
59 extern Lisp_Object Qalsa;               /* initialised in sound.c */
60
61 #define DEVICE_CONNECTED_TO_ALSA_P(x) 1 /* FIXME: better check */
62
63 DECLARE_AUDIO_DEVICE(sound_alsa);
64
65 #ifdef ALL_DEBUG_FLAGS
66 #undef ALSA_DEBUG_FLAG
67 #define ALSA_DEBUG_FLAG
68 #endif
69
70 #endif  /* INCLUDED_sound_alsa_h_ */