Re: snd_mixer_selem_get_playback_volume return value outside allowed range

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/6/19 Colin Guthrie <gmane@xxxxxxxxxxxxxx>

> 'Twas brillig, and Raymond Yau at 19/06/10 03:39 did gyre and gimble:
> > 2010/6/17 Clemens Ladisch <clemens@xxxxxxxxxx>
> >
> >> Raymond Yau wrote:
> >>> Should snd_mixer_selem_get_playback_volume() perform range check ?
> >>
> >> No, it's the responsibility of the control implementation to return
> >> valid values (and to check that values that are being set are valid).
> >>
> >>
> >> Regards,
> >> Clemens
> >> _
>


It is OK to clamp the volume so that the volume bar would not distort the
layout

but the display percentage under the volume bar is clamp to 100% and this
will mislead the user that alsamixer hangs since pressing up and down arrow
cannot change 100% to 101% or 100% to 90% ( displayed percentage remain at
100% for a very long time)

        value = ((volumes[0] - min) * 100 + (max - min) / 2) / (max - min);
        if (!(control->flags & HAS_VOLUME_1)) {
            sprintf(buf, "%d", value);
            display_string_in_field(values_y, frame_left - 2, buf, 8,
ALIGN_CENTER);
        } else {
            mvwprintw(mixer_widget.window, values_y, frame_left - 2, "%3d",
value);
            if (control->flags & IS_ACTIVE)
                wattrset(mixer_widget.window, attr_ctl_frame);
            waddstr(mixer_widget.window, "<>");
            if (control->flags & IS_ACTIVE)
                wattrset(mixer_widget.window, attr_mixer_active);
            value = ((volumes[1] - min) * 100 + (max - min) / 2) / (max -
min);
            wprintw(mixer_widget.window, "%-3d", value);
        }
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux