X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=include%2Fsound%2Fcontrol.h;h=112374dc0c5873b550bebc9d1700de189698b455;hb=98ca3964fe8da0d742331af80952443af5cff464;hp=4721b4bba0538360cd808db6c6cc0f13db9a3c7a;hpb=d3bd67cdbb5d12f30dfd1b627fd95bd6dcc7ff1e;p=safe%2Fjmp%2Flinux-2.6 diff --git a/include/sound/control.h b/include/sound/control.h index 4721b4b..112374d 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -56,7 +56,6 @@ struct snd_kcontrol_new { struct snd_kcontrol_volatile { struct snd_ctl_file *owner; /* locked */ - pid_t owner_pid; unsigned int access; /* access rights */ }; @@ -87,10 +86,12 @@ struct snd_kctl_event { #define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list) +struct pid; + struct snd_ctl_file { struct list_head list; /* list of all control files */ struct snd_card *card; - pid_t pid; + struct pid *pid; int prefer_pcm_subdevice; int prefer_rawmidi_subdevice; wait_queue_head_t change_sleep; @@ -171,6 +172,54 @@ int snd_ctl_boolean_stereo_info(struct snd_kcontrol *kcontrol, */ struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, const unsigned int *tlv); -int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave); - +int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave, + unsigned int flags); +/* optional flags for slave */ +#define SND_CTL_SLAVE_NEED_UPDATE (1 << 0) + +/** + * snd_ctl_add_slave - Add a virtual slave control + * @master: vmaster element + * @slave: slave element to add + * + * Add a virtual slave control to the given master element created via + * snd_ctl_create_virtual_master() beforehand. + * Returns zero if successful or a negative error code. + * + * All slaves must be the same type (returning the same information + * via info callback). The fucntion doesn't check it, so it's your + * responsibility. + * + * Also, some additional limitations: + * at most two channels, + * logarithmic volume control (dB level) thus no linear volume, + * master can only attenuate the volume without gain + */ +static inline int +snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave) +{ + return _snd_ctl_add_slave(master, slave, 0); +} + +/** + * snd_ctl_add_slave_uncached - Add a virtual slave control + * @master: vmaster element + * @slave: slave element to add + * + * Add a virtual slave control to the given master. + * Unlike snd_ctl_add_slave(), the element added via this function + * is supposed to have volatile values, and get callback is called + * at each time quried from the master. + * + * When the control peeks the hardware values directly and the value + * can be changed by other means than the put callback of the element, + * this function should be used to keep the value always up-to-date. + */ +static inline int +snd_ctl_add_slave_uncached(struct snd_kcontrol *master, + struct snd_kcontrol *slave) +{ + return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE); +} + #endif /* __SOUND_CONTROL_H */