Use pa_(c)volume_snprint_verbose() everywhere

All pa_cvolume_snprint(), pa_volume_snprint(),
pa_sw_cvolume_snprint_dB() and pa_sw_volume_snprint_dB() calls have
been replaced with pa_cvolume_snprint_verbose() and
pa_volume_snprint_verbose() calls, making the log output more
informative and the code sometimes simpler.
This commit is contained in:
Tanu Kaskinen 2013-04-03 16:36:43 +03:00
parent 596b2988a5
commit ee5e245afa
11 changed files with 212 additions and 177 deletions

View file

@ -1873,7 +1873,8 @@ static int pa_cli_command_dump_volumes(pa_core *c, pa_tokenizer *t, pa_strbuf *b
pa_sink_input *i;
pa_source_output *o;
uint32_t s_idx, i_idx;
char v_str[PA_CVOLUME_SNPRINT_MAX];
char v_str[PA_CVOLUME_SNPRINT_VERBOSE_MAX];
pa_channel_map *map;
pa_core_assert_ref(c);
pa_assert(t);
@ -1881,41 +1882,105 @@ static int pa_cli_command_dump_volumes(pa_core *c, pa_tokenizer *t, pa_strbuf *b
pa_assert(fail);
PA_IDXSET_FOREACH(s, c->sinks, s_idx) {
map = &s->channel_map;
pa_strbuf_printf(buf, "Sink %d: ", s_idx);
pa_strbuf_printf(buf, "reference = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &s->reference_volume));
pa_strbuf_printf(buf, "real = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &s->real_volume));
pa_strbuf_printf(buf, "soft = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &s->soft_volume));
pa_strbuf_printf(buf, "current_hw = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &s->thread_info.current_hw_volume));
pa_strbuf_printf(buf,
"reference = %s, ",
pa_cvolume_snprint_verbose(v_str,
sizeof(v_str),
&s->reference_volume,
map,
s->flags & PA_SINK_DECIBEL_VOLUME));
pa_strbuf_printf(buf,
"real = %s, ",
pa_cvolume_snprint_verbose(v_str,
sizeof(v_str),
&s->real_volume,
&s->channel_map,
s->flags & PA_SINK_DECIBEL_VOLUME));
pa_strbuf_printf(buf, "soft = %s, ", pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &s->soft_volume, map, true));
pa_strbuf_printf(buf,
"current_hw = %s, ",
pa_cvolume_snprint_verbose(v_str,
sizeof(v_str),
&s->thread_info.current_hw_volume,
map,
s->flags & PA_SINK_DECIBEL_VOLUME));
pa_strbuf_printf(buf, "save = %s\n", pa_yes_no(s->save_volume));
PA_IDXSET_FOREACH(i, s->inputs, i_idx) {
map = &i->channel_map;
pa_strbuf_printf(buf, "\tInput %d: ", i_idx);
pa_strbuf_printf(buf, "volume = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &i->volume));
pa_strbuf_printf(buf, "reference_ratio = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &i->reference_ratio));
pa_strbuf_printf(buf, "real_ratio = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &i->real_ratio));
pa_strbuf_printf(buf, "soft = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &i->soft_volume));
pa_strbuf_printf(buf, "volume_factor = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &i->volume_factor));
pa_strbuf_printf(buf, "volume_factor_sink = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &i->volume_factor_sink));
pa_strbuf_printf(buf, "volume = %s, ", pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &i->volume, map, true));
pa_strbuf_printf(buf,
"reference_ratio = %s, ",
pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &i->reference_ratio, map, true));
pa_strbuf_printf(buf,
"real_ratio = %s, ",
pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &i->real_ratio, map, true));
pa_strbuf_printf(buf, "soft = %s, ", pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &i->soft_volume, map, true));
pa_strbuf_printf(buf,
"volume_factor = %s, ",
pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &i->volume_factor, map, true));
pa_strbuf_printf(buf,
"volume_factor_sink = %s, ",
pa_cvolume_snprint_verbose(v_str,
sizeof(v_str),
&i->volume_factor_sink,
&i->sink->channel_map,
true));
pa_strbuf_printf(buf, "save = %s\n", pa_yes_no(i->save_volume));
}
}
PA_IDXSET_FOREACH(so, c->sources, s_idx) {
map = &so->channel_map;
pa_strbuf_printf(buf, "Source %d: ", s_idx);
pa_strbuf_printf(buf, "reference = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &so->reference_volume));
pa_strbuf_printf(buf, "real = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &so->real_volume));
pa_strbuf_printf(buf, "soft = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &so->soft_volume));
pa_strbuf_printf(buf, "current_hw = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &so->thread_info.current_hw_volume));
pa_strbuf_printf(buf,
"reference = %s, ",
pa_cvolume_snprint_verbose(v_str,
sizeof(v_str),
&so->reference_volume,
map,
so->flags & PA_SOURCE_DECIBEL_VOLUME));
pa_strbuf_printf(buf,
"real = %s, ",
pa_cvolume_snprint_verbose(v_str,
sizeof(v_str),
&so->real_volume,
map,
so->flags & PA_SOURCE_DECIBEL_VOLUME));
pa_strbuf_printf(buf, "soft = %s, ", pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &so->soft_volume, map, true));
pa_strbuf_printf(buf,
"current_hw = %s, ",
pa_cvolume_snprint_verbose(v_str,
sizeof(v_str),
&so->thread_info.current_hw_volume,
map,
so->flags & PA_SOURCE_DECIBEL_VOLUME));
pa_strbuf_printf(buf, "save = %s\n", pa_yes_no(so->save_volume));
PA_IDXSET_FOREACH(o, so->outputs, i_idx) {
map = &o->channel_map;
pa_strbuf_printf(buf, "\tOutput %d: ", i_idx);
pa_strbuf_printf(buf, "volume = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &o->volume));
pa_strbuf_printf(buf, "reference_ratio = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &o->reference_ratio));
pa_strbuf_printf(buf, "real_ratio = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &o->real_ratio));
pa_strbuf_printf(buf, "soft = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &o->soft_volume));
pa_strbuf_printf(buf, "volume_factor = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &o->volume_factor));
pa_strbuf_printf(buf, "volume_factor_source = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &o->volume_factor_source));
pa_strbuf_printf(buf, "volume = %s, ", pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &o->volume, map, true));
pa_strbuf_printf(buf,
"reference_ratio = %s, ",
pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &o->reference_ratio, map, true));
pa_strbuf_printf(buf,
"real_ratio = %s, ",
pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &o->real_ratio, map, true));
pa_strbuf_printf(buf, "soft = %s, ", pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &o->soft_volume, map, true));
pa_strbuf_printf(buf,
"volume_factor = %s, ",
pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &o->volume_factor, map, true));
pa_strbuf_printf(buf,
"volume_factor_source = %s, ",
pa_cvolume_snprint_verbose(v_str,
sizeof(v_str),
&o->volume_factor_source,
&o->source->channel_map,
true));
pa_strbuf_printf(buf, "save = %s\n", pa_yes_no(o->save_volume));
}
}