annotate src/audacious/volumecontrol.c @ 3756:698e3936f6b4

add missing include.
author William Pitcock <nenolod@atheme.org>
date Sun, 14 Oct 2007 21:07:03 -0500
parents a140fadd741d
children ab4962c133c7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3545
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
1 /*
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
2 * Audacious
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
3 * Copyright (c) 2007 William Pitcock
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
4 *
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
5 * volumecontrol.c: High quality volume PCM padding flow.
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
6 *
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
9 * the Free Software Foundation; under version 3 of the License.
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
10 *
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
14 * GNU General Public License for more details.
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
15 *
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
17 * along with this program. If not, see <http://www.gnu.org/licenses>.
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
18 *
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
19 * The Audacious team does not consider modular code linking to
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
20 * Audacious or using our public API to be a derived work.
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
21 */
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
22
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
23 #include "output.h"
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
24 #include "iir.h"
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
25 #include "main.h"
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
26 #include "input.h"
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
27 #include "playback.h"
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
28
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
29 #include "playlist.h"
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
30 #include "configdb.h"
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
31
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
32 #include "effect.h"
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
33 #include "xconvert.h"
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
34
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
35 #include "volumecontrol.h"
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
36
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
37 #include <math.h>
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
38
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
39 typedef struct {
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
40 gint left;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
41 gint right;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
42 } volumecontrol_req_t;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
43
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
44 static volumecontrol_req_t vc_state_ = { 100, 100 };
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
45
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
46 #define STEREO_ADJUST(type, type2, endian) \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
47 do { \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
48 type *ptr = data; \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
49 for (i = 0; i < length; i += 4) \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
50 { \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
51 *ptr = type2##_TO_##endian(type2##_FROM_## endian(*ptr) * \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
52 lvol / 256); \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
53 ptr++; \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
54 *ptr = type2##_TO_##endian(type2##_FROM_##endian(*ptr) * \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
55 rvol / 256); \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
56 ptr++; \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
57 } \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
58 } while (0)
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
59
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
60 #define MONO_ADJUST(type, type2, endian) \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
61 do { \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
62 type *ptr = data; \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
63 for (i = 0; i < length; i += 2) \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
64 { \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
65 *ptr = type2##_TO_##endian(type2##_FROM_## endian(*ptr) * \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
66 vol / 256); \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
67 ptr++; \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
68 } \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
69 } while (0)
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
70
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
71 #define VOLUME_ADJUST(type, type2, endian) \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
72 do { \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
73 if (channels == 2) \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
74 STEREO_ADJUST(type, type2, endian); \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
75 else \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
76 MONO_ADJUST(type, type2, endian); \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
77 } while (0)
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
78
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
79 #define STEREO_ADJUST8(type) \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
80 do { \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
81 type *ptr = data; \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
82 for (i = 0; i < length; i += 2) \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
83 { \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
84 *ptr = *ptr * lvol / 256; \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
85 ptr++; \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
86 *ptr = *ptr * rvol / 256; \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
87 ptr++; \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
88 } \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
89 } while (0)
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
90
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
91 #define MONO_ADJUST8(type) \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
92 do { \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
93 type *ptr = data; \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
94 for (i = 0; i < length; i++) \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
95 { \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
96 *ptr = *ptr * vol / 256; \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
97 ptr++; \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
98 } \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
99 } while (0)
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
100
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
101 #define VOLUME_ADJUST8(type) \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
102 do { \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
103 if (channels == 2) \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
104 STEREO_ADJUST8(type); \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
105 else \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
106 MONO_ADJUST8(type); \
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
107 } while (0)
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
108
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
109 void volumecontrol_pad_audio(gpointer data, gint length, AFormat fmt,
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
110 gint channels)
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
111 {
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
112 gint i, vol, lvol, rvol;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
113
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
114 if (vc_state_.left == 100 && vc_state_.right == 100)
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
115 return;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
116
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
117 if (channels == 1 && (vc_state_.left == 100 || vc_state_.right == 100))
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
118 return;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
119
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
120 lvol = pow(10, (vc_state_.left - 100) / 40.0) * 256;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
121 rvol = pow(10, (vc_state_.right - 100) / 40.0) * 256;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
122 vol = MAX(lvol, rvol);
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
123
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
124 switch (fmt)
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
125 {
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
126 case FMT_S16_LE:
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
127 VOLUME_ADJUST(gint16, GINT16, LE);
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
128 break;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
129 case FMT_U16_LE:
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
130 VOLUME_ADJUST(guint16, GUINT16, LE);
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
131 break;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
132 case FMT_S16_BE:
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
133 VOLUME_ADJUST(gint16, GINT16, LE);
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
134 break;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
135 case FMT_U16_BE:
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
136 VOLUME_ADJUST(guint16, GUINT16, LE);
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
137 break;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
138 case FMT_S8:
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
139 VOLUME_ADJUST8(gint8);
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
140 break;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
141 case FMT_U8:
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
142 VOLUME_ADJUST8(guint8);
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
143 break;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
144 default:
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
145 g_warning("unhandled format %d.", fmt);
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
146 break;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
147 }
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
148 }
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
149
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
150 void
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
151 volumecontrol_get_volume_state(gint *l, gint *r)
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
152 {
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
153 *l = vc_state_.left;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
154 *r = vc_state_.right;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
155 }
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
156
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
157 void
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
158 volumecontrol_set_volume_state(gint l, gint r)
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
159 {
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
160 vc_state_.left = l;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
161 vc_state_.right = r;
7a2b667bab4b Add volumecontrol flow implementation.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
162 }
3553
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3545
diff changeset
163
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3545
diff changeset
164 void
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3545
diff changeset
165 volumecontrol_flow(FlowContext *context)
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3545
diff changeset
166 {
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3545
diff changeset
167 if (!cfg.software_volume_control)
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3545
diff changeset
168 return;
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3545
diff changeset
169
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3545
diff changeset
170 volumecontrol_pad_audio(context->data, context->len, context->fmt, context->channels);
a140fadd741d software volumecontrol->flow manager API
William Pitcock <nenolod@atheme.org>
parents: 3545
diff changeset
171 }