summaryrefslogtreecommitdiff
path: root/mix.h
blob: 697fd993ecc4f2c4b95626251655292571c2003a (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
/* SPDX-License-Identifier: GPL-2.0 */

/** \file mix.h Mixer API for para_mixer. */

/**
 * Opaque structure which corresponds to an instance of a mixer.
 *
 * A pointer to a structure of this type is returned by ->open().  This pointer
 * must be passed to most other methods of \ref struct mixer.
 */
struct mixer_handle;

/**
 * Operations provided by each mixer plugin.
 *
 * Each mixer plugin must define a non-static instance of this structure, with
 * all pointers initialized to non-NULL values. No other symbols need to be
 * exported.
 */
struct mixer {
	/** Used to identify the mixer. */
	const char * const name;
	/** Return a handle that can be passed to other methods. */
	int (*open)(const char *dev, struct mixer_handle **handle);
	/** Returns a string of all valid mixer channels. */
	char *(*get_channels)(struct mixer_handle *handle);
	/** Select the channel for subsequent get/set operations. */
	int (*set_channel)(struct mixer_handle *handle,
		const char *mixer_channel);
	/** Return the (normalized) current value of the selected channel. */
	int (*get)(const struct mixer_handle *handle);
	/** Change the value of the selected channel. */
	int (*set)(struct mixer_handle *handle, int val);
	/** Free all resources associated with the given handle. */
	void (*close)(struct mixer_handle *handle);
};

/*
 * The alsa_mixer structure is declared even on *BSD where the alsa API is
 * unsupported. This does not hurt, and it avoids ifdefs.
 */
extern const struct mixer alsa_mixer, oss_mixer;