]> git.ipfire.org Git - thirdparty/shairport-sync.git/blob - audio.h
Pass in libconfig info during init.
[thirdparty/shairport-sync.git] / audio.h
1 #ifndef _AUDIO_H
2 #define _AUDIO_H
3
4 #include <stdint.h>
5 #include <libconfig.h>
6
7 typedef struct {
8 double airplay_volume;
9 double current_volume_dB;
10 int minimum_volume_dB;
11 int maximum_volume_dB;
12 int has_true_mute;
13 int is_muted;
14 int valid;
15 } audio_parameters;
16
17 typedef struct {
18 void (*help)(void);
19 char *name;
20
21 // start of program
22 int (*init)(int argc, char **argv, config_t* cfgp);
23 // at end of program
24 void (*deinit)(void);
25
26 void (*start)(int sample_rate);
27
28 // block of samples
29 void (*play)(short buf[], int samples);
30 void (*stop)(void);
31
32 // may be null if not implemented
33 void (*flush)(void);
34
35 // returns the delay before the next frame to be sent to the device would actually be audible.
36 // almost certainly wrong if the buffer is empty, so put silent buffers into it to make it busy.
37 // will change dynamically, so keep watching it. Implemented in ALSA only.
38 uint32_t (*delay)();
39
40 // may be NULL, in which case soft volume is applied
41 void (*volume)(double vol);
42
43 // may be NULL, in which case soft volume parameters are used
44 void (*parameters)(audio_parameters* info);
45 } audio_output;
46
47 audio_output *audio_get_output(char *name);
48 void audio_ls_outputs(void);
49
50 #endif //_AUDIO_H