1 /* WMix 3.0 -- a mixer using the OSS mixer API.
2 * Copyright (C) 2000, 2001
3 * Daniel Richard G. <skunk@mit.edu>,
4 * timecop <timecop@japan.co.jp>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 /* WMVolume mixer interface
25 * - The volume argument is a floating-point value between 0 (no sound) and
26 * 1 (full sound) inclusively.
28 * - The balance argument is a floating-point value betwen -1 (full left)
29 * and 1 (full right) inclusively. A value of 0 indicates centered sound.
30 * If the device does not natively support a balance parameter, use the
31 * lr_to_vb() and vb_to_lr() functions in misc.c.
33 * - The volume and balance arguments passed to these functions, given that
34 * they are (usually 32-bit) floating-point values, may be capable of
35 * specifying the audio parameters at a finer resolution than the
36 * hardware itself. However, the mixer driver must not quantize the
37 * volume and balance levels returned by the mixer_get_*() routines.
39 * Example: Suppose the mixer device supports specifying the volume as an
40 * integer in the range of 0 to 100. If mixer_set_volume() is called with
41 * an argument of 0.7351, then the device will be set to a volume of 74,
42 * yet subsequent calls to mixer_get_volume() (assuming mixer state has
43 * not changed since) will return 0.7351. Only if the mixer state is
44 * changed by another program (that, say, sets the volume to 51) is the
45 * value returned by this interface quantized (in such a case returning
48 * The reason why this quantization must be avoided whenever possible is
49 * that otherwise, a large number of minuscule increases to the volume
50 * level will have no cumulative effect. Calling mixer_set_volume_rel()
51 * ten thousand times with an argument of 0.0001 should successfully
52 * increase the volume to its maximum, even if the device actually
53 * supports only 64 discrete volume levels.
55 * - Muting must occur independently of the volume level.
58 void (*mixer_init
)(const char *mixer_device
,
60 const char *exclude
[]);
61 bool (*mixer_is_changed
)(void);
62 int (*mixer_get_channel_count
)(void);
63 int (*mixer_get_channel
)(void);
64 const char *(*mixer_get_channel_name
)(void);
65 const char *(*mixer_get_short_name
)(void);
66 void (*mixer_set_channel
)(int channel
);
67 void (*mixer_set_channel_rel
)(int delta_channel
);
68 float (*mixer_get_volume
)(void);
69 void (*mixer_set_volume
)(float volume
);
70 void (*mixer_set_volume_rel
)(float delta_volume
);
71 float (*mixer_get_balance
)(void);
72 void (*mixer_set_balance
)(float balance
);
73 void (*mixer_set_balance_rel
)(float delta_balance
);
74 void (*mixer_toggle_mute
)(void);
75 void (*mixer_toggle_rec
)(void);
76 bool (*mixer_is_muted
)(void);
77 bool (*mixer_is_stereo
)(void);
78 bool (*mixer_is_rec
)(void);
79 bool (*mixer_can_rec
)(void);
80 bool (*is_exclude
)(const char *short_name
,
81 const char *exclude
[]);
82 void (*mixer_tick
)(void);