summaryrefslogtreecommitdiff
path: root/src/lib/emix.h
blob: 6bbcdac594057fd81902e26f005e1e50f1dedeea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef EMIX_H
#define EMIX_H

#include <Eina.h>

EAPI extern int EMIX_DISCONNECTED_EVENT;
EAPI extern int EMIX_SINK_EVENT;
EAPI extern int EMIX_SINK_INPUT_EVENT;
EAPI extern int EMIX_SOURCE_EVENT;

typedef struct _Emix_Volume {
   int channel_count;
   // the index of the field is the id of the channel, the value the volume
   int *volumes;
} Emix_Volume;

typedef struct _Emix_Sink {
   const char *name;
   Emix_Volume *volume;
   Eina_Bool mute;
} Emix_Sink;

typedef struct _Emix_Sink_Input {
   const char *name;
   Emix_Volume *volume;
   Eina_Bool mute;
   Emix_Sink *sink;
} Emix_Sink_Input;

typedef struct _Emix_Source {
   const char *name;
   Emix_Volume *volume;
   Eina_Bool mute;
} Emix_Source;

typedef enum _Emix_Event_Type {
   EMIX_EVENT_ADDED,
   EMIX_EVENT_CHANGED,
   EMIX_EVENT_REMOVED
} Emix_Event_Type;


typedef struct _Emix_Backend {
   void                  (*ebackend_init)(void);
   void                  (*ebackend_shutdown)(void);

   const Eina_List*      (*ebackend_sinks_get)(void);
   Eina_Bool             (*ebackend_sink_default_support)(void);
   const Emix_Sink*      (*ebackend_sink_default_get)(void);
   void                  (*ebackend_sink_default_set)(Emix_Sink *sink);
   void                  (*ebackend_sink_mute_set)(Emix_Sink *sink,
                                                   Eina_Bool mute);
   void                  (*ebackend_sink_volume_set)(Emix_Sink *sink,
                                                     Emix_Volume volume);
   Eina_Bool             (*ebackend_sink_change_support)(void);

   const Eina_List*      (*ebackend_sink_inputs_get)(void);
   void                  (*ebackend_sink_input_mute_set)(
                                        Emix_Sink_Input *input, Eina_Bool mute);
   void                  (*ebackend_sink_input_volume_set)(
                                    Emix_Sink_Input *input, Emix_Volume volume);
   void                  (*ebackend_sink_input_sink_change)(
                                       Emix_Sink_Input *input, Emix_Sink *sink);

   const Eina_List*      (*ebackend_sources_get)(void);
   void                  (*ebackend_source_mute_set)(Emix_Source *source,
                                                     Eina_Bool bool);
   void                  (*ebackend_source_volume_set)(Emix_Source *source,
                                                       Emix_Volume volume);
} Emix_Backend;


EAPI void                emix_init(void);
EAPI void                emix_shutdown(void);
EAPI Eina_List*          emix_backends_available(void);
EAPI void                emix_backend_set(const char *backend);

EAPI const Eina_List*    emix_sinks_get(void);
EAPI Eina_Bool           emix_sink_default_support(void);
EAPI Emix_Sink*          emix_sink_default_get(void);
EAPI void                emix_sink_default_set(Emix_Sink *sink);
EAPI void                emix_sink_mute_set(Emix_Sink *sink, Eina_Bool);
EAPI void                emix_sink_volume_set(Emix_Sink *sink,
                                              Emix_Volume *volume);
EAPI Eina_Bool           emix_sink_change_support(void);

EAPI const Eina_List*    emix_sink_inputs_get(void);
EAPI void                emix_sink_input_mute_set(Emix_Sink_Input *input,
                                                  Eina_Bool mute);
EAPI void                emix_sink_input_volume_set(Emix_Sink_Input *input,
                                                    Emix_Volume *volume);
EAPI void                emix_sink_input_sink_change(Emix_Sink_Input *input,
                                                     Emix_Sink *sink);

EAPI const Eina_List*    emix_source_get(void);
EAPI void                emix_source_mute_set(Emix_Source *source,
                                                  Eina_Bool mute);
EAPI void                emix_source_volume_set(Emix_Source *source,
                                                Emix_Volume *volume);

#endif  /* EMIX_H */