testing display related segfaults .. :(
[my-code/ivac.git] / src / audio.h
1 /* audio.h -- audio headers */
2
3 #ifndef AUDIO_H
4 #define AUDIO_H
5
6 /* includes */
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <unistd.h>
10 #include <errno.h>
11 #include <fcntl.h>
12 #include <sys/types.h>
13 #include <sys/stat.h>
14 #include <sys/ioctl.h>
15 #include <sys/soundcard.h>
16
17 /* defines */
18 #define MAX_CHAR_DEVICE 32
19 #define SOUND_DEVICE "/dev/dsp"
20
21 #define A_SUCCESS 1
22 #define A_ERROR -1
23
24 #define BIT_8 AFMT_U8
25 #define BIT_16 AFMT_S16_LE
26 #define MONO 1
27 #define STEREO 2
28
29 /* audio specific variables */
30 typedef struct s_audio {
31   int dsp_fd;
32   int mixer_fd;
33   char dsp_dev[MAX_CHAR_DEVICE];
34   char mixer_dev[MAX_CHAR_DEVICE];
35   int dsp_cap;
36   int fmt;
37   int channels;
38   int speed;
39   int blksize;
40   int mixer_cap;
41   unsigned char volume;
42   unsigned char *play_data;
43   unsigned char *rec_data;
44 } t_audio;
45
46 /* function prototypes */
47 int audio_init(t_audio *audio);
48 int audio_setup(t_audio *audio);
49 int audio_shutdown(t_audio *audio);
50 int audio_play(t_audio *audio,int len);
51 int audio_record(t_audio *audio,int len);
52
53 #endif