Merge branch 'maint'
[paraslash.git] / mix.h
1 /*
2 * Copyright (C) 2012 Andre Noll <maan@tuebingen.mpg.de>
3 *
4 * Licensed under the GPL v2. For licencing details see COPYING.
5 */
6
7 /** \file mix.h Mixer API (used by para_fade). */
8
9 /**
10 * Opaque structure which corresponds to an instance of a mixer.
11 *
12 * A pointer to a structure of this type is returned by ->open(). This pointer
13 * must be passed to most other methods of \ref struct mixer.
14 */
15 struct mixer_handle;
16
17 /**
18 * Operations provided by each mixer plugin.
19 */
20 struct mixer {
21 /** Called on startup, must fill in all other members. */
22 void (*init)(struct mixer *self);
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 };