aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-03-23 19:35:47 -0400
committerTakashi Iwai <tiwai@suse.de>2009-03-23 19:35:47 -0400
commitec6659c3898798a9cf3010d6c61a8ea6fa123073 (patch)
treeeb1fb4165fe7b897f14bbe9a56a775063e005b90 /include/sound
parentc944a93df0d566a66409628c4524f4fc4f62eaf5 (diff)
parent79c7cdd5441f5d3900c1632adcc8cd2bee35c8da (diff)
Merge branch 'topic/vmaster-update' into for-linus
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/control.h52
1 files changed, 50 insertions, 2 deletions
diff --git a/include/sound/control.h b/include/sound/control.h
index 4721b4bba053..ef96f07aa03b 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -171,6 +171,54 @@ int snd_ctl_boolean_stereo_info(struct snd_kcontrol *kcontrol,
171 */ 171 */
172struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, 172struct snd_kcontrol *snd_ctl_make_virtual_master(char *name,
173 const unsigned int *tlv); 173 const unsigned int *tlv);
174int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave); 174int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave,
175 175 unsigned int flags);
176/* optional flags for slave */
177#define SND_CTL_SLAVE_NEED_UPDATE (1 << 0)
178
179/**
180 * snd_ctl_add_slave - Add a virtual slave control
181 * @master: vmaster element
182 * @slave: slave element to add
183 *
184 * Add a virtual slave control to the given master element created via
185 * snd_ctl_create_virtual_master() beforehand.
186 * Returns zero if successful or a negative error code.
187 *
188 * All slaves must be the same type (returning the same information
189 * via info callback). The fucntion doesn't check it, so it's your
190 * responsibility.
191 *
192 * Also, some additional limitations:
193 * at most two channels,
194 * logarithmic volume control (dB level) thus no linear volume,
195 * master can only attenuate the volume without gain
196 */
197static inline int
198snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave)
199{
200 return _snd_ctl_add_slave(master, slave, 0);
201}
202
203/**
204 * snd_ctl_add_slave_uncached - Add a virtual slave control
205 * @master: vmaster element
206 * @slave: slave element to add
207 *
208 * Add a virtual slave control to the given master.
209 * Unlike snd_ctl_add_slave(), the element added via this function
210 * is supposed to have volatile values, and get callback is called
211 * at each time quried from the master.
212 *
213 * When the control peeks the hardware values directly and the value
214 * can be changed by other means than the put callback of the element,
215 * this function should be used to keep the value always up-to-date.
216 */
217static inline int
218snd_ctl_add_slave_uncached(struct snd_kcontrol *master,
219 struct snd_kcontrol *slave)
220{
221 return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE);
222}
223
176#endif /* __SOUND_CONTROL_H */ 224#endif /* __SOUND_CONTROL_H */