Audio Plugin: add PulseAudio support
[src/app-framework-binder.git] / plugins / audio / audio-alsa.h
1 /*
2  * Copyright (C) 2015 "IoT.bzh"
3  * Author "Manuel Bachmann"
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #ifndef AUDIO_ALSA_H
20 #define AUDIO_ALSA_H
21
22 #include <pthread.h>
23 #include <alsa/asoundlib.h>
24
25 #include "local-def.h"
26
27 typedef struct dev_ctx_alsa dev_ctx_alsa_T;
28
29 struct dev_ctx_alsa {
30   char *name;
31   snd_pcm_t *dev;
32   snd_pcm_hw_params_t *params;
33   snd_mixer_elem_t *mixer_elm;
34   snd_mixer_elem_t *mixer_elm_m;
35   long vol_max;
36   long vol;
37   pthread_t thr;
38   unsigned char thr_should_run;
39   unsigned char thr_finished;
40 };
41
42 STATIC void* _alsa_play_thread_fn (void *);
43 PUBLIC int _alsa_get_volume (unsigned int, unsigned int);
44 PUBLIC unsigned char _alsa_get_mute (unsigned int);
45
46 static struct dev_ctx_alsa **dev_ctx_a = NULL;
47
48 #endif /* AUDIO_ALSA_H */