Logo Search packages:      
Sourcecode: pulseaudio version File versions

char* pa_sw_cvolume_snprint_dB ( char *  s,
size_t  l,
const pa_cvolume c 
)

Pretty print a volume structure but show dB values.

Since:
0.9.13

Definition at line 182 of file volume.c.

References pa_cvolume::channels, and pa_cvolume::values.

                                                                       {
    unsigned channel;
    pa_bool_t first = TRUE;
    char *e;

    pa_assert(s);
    pa_assert(l > 0);
    pa_assert(c);

    pa_init_i18n();

    if (!pa_cvolume_valid(c)) {
        pa_snprintf(s, l, _("(invalid)"));
        return s;
    }

    *(e = s) = 0;

    for (channel = 0; channel < c->channels && l > 1; channel++) {
        l -= pa_snprintf(e, l, "%s%u: %0.2f dB",
                      first ? "" : " ",
                      channel,
                      pa_sw_volume_to_dB(c->values[channel]));

        e = strchr(e, 0);
        first = FALSE;
    }

    return s;
}


Generated by  Doxygen 1.6.0   Back to index