Merge branch 'refs/heads/t/blob'
[paraslash.git] / mix.h
1 /* Copyright (C) 2012 Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */
2
3 /** \file mix.h Mixer API for para_mixer. */
4
5 /**
6 * Opaque structure which corresponds to an instance of a mixer.
7 *
8 * A pointer to a structure of this type is returned by ->open(). This pointer
9 * must be passed to most other methods of \ref struct mixer.
10 */
11 struct mixer_handle;
12
13 /**
14 * Operations provided by each mixer plugin.
15 *
16 * Each mixer plugin must define a non-static instance of this structure, with
17 * all pointers initialized to non-NULL values. No other symbols need to be
18 * exported.
19 */
20 struct mixer {
21 /** Used to identify the mixer. */
22 const char * const name;
23 /** Return a handle that can be passed to other methods. */
24 int (*open)(const char *dev, struct mixer_handle **handle);
25 /** Returns a string of all valid mixer channels. */
26 char *(*get_channels)(struct mixer_handle *handle);
27 /** Select the channel for subsequent get/set operations. */
28 int (*set_channel)(struct mixer_handle *handle,
29 const char *mixer_channel);
30 /** Return the (normalized) current value of the selected channel. */
31 int (*get)(struct mixer_handle *handle);
32 /** Change the value of the selected channel. */
33 int (*set)(struct mixer_handle *handle, int val);
34 /** Free all resources associated with the given handle. */
35 void (*close)(struct mixer_handle **handle);
36 };
37
38 /** Declared even if unsupported because it does not hurt and avoids ifdefs. */
39 extern const struct mixer alsa_mixer, oss_mixer;