Merge branch 't/fade_improvements'
[paraslash.git] / mix.h
1 /**
2  * Opaque structure which corresponds to an instance of a mixer.
3  *
4  * A pointer to a structure of this type is returned by ->open().  This pointer
5  * must be passed to most other methods of \ref struct mixer.
6  */
7 struct mixer_handle;
8
9 /**
10  * Operations provided by each mixer plugin.
11  */
12 struct mixer {
13         /** Called on startup, must fill in all other members. */
14         void (*init)(struct mixer *self);
15         /** Return a handle that can be passed to other methods. */
16         int (*open)(const char *dev, struct mixer_handle **handle);
17         /** Returns a string of all valid mixer channels. */
18         char *(*get_channels)(struct mixer_handle *handle);
19         /** Select the channel for subsequent get/set operations. */
20         int (*set_channel)(struct mixer_handle *handle,
21                 const char *mixer_channel);
22         /** Return the (normalized) current value of the selected channel. */
23         int (*get)(struct mixer_handle *handle);
24         /** Change the value of the selected channel. */
25         int (*set)(struct mixer_handle *handle, int val);
26         /** Free all ressources associated with the given handle. */
27         void (*close)(struct mixer_handle **handle);
28 };