]>
Commit | Line | Data |
---|---|---|
a2fb5d21 JL |
1 | #ifndef _AUDIO_H |
2 | #define _AUDIO_H | |
3 | ||
9cfc6179 | 4 | #include <libconfig.h> |
064bd293 | 5 | #include <stdint.h> |
459cdd94 | 6 | |
a2790fc1 | 7 | typedef struct { |
a2790fc1 | 8 | double current_volume_dB; |
4c70223f MB |
9 | int32_t minimum_volume_dB; |
10 | int32_t maximum_volume_dB; | |
a2790fc1 MB |
11 | } audio_parameters; |
12 | ||
a2fb5d21 | 13 | typedef struct { |
87a0475c MB |
14 | void (*help)(void); |
15 | char *name; | |
16 | ||
17 | // start of program | |
18 | int (*init)(int argc, char **argv); | |
19 | // at end of program | |
20 | void (*deinit)(void); | |
c8b0be30 | 21 | |
83c0405d | 22 | int (*prepare)(void); // looks and sets stuff in the config data structure |
87a0475c | 23 | |
01e51285 | 24 | void (*start)(int sample_rate, int sample_format); |
87a0475c MB |
25 | |
26 | // block of samples | |
ea20840d | 27 | int (*play)(void *buf, int samples); |
87a0475c | 28 | void (*stop)(void); |
1b18f45f | 29 | |
8cabb16f | 30 | // may be null if no implemented |
1b18f45f MB |
31 | int (*is_running)( |
32 | void); // if implemented, will return 0 if everything is okay, non-zero otherwise | |
87a0475c MB |
33 | |
34 | // may be null if not implemented | |
35 | void (*flush)(void); | |
36 | ||
37 | // returns the delay before the next frame to be sent to the device would actually be audible. | |
38 | // almost certainly wrong if the buffer is empty, so put silent buffers into it to make it busy. | |
39 | // will change dynamically, so keep watching it. Implemented in ALSA only. | |
1e408d1b | 40 | // returns a negative error code if there's a problem |
064bd293 | 41 | int (*delay)(long *the_delay); // snd_pcm_sframes_t is a signed long |
76c5dd92 MB |
42 | int (*rate_info)(uint64_t *elapsed_time, |
43 | uint64_t *frames_played); // use this to get the true rate of the DAC | |
87a0475c MB |
44 | |
45 | // may be NULL, in which case soft volume is applied | |
46 | void (*volume)(double vol); | |
47 | ||
48 | // may be NULL, in which case soft volume parameters are used | |
49 | void (*parameters)(audio_parameters *info); | |
064bd293 | 50 | |
4c70223f | 51 | // may be NULL, in which case software muting is used. |
c5ff0dfe MB |
52 | // also, will return a 1 if it is actually using the mute facility, 0 otherwise |
53 | int (*mute)(int do_mute); | |
064bd293 | 54 | |
9b33878c | 55 | } audio_output; |
a2fb5d21 | 56 | |
9b33878c JL |
57 | audio_output *audio_get_output(char *name); |
58 | void audio_ls_outputs(void); | |
b7864b4e | 59 | void parse_general_audio_options(void); |
a2fb5d21 JL |
60 | |
61 | #endif //_AUDIO_H |