SELEM_INIT(sid, e->alsa_name);
if (!(me = snd_mixer_find_selem(m, sid))) { pa_log_warn("Element %s seems to have disappeared.", e->alsa_name);
return -1;
}
pa_cvolume_mute(&rv, cm->channels);
for (c = 0; c <= SND_MIXER_SCHN_LAST; c++) {
int r;
pa_volume_t f = PA_VOLUME_MUTED;
bool found = false;
for (k = 0; k < cm->channels; k++)
if (e->masks[c][e->n_channels-1] & PA_CHANNEL_POSITION_MASK(cm->map[k])) { found = true;
if (v->values[k] > f) f = v->values[k];
}
if (!found) {
/* Hmm, so this channel does not exist in the volume
* struct, so let's bind it to the overall max of the
* volume. */
f = pa_cvolume_max(v);
}
if (e->has_dB) {
long value = to_alsa_dB(f);
int rounding;
if (e->volume_limit >= 0 && value > (e->max_dB * 100)) value = e->max_dB * 100;
if (e->direction == PA_ALSA_DIRECTION_OUTPUT) {
/* If we call set_playback_volume() without checking first
* if the channel is available, ALSA behaves very
* strangely and doesn't fail the call */
if (snd_mixer_selem_has_playback_channel(me, c)) {
http:// cgit.freedeskto p.org/pulseaudi o/pulseaudio/ tree/src/ modules/ alsa/alsa- mixer.c
seem pulseaudio only control left channel when it only use the virtual master playback volume control
in function element_set_volume, it check the element has left and right channel
static int element_ set_volume( pa_alsa_ element *e, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, bool deferred_volume, bool write_to_hw) {
snd_ mixer_selem_ id_t *sid; mixer_elem_ t *me; mixer_selem_ channel_ id_t c; channel_ position_ mask_t mask = 0;
pa_cvolume rv;
snd_
snd_
pa_
unsigned k;
pa_assert(m); assert( pa_cvolume_ compatible_ with_channel_ map(v, cm));
pa_assert(e);
pa_assert(cm);
pa_assert(v);
pa_
SELEM_INIT(sid, e->alsa_name); find_selem( m, sid))) {
pa_log_ warn("Element %s seems to have disappeared.", e->alsa_name);
if (!(me = snd_mixer_
return -1;
}
pa_ cvolume_ mute(&rv, cm->channels);
for (c = 0; c <= SND_MIXER_ SCHN_LAST; c++) {
int r;
pa_volume_t f = PA_VOLUME_MUTED;
bool found = false;
for (k = 0; k < cm->channels; k++) c][e->n_ channels- 1] & PA_CHANNEL_ POSITION_ MASK(cm- >map[k] )) {
found = true;
f = v->values[k];
if (e->masks[
if (v->values[k] > f)
}
if (!found) {
/* Hmm, so this channel does not exist in the volume
* struct, so let's bind it to the overall max of the
* volume. */
f = pa_cvolume_max(v);
}
if (e->has_dB) {
long value = to_alsa_dB(f);
int rounding;
if (e->volume_limit >= 0 && value > (e->max_dB * 100))
value = e->max_dB * 100;
if (e->direction == PA_ALSA_ DIRECTION_ OUTPUT) { volume( ) without checking first selem_has_ playback_ channel( me, c)) {
/* If we call set_playback_
* if the channel is available, ALSA behaves very
* strangely and doesn't fail the call */
if (snd_mixer_