mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
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:
parent
596b2988a5
commit
ee5e245afa
11 changed files with 212 additions and 177 deletions
|
|
@ -1273,7 +1273,7 @@ static int io_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) {
|
||||||
static void sink_get_volume_cb(pa_sink *s) {
|
static void sink_get_volume_cb(pa_sink *s) {
|
||||||
struct userdata *u = s->userdata;
|
struct userdata *u = s->userdata;
|
||||||
pa_cvolume r;
|
pa_cvolume r;
|
||||||
char vol_str_pcnt[PA_CVOLUME_SNPRINT_MAX];
|
char volume_buf[PA_CVOLUME_SNPRINT_VERBOSE_MAX];
|
||||||
|
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
pa_assert(u->mixer_path);
|
pa_assert(u->mixer_path);
|
||||||
|
|
@ -1285,13 +1285,8 @@ static void sink_get_volume_cb(pa_sink *s) {
|
||||||
/* Shift down by the base volume, so that 0dB becomes maximum volume */
|
/* Shift down by the base volume, so that 0dB becomes maximum volume */
|
||||||
pa_sw_cvolume_multiply_scalar(&r, &r, s->base_volume);
|
pa_sw_cvolume_multiply_scalar(&r, &r, s->base_volume);
|
||||||
|
|
||||||
pa_log_debug("Read hardware volume: %s", pa_cvolume_snprint(vol_str_pcnt, sizeof(vol_str_pcnt), &r));
|
pa_log_debug("Read hardware volume: %s",
|
||||||
|
pa_cvolume_snprint_verbose(volume_buf, sizeof(volume_buf), &r, &s->channel_map, u->mixer_path->has_dB));
|
||||||
if (u->mixer_path->has_dB) {
|
|
||||||
char vol_str_db[PA_SW_CVOLUME_SNPRINT_DB_MAX];
|
|
||||||
|
|
||||||
pa_log_debug(" in dB: %s", pa_sw_cvolume_snprint_dB(vol_str_db, sizeof(vol_str_db), &r));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pa_cvolume_equal(&u->hardware_volume, &r))
|
if (pa_cvolume_equal(&u->hardware_volume, &r))
|
||||||
return;
|
return;
|
||||||
|
|
@ -1306,7 +1301,7 @@ static void sink_get_volume_cb(pa_sink *s) {
|
||||||
static void sink_set_volume_cb(pa_sink *s) {
|
static void sink_set_volume_cb(pa_sink *s) {
|
||||||
struct userdata *u = s->userdata;
|
struct userdata *u = s->userdata;
|
||||||
pa_cvolume r;
|
pa_cvolume r;
|
||||||
char vol_str_pcnt[PA_CVOLUME_SNPRINT_MAX];
|
char volume_buf[PA_CVOLUME_SNPRINT_VERBOSE_MAX];
|
||||||
bool deferred_volume = !!(s->flags & PA_SINK_DEFERRED_VOLUME);
|
bool deferred_volume = !!(s->flags & PA_SINK_DEFERRED_VOLUME);
|
||||||
|
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
|
|
@ -1327,7 +1322,6 @@ static void sink_set_volume_cb(pa_sink *s) {
|
||||||
if (u->mixer_path->has_dB) {
|
if (u->mixer_path->has_dB) {
|
||||||
pa_cvolume new_soft_volume;
|
pa_cvolume new_soft_volume;
|
||||||
bool accurate_enough;
|
bool accurate_enough;
|
||||||
char vol_str_db[PA_SW_CVOLUME_SNPRINT_DB_MAX];
|
|
||||||
|
|
||||||
/* Match exactly what the user requested by software */
|
/* Match exactly what the user requested by software */
|
||||||
pa_sw_cvolume_divide(&new_soft_volume, &s->real_volume, &u->hardware_volume);
|
pa_sw_cvolume_divide(&new_soft_volume, &s->real_volume, &u->hardware_volume);
|
||||||
|
|
@ -1339,20 +1333,20 @@ static void sink_set_volume_cb(pa_sink *s) {
|
||||||
(pa_cvolume_min(&new_soft_volume) >= (PA_VOLUME_NORM - VOLUME_ACCURACY)) &&
|
(pa_cvolume_min(&new_soft_volume) >= (PA_VOLUME_NORM - VOLUME_ACCURACY)) &&
|
||||||
(pa_cvolume_max(&new_soft_volume) <= (PA_VOLUME_NORM + VOLUME_ACCURACY));
|
(pa_cvolume_max(&new_soft_volume) <= (PA_VOLUME_NORM + VOLUME_ACCURACY));
|
||||||
|
|
||||||
pa_log_debug("Requested volume: %s", pa_cvolume_snprint(vol_str_pcnt, sizeof(vol_str_pcnt), &s->real_volume));
|
pa_log_debug("Requested volume: %s",
|
||||||
pa_log_debug(" in dB: %s", pa_sw_cvolume_snprint_dB(vol_str_db, sizeof(vol_str_db), &s->real_volume));
|
pa_cvolume_snprint_verbose(volume_buf, sizeof(volume_buf), &s->real_volume, &s->channel_map, true));
|
||||||
pa_log_debug("Got hardware volume: %s", pa_cvolume_snprint(vol_str_pcnt, sizeof(vol_str_pcnt), &u->hardware_volume));
|
pa_log_debug("Got hardware volume: %s",
|
||||||
pa_log_debug(" in dB: %s", pa_sw_cvolume_snprint_dB(vol_str_db, sizeof(vol_str_db), &u->hardware_volume));
|
pa_cvolume_snprint_verbose(volume_buf, sizeof(volume_buf), &u->hardware_volume, &s->channel_map, true));
|
||||||
pa_log_debug("Calculated software volume: %s (accurate-enough=%s)",
|
pa_log_debug("Calculated software volume: %s (accurate-enough=%s)",
|
||||||
pa_cvolume_snprint(vol_str_pcnt, sizeof(vol_str_pcnt), &new_soft_volume),
|
pa_cvolume_snprint_verbose(volume_buf, sizeof(volume_buf), &new_soft_volume, &s->channel_map, true),
|
||||||
pa_yes_no(accurate_enough));
|
pa_yes_no(accurate_enough));
|
||||||
pa_log_debug(" in dB: %s", pa_sw_cvolume_snprint_dB(vol_str_db, sizeof(vol_str_db), &new_soft_volume));
|
|
||||||
|
|
||||||
if (!accurate_enough)
|
if (!accurate_enough)
|
||||||
s->soft_volume = new_soft_volume;
|
s->soft_volume = new_soft_volume;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
pa_log_debug("Wrote hardware volume: %s", pa_cvolume_snprint(vol_str_pcnt, sizeof(vol_str_pcnt), &r));
|
pa_log_debug("Wrote hardware volume: %s",
|
||||||
|
pa_cvolume_snprint_verbose(volume_buf, sizeof(volume_buf), &r, &s->channel_map, false));
|
||||||
|
|
||||||
/* We can't match exactly what the user requested, hence let's
|
/* We can't match exactly what the user requested, hence let's
|
||||||
* at least tell the user about it */
|
* at least tell the user about it */
|
||||||
|
|
@ -1388,17 +1382,15 @@ static void sink_write_volume_cb(pa_sink *s) {
|
||||||
(pa_cvolume_max(&tmp_vol) <= (PA_VOLUME_NORM + VOLUME_ACCURACY));
|
(pa_cvolume_max(&tmp_vol) <= (PA_VOLUME_NORM + VOLUME_ACCURACY));
|
||||||
|
|
||||||
if (!accurate_enough) {
|
if (!accurate_enough) {
|
||||||
union {
|
char volume_buf[2][PA_CVOLUME_SNPRINT_VERBOSE_MAX];
|
||||||
char db[2][PA_SW_CVOLUME_SNPRINT_DB_MAX];
|
|
||||||
char pcnt[2][PA_CVOLUME_SNPRINT_MAX];
|
|
||||||
} vol;
|
|
||||||
|
|
||||||
pa_log_debug("Written HW volume did not match with the request: %s (request) != %s",
|
pa_log_debug("Written HW volume did not match with the request: %s (request) != %s",
|
||||||
pa_cvolume_snprint(vol.pcnt[0], sizeof(vol.pcnt[0]), &s->thread_info.current_hw_volume),
|
pa_cvolume_snprint_verbose(volume_buf[0],
|
||||||
pa_cvolume_snprint(vol.pcnt[1], sizeof(vol.pcnt[1]), &hw_vol));
|
sizeof(volume_buf[0]),
|
||||||
pa_log_debug(" in dB: %s (request) != %s",
|
&s->thread_info.current_hw_volume,
|
||||||
pa_sw_cvolume_snprint_dB(vol.db[0], sizeof(vol.db[0]), &s->thread_info.current_hw_volume),
|
&s->channel_map,
|
||||||
pa_sw_cvolume_snprint_dB(vol.db[1], sizeof(vol.db[1]), &hw_vol));
|
true),
|
||||||
|
pa_cvolume_snprint_verbose(volume_buf[1], sizeof(volume_buf[1]), &hw_vol, &s->channel_map, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1155,7 +1155,7 @@ static int io_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) {
|
||||||
static void source_get_volume_cb(pa_source *s) {
|
static void source_get_volume_cb(pa_source *s) {
|
||||||
struct userdata *u = s->userdata;
|
struct userdata *u = s->userdata;
|
||||||
pa_cvolume r;
|
pa_cvolume r;
|
||||||
char vol_str_pcnt[PA_CVOLUME_SNPRINT_MAX];
|
char volume_buf[PA_CVOLUME_SNPRINT_VERBOSE_MAX];
|
||||||
|
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
pa_assert(u->mixer_path);
|
pa_assert(u->mixer_path);
|
||||||
|
|
@ -1167,13 +1167,8 @@ static void source_get_volume_cb(pa_source *s) {
|
||||||
/* Shift down by the base volume, so that 0dB becomes maximum volume */
|
/* Shift down by the base volume, so that 0dB becomes maximum volume */
|
||||||
pa_sw_cvolume_multiply_scalar(&r, &r, s->base_volume);
|
pa_sw_cvolume_multiply_scalar(&r, &r, s->base_volume);
|
||||||
|
|
||||||
pa_log_debug("Read hardware volume: %s", pa_cvolume_snprint(vol_str_pcnt, sizeof(vol_str_pcnt), &r));
|
pa_log_debug("Read hardware volume: %s",
|
||||||
|
pa_cvolume_snprint_verbose(volume_buf, sizeof(volume_buf), &r, &s->channel_map, u->mixer_path->has_dB));
|
||||||
if (u->mixer_path->has_dB) {
|
|
||||||
char vol_str_db[PA_SW_CVOLUME_SNPRINT_DB_MAX];
|
|
||||||
|
|
||||||
pa_log_debug(" in dB: %s", pa_sw_cvolume_snprint_dB(vol_str_db, sizeof(vol_str_db), &r));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pa_cvolume_equal(&u->hardware_volume, &r))
|
if (pa_cvolume_equal(&u->hardware_volume, &r))
|
||||||
return;
|
return;
|
||||||
|
|
@ -1188,7 +1183,7 @@ static void source_get_volume_cb(pa_source *s) {
|
||||||
static void source_set_volume_cb(pa_source *s) {
|
static void source_set_volume_cb(pa_source *s) {
|
||||||
struct userdata *u = s->userdata;
|
struct userdata *u = s->userdata;
|
||||||
pa_cvolume r;
|
pa_cvolume r;
|
||||||
char vol_str_pcnt[PA_CVOLUME_SNPRINT_MAX];
|
char volume_buf[PA_CVOLUME_SNPRINT_VERBOSE_MAX];
|
||||||
bool deferred_volume = !!(s->flags & PA_SOURCE_DEFERRED_VOLUME);
|
bool deferred_volume = !!(s->flags & PA_SOURCE_DEFERRED_VOLUME);
|
||||||
|
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
|
|
@ -1209,7 +1204,6 @@ static void source_set_volume_cb(pa_source *s) {
|
||||||
if (u->mixer_path->has_dB) {
|
if (u->mixer_path->has_dB) {
|
||||||
pa_cvolume new_soft_volume;
|
pa_cvolume new_soft_volume;
|
||||||
bool accurate_enough;
|
bool accurate_enough;
|
||||||
char vol_str_db[PA_SW_CVOLUME_SNPRINT_DB_MAX];
|
|
||||||
|
|
||||||
/* Match exactly what the user requested by software */
|
/* Match exactly what the user requested by software */
|
||||||
pa_sw_cvolume_divide(&new_soft_volume, &s->real_volume, &u->hardware_volume);
|
pa_sw_cvolume_divide(&new_soft_volume, &s->real_volume, &u->hardware_volume);
|
||||||
|
|
@ -1221,20 +1215,20 @@ static void source_set_volume_cb(pa_source *s) {
|
||||||
(pa_cvolume_min(&new_soft_volume) >= (PA_VOLUME_NORM - VOLUME_ACCURACY)) &&
|
(pa_cvolume_min(&new_soft_volume) >= (PA_VOLUME_NORM - VOLUME_ACCURACY)) &&
|
||||||
(pa_cvolume_max(&new_soft_volume) <= (PA_VOLUME_NORM + VOLUME_ACCURACY));
|
(pa_cvolume_max(&new_soft_volume) <= (PA_VOLUME_NORM + VOLUME_ACCURACY));
|
||||||
|
|
||||||
pa_log_debug("Requested volume: %s", pa_cvolume_snprint(vol_str_pcnt, sizeof(vol_str_pcnt), &s->real_volume));
|
pa_log_debug("Requested volume: %s",
|
||||||
pa_log_debug(" in dB: %s", pa_sw_cvolume_snprint_dB(vol_str_db, sizeof(vol_str_db), &s->real_volume));
|
pa_cvolume_snprint_verbose(volume_buf, sizeof(volume_buf), &s->real_volume, &s->channel_map, true));
|
||||||
pa_log_debug("Got hardware volume: %s", pa_cvolume_snprint(vol_str_pcnt, sizeof(vol_str_pcnt), &u->hardware_volume));
|
pa_log_debug("Got hardware volume: %s",
|
||||||
pa_log_debug(" in dB: %s", pa_sw_cvolume_snprint_dB(vol_str_db, sizeof(vol_str_db), &u->hardware_volume));
|
pa_cvolume_snprint_verbose(volume_buf, sizeof(volume_buf), &u->hardware_volume, &s->channel_map, true));
|
||||||
pa_log_debug("Calculated software volume: %s (accurate-enough=%s)",
|
pa_log_debug("Calculated software volume: %s (accurate-enough=%s)",
|
||||||
pa_cvolume_snprint(vol_str_pcnt, sizeof(vol_str_pcnt), &new_soft_volume),
|
pa_cvolume_snprint_verbose(volume_buf, sizeof(volume_buf), &new_soft_volume, &s->channel_map, true),
|
||||||
pa_yes_no(accurate_enough));
|
pa_yes_no(accurate_enough));
|
||||||
pa_log_debug(" in dB: %s", pa_sw_cvolume_snprint_dB(vol_str_db, sizeof(vol_str_db), &new_soft_volume));
|
|
||||||
|
|
||||||
if (!accurate_enough)
|
if (!accurate_enough)
|
||||||
s->soft_volume = new_soft_volume;
|
s->soft_volume = new_soft_volume;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
pa_log_debug("Wrote hardware volume: %s", pa_cvolume_snprint(vol_str_pcnt, sizeof(vol_str_pcnt), &r));
|
pa_log_debug("Wrote hardware volume: %s",
|
||||||
|
pa_cvolume_snprint_verbose(volume_buf, sizeof(volume_buf), &r, &s->channel_map, false));
|
||||||
|
|
||||||
/* We can't match exactly what the user requested, hence let's
|
/* We can't match exactly what the user requested, hence let's
|
||||||
* at least tell the user about it */
|
* at least tell the user about it */
|
||||||
|
|
@ -1270,17 +1264,15 @@ static void source_write_volume_cb(pa_source *s) {
|
||||||
(pa_cvolume_max(&tmp_vol) <= (PA_VOLUME_NORM + VOLUME_ACCURACY));
|
(pa_cvolume_max(&tmp_vol) <= (PA_VOLUME_NORM + VOLUME_ACCURACY));
|
||||||
|
|
||||||
if (!accurate_enough) {
|
if (!accurate_enough) {
|
||||||
union {
|
char volume_buf[2][PA_CVOLUME_SNPRINT_VERBOSE_MAX];
|
||||||
char db[2][PA_SW_CVOLUME_SNPRINT_DB_MAX];
|
|
||||||
char pcnt[2][PA_CVOLUME_SNPRINT_MAX];
|
|
||||||
} vol;
|
|
||||||
|
|
||||||
pa_log_debug("Written HW volume did not match with the request: %s (request) != %s",
|
pa_log_debug("Written HW volume did not match with the request: %s (request) != %s",
|
||||||
pa_cvolume_snprint(vol.pcnt[0], sizeof(vol.pcnt[0]), &s->thread_info.current_hw_volume),
|
pa_cvolume_snprint_verbose(volume_buf[0],
|
||||||
pa_cvolume_snprint(vol.pcnt[1], sizeof(vol.pcnt[1]), &hw_vol));
|
sizeof(volume_buf[0]),
|
||||||
pa_log_debug(" in dB: %s (request) != %s",
|
&s->thread_info.current_hw_volume,
|
||||||
pa_sw_cvolume_snprint_dB(vol.db[0], sizeof(vol.db[0]), &s->thread_info.current_hw_volume),
|
&s->channel_map,
|
||||||
pa_sw_cvolume_snprint_dB(vol.db[1], sizeof(vol.db[1]), &hw_vol));
|
true),
|
||||||
|
pa_cvolume_snprint_verbose(volume_buf[1], sizeof(volume_buf[1]), &hw_vol, &s->channel_map, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -775,13 +775,13 @@ static pa_hook_result_t sink_fixate_hook_callback(pa_core *c, pa_sink_new_data *
|
||||||
|
|
||||||
if (!new_data->volume_is_set) {
|
if (!new_data->volume_is_set) {
|
||||||
pa_cvolume v;
|
pa_cvolume v;
|
||||||
char buf[PA_CVOLUME_SNPRINT_MAX];
|
char buf[PA_CVOLUME_SNPRINT_VERBOSE_MAX];
|
||||||
|
|
||||||
pa_log_info("Restoring volume for sink %s.", new_data->name);
|
|
||||||
v = e->volume;
|
v = e->volume;
|
||||||
pa_cvolume_remap(&v, &e->channel_map, &new_data->channel_map);
|
pa_cvolume_remap(&v, &e->channel_map, &new_data->channel_map);
|
||||||
pa_sink_new_data_set_volume(new_data, &v);
|
pa_sink_new_data_set_volume(new_data, &v);
|
||||||
pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &new_data->volume));
|
pa_log_info("Restoring volume for sink %s: %s", new_data->name,
|
||||||
|
pa_cvolume_snprint_verbose(buf, sizeof(buf), &new_data->volume, &new_data->channel_map, false));
|
||||||
|
|
||||||
new_data->save_volume = true;
|
new_data->save_volume = true;
|
||||||
} else
|
} else
|
||||||
|
|
@ -821,13 +821,11 @@ static pa_hook_result_t sink_port_hook_callback(pa_core *c, pa_sink *sink, struc
|
||||||
|
|
||||||
if (u->restore_volume && e->volume_valid) {
|
if (u->restore_volume && e->volume_valid) {
|
||||||
pa_cvolume v;
|
pa_cvolume v;
|
||||||
char buf[PA_CVOLUME_SNPRINT_MAX];
|
|
||||||
|
|
||||||
pa_log_info("Restoring volume for sink %s.", sink->name);
|
pa_log_info("Restoring volume for sink %s.", sink->name);
|
||||||
v = e->volume;
|
v = e->volume;
|
||||||
pa_cvolume_remap(&v, &e->channel_map, &sink->channel_map);
|
pa_cvolume_remap(&v, &e->channel_map, &sink->channel_map);
|
||||||
pa_sink_set_volume(sink, &v, true, false);
|
pa_sink_set_volume(sink, &v, true, false);
|
||||||
pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &sink->reference_volume));
|
|
||||||
|
|
||||||
sink->save_volume = true;
|
sink->save_volume = true;
|
||||||
}
|
}
|
||||||
|
|
@ -918,13 +916,13 @@ static pa_hook_result_t source_fixate_hook_callback(pa_core *c, pa_source_new_da
|
||||||
|
|
||||||
if (!new_data->volume_is_set) {
|
if (!new_data->volume_is_set) {
|
||||||
pa_cvolume v;
|
pa_cvolume v;
|
||||||
char buf[PA_CVOLUME_SNPRINT_MAX];
|
char buf[PA_CVOLUME_SNPRINT_VERBOSE_MAX];
|
||||||
|
|
||||||
pa_log_info("Restoring volume for source %s.", new_data->name);
|
|
||||||
v = e->volume;
|
v = e->volume;
|
||||||
pa_cvolume_remap(&v, &e->channel_map, &new_data->channel_map);
|
pa_cvolume_remap(&v, &e->channel_map, &new_data->channel_map);
|
||||||
pa_source_new_data_set_volume(new_data, &v);
|
pa_source_new_data_set_volume(new_data, &v);
|
||||||
pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &new_data->volume));
|
pa_log_info("Restoring volume for source %s: %s", new_data->name,
|
||||||
|
pa_cvolume_snprint_verbose(buf, sizeof(buf), &new_data->volume, &new_data->channel_map, false));
|
||||||
|
|
||||||
new_data->save_volume = true;
|
new_data->save_volume = true;
|
||||||
} else
|
} else
|
||||||
|
|
@ -964,13 +962,11 @@ static pa_hook_result_t source_port_hook_callback(pa_core *c, pa_source *source,
|
||||||
|
|
||||||
if (u->restore_volume && e->volume_valid) {
|
if (u->restore_volume && e->volume_valid) {
|
||||||
pa_cvolume v;
|
pa_cvolume v;
|
||||||
char buf[PA_CVOLUME_SNPRINT_MAX];
|
|
||||||
|
|
||||||
pa_log_info("Restoring volume for source %s.", source->name);
|
pa_log_info("Restoring volume for source %s.", source->name);
|
||||||
v = e->volume;
|
v = e->volume;
|
||||||
pa_cvolume_remap(&v, &e->channel_map, &source->channel_map);
|
pa_cvolume_remap(&v, &e->channel_map, &source->channel_map);
|
||||||
pa_source_set_volume(source, &v, true, false);
|
pa_source_set_volume(source, &v, true, false);
|
||||||
pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &source->reference_volume));
|
|
||||||
|
|
||||||
source->save_volume = true;
|
source->save_volume = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ static int parse_pos(const char *pos, double *f) {
|
||||||
static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *core, pa_sink_input_new_data *data, struct userdata *u) {
|
static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *core, pa_sink_input_new_data *data, struct userdata *u) {
|
||||||
const char *hpos, *vpos, *role, *id;
|
const char *hpos, *vpos, *role, *id;
|
||||||
double f;
|
double f;
|
||||||
char t[PA_CVOLUME_SNPRINT_MAX];
|
char t[PA_CVOLUME_SNPRINT_VERBOSE_MAX];
|
||||||
pa_cvolume v;
|
pa_cvolume v;
|
||||||
|
|
||||||
pa_assert(data);
|
pa_assert(data);
|
||||||
|
|
@ -132,7 +132,12 @@ static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *core, pa_sink_i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_log_debug("Final volume factor %s.", pa_cvolume_snprint(t, sizeof(t), &v));
|
pa_log_debug("Final volume factor %s.",
|
||||||
|
pa_cvolume_snprint_verbose(t,
|
||||||
|
sizeof(t),
|
||||||
|
&v,
|
||||||
|
&data->sink->channel_map,
|
||||||
|
data->sink->flags & PA_SINK_DECIBEL_VOLUME));
|
||||||
pa_sink_input_new_data_add_volume_factor_sink(data, u->name, &v);
|
pa_sink_input_new_data_add_volume_factor_sink(data, u->name, &v);
|
||||||
|
|
||||||
return PA_HOOK_OK;
|
return PA_HOOK_OK;
|
||||||
|
|
|
||||||
|
|
@ -1995,7 +1995,9 @@ PA_GCC_UNUSED static void stream_restore_dump_database(struct userdata *u) {
|
||||||
pa_log("name=%s", name);
|
pa_log("name=%s", name);
|
||||||
pa_log("device=%s %s", e->device, pa_yes_no(e->device_valid));
|
pa_log("device=%s %s", e->device, pa_yes_no(e->device_valid));
|
||||||
pa_log("channel_map=%s", pa_channel_map_snprint(t, sizeof(t), &e->channel_map));
|
pa_log("channel_map=%s", pa_channel_map_snprint(t, sizeof(t), &e->channel_map));
|
||||||
pa_log("volume=%s %s", pa_cvolume_snprint(t, sizeof(t), &e->volume), pa_yes_no(e->volume_valid));
|
pa_log("volume=%s %s",
|
||||||
|
pa_cvolume_snprint_verbose(t, sizeof(t), &e->volume, &e->channel_map, true),
|
||||||
|
pa_yes_no(e->volume_valid));
|
||||||
pa_log("mute=%s %s", pa_yes_no(e->muted), pa_yes_no(e->volume_valid));
|
pa_log("mute=%s %s", pa_yes_no(e->muted), pa_yes_no(e->volume_valid));
|
||||||
entry_free(e);
|
entry_free(e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ int pa_oss_set_fragments(int fd, int nfrags, int frag_size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int pa_oss_get_volume(int fd, unsigned long mixer, const pa_sample_spec *ss, pa_cvolume *volume) {
|
int pa_oss_get_volume(int fd, unsigned long mixer, const pa_sample_spec *ss, pa_cvolume *volume) {
|
||||||
char cv[PA_CVOLUME_SNPRINT_MAX];
|
char cv[PA_CVOLUME_SNPRINT_VERBOSE_MAX];
|
||||||
unsigned vol;
|
unsigned vol;
|
||||||
|
|
||||||
pa_assert(fd >= 0);
|
pa_assert(fd >= 0);
|
||||||
|
|
@ -266,7 +266,7 @@ int pa_oss_get_volume(int fd, unsigned long mixer, const pa_sample_spec *ss, pa_
|
||||||
if (volume->channels >= 2)
|
if (volume->channels >= 2)
|
||||||
volume->values[1] = PA_CLAMP_VOLUME((((vol >> 8) & 0xFF) * PA_VOLUME_NORM) / 100);
|
volume->values[1] = PA_CLAMP_VOLUME((((vol >> 8) & 0xFF) * PA_VOLUME_NORM) / 100);
|
||||||
|
|
||||||
pa_log_debug("Read mixer settings: %s", pa_cvolume_snprint(cv, sizeof(cv), volume));
|
pa_log_debug("Read mixer settings: %s", pa_cvolume_snprint_verbose(cv, sizeof(cv), volume, NULL, false));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,7 @@ static void sink_set_volume_cb(pa_sink *s) {
|
||||||
struct userdata *u = s->userdata;
|
struct userdata *u = s->userdata;
|
||||||
pa_cvolume hw;
|
pa_cvolume hw;
|
||||||
pa_volume_t v;
|
pa_volume_t v;
|
||||||
char t[PA_CVOLUME_SNPRINT_MAX];
|
char t[PA_CVOLUME_SNPRINT_VERBOSE_MAX];
|
||||||
|
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
|
|
||||||
|
|
@ -285,9 +285,10 @@ static void sink_set_volume_cb(pa_sink *s) {
|
||||||
/* Perform any software manipulation of the volume needed */
|
/* Perform any software manipulation of the volume needed */
|
||||||
pa_sw_cvolume_divide(&s->soft_volume, &s->real_volume, &hw);
|
pa_sw_cvolume_divide(&s->soft_volume, &s->real_volume, &hw);
|
||||||
|
|
||||||
pa_log_debug("Requested volume: %s", pa_cvolume_snprint(t, sizeof(t), &s->real_volume));
|
pa_log_debug("Requested volume: %s", pa_cvolume_snprint_verbose(t, sizeof(t), &s->real_volume, &s->channel_map, false));
|
||||||
pa_log_debug("Got hardware volume: %s", pa_cvolume_snprint(t, sizeof(t), &hw));
|
pa_log_debug("Got hardware volume: %s", pa_cvolume_snprint_verbose(t, sizeof(t), &hw, &s->channel_map, false));
|
||||||
pa_log_debug("Calculated software volume: %s", pa_cvolume_snprint(t, sizeof(t), &s->soft_volume));
|
pa_log_debug("Calculated software volume: %s",
|
||||||
|
pa_cvolume_snprint_verbose(t, sizeof(t), &s->soft_volume, &s->channel_map, true));
|
||||||
|
|
||||||
/* Any necessary software volume manipulation is done so set
|
/* Any necessary software volume manipulation is done so set
|
||||||
our hw volume (or v as a single value) on the device */
|
our hw volume (or v as a single value) on the device */
|
||||||
|
|
|
||||||
|
|
@ -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_sink_input *i;
|
||||||
pa_source_output *o;
|
pa_source_output *o;
|
||||||
uint32_t s_idx, i_idx;
|
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_core_assert_ref(c);
|
||||||
pa_assert(t);
|
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_assert(fail);
|
||||||
|
|
||||||
PA_IDXSET_FOREACH(s, c->sinks, s_idx) {
|
PA_IDXSET_FOREACH(s, c->sinks, s_idx) {
|
||||||
|
map = &s->channel_map;
|
||||||
pa_strbuf_printf(buf, "Sink %d: ", s_idx);
|
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,
|
||||||
pa_strbuf_printf(buf, "real = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &s->real_volume));
|
"reference = %s, ",
|
||||||
pa_strbuf_printf(buf, "soft = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &s->soft_volume));
|
pa_cvolume_snprint_verbose(v_str,
|
||||||
pa_strbuf_printf(buf, "current_hw = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &s->thread_info.current_hw_volume));
|
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_strbuf_printf(buf, "save = %s\n", pa_yes_no(s->save_volume));
|
||||||
|
|
||||||
PA_IDXSET_FOREACH(i, s->inputs, i_idx) {
|
PA_IDXSET_FOREACH(i, s->inputs, i_idx) {
|
||||||
|
map = &i->channel_map;
|
||||||
pa_strbuf_printf(buf, "\tInput %d: ", i_idx);
|
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, "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(v_str, sizeof(v_str), &i->reference_ratio));
|
pa_strbuf_printf(buf,
|
||||||
pa_strbuf_printf(buf, "real_ratio = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &i->real_ratio));
|
"reference_ratio = %s, ",
|
||||||
pa_strbuf_printf(buf, "soft = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &i->soft_volume));
|
pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &i->reference_ratio, map, true));
|
||||||
pa_strbuf_printf(buf, "volume_factor = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &i->volume_factor));
|
pa_strbuf_printf(buf,
|
||||||
pa_strbuf_printf(buf, "volume_factor_sink = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &i->volume_factor_sink));
|
"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_strbuf_printf(buf, "save = %s\n", pa_yes_no(i->save_volume));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PA_IDXSET_FOREACH(so, c->sources, s_idx) {
|
PA_IDXSET_FOREACH(so, c->sources, s_idx) {
|
||||||
|
map = &so->channel_map;
|
||||||
pa_strbuf_printf(buf, "Source %d: ", s_idx);
|
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,
|
||||||
pa_strbuf_printf(buf, "real = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &so->real_volume));
|
"reference = %s, ",
|
||||||
pa_strbuf_printf(buf, "soft = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &so->soft_volume));
|
pa_cvolume_snprint_verbose(v_str,
|
||||||
pa_strbuf_printf(buf, "current_hw = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &so->thread_info.current_hw_volume));
|
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_strbuf_printf(buf, "save = %s\n", pa_yes_no(so->save_volume));
|
||||||
|
|
||||||
PA_IDXSET_FOREACH(o, so->outputs, i_idx) {
|
PA_IDXSET_FOREACH(o, so->outputs, i_idx) {
|
||||||
|
map = &o->channel_map;
|
||||||
pa_strbuf_printf(buf, "\tOutput %d: ", i_idx);
|
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, "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(v_str, sizeof(v_str), &o->reference_ratio));
|
pa_strbuf_printf(buf,
|
||||||
pa_strbuf_printf(buf, "real_ratio = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &o->real_ratio));
|
"reference_ratio = %s, ",
|
||||||
pa_strbuf_printf(buf, "soft = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &o->soft_volume));
|
pa_cvolume_snprint_verbose(v_str, sizeof(v_str), &o->reference_ratio, map, true));
|
||||||
pa_strbuf_printf(buf, "volume_factor = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &o->volume_factor));
|
pa_strbuf_printf(buf,
|
||||||
pa_strbuf_printf(buf, "volume_factor_source = %s, ", pa_cvolume_snprint(v_str, sizeof(v_str), &o->volume_factor_source));
|
"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));
|
pa_strbuf_printf(buf, "save = %s\n", pa_yes_no(o->save_volume));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -246,10 +246,8 @@ char *pa_sink_list_to_string(pa_core *c) {
|
||||||
|
|
||||||
PA_IDXSET_FOREACH(sink, c->sinks, idx) {
|
PA_IDXSET_FOREACH(sink, c->sinks, idx) {
|
||||||
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX],
|
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX],
|
||||||
cv[PA_CVOLUME_SNPRINT_MAX],
|
cv[PA_CVOLUME_SNPRINT_VERBOSE_MAX],
|
||||||
cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX],
|
v[PA_VOLUME_SNPRINT_VERBOSE_MAX],
|
||||||
v[PA_VOLUME_SNPRINT_MAX],
|
|
||||||
vdb[PA_SW_VOLUME_SNPRINT_DB_MAX],
|
|
||||||
cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t;
|
cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t;
|
||||||
const char *cmn;
|
const char *cmn;
|
||||||
|
|
||||||
|
|
@ -264,9 +262,9 @@ char *pa_sink_list_to_string(pa_core *c) {
|
||||||
"\tstate: %s\n"
|
"\tstate: %s\n"
|
||||||
"\tsuspend cause: %s%s%s%s\n"
|
"\tsuspend cause: %s%s%s%s\n"
|
||||||
"\tpriority: %u\n"
|
"\tpriority: %u\n"
|
||||||
"\tvolume: %s%s%s\n"
|
"\tvolume: %s\n"
|
||||||
"\t balance %0.2f\n"
|
"\t balance %0.2f\n"
|
||||||
"\tbase volume: %s%s%s\n"
|
"\tbase volume: %s\n"
|
||||||
"\tvolume steps: %u\n"
|
"\tvolume steps: %u\n"
|
||||||
"\tmuted: %s\n"
|
"\tmuted: %s\n"
|
||||||
"\tcurrent latency: %0.2f ms\n"
|
"\tcurrent latency: %0.2f ms\n"
|
||||||
|
|
@ -295,13 +293,13 @@ char *pa_sink_list_to_string(pa_core *c) {
|
||||||
sink->suspend_cause & PA_SUSPEND_IDLE ? "IDLE " : "",
|
sink->suspend_cause & PA_SUSPEND_IDLE ? "IDLE " : "",
|
||||||
sink->suspend_cause & PA_SUSPEND_SESSION ? "SESSION" : "",
|
sink->suspend_cause & PA_SUSPEND_SESSION ? "SESSION" : "",
|
||||||
sink->priority,
|
sink->priority,
|
||||||
pa_cvolume_snprint(cv, sizeof(cv), pa_sink_get_volume(sink, false)),
|
pa_cvolume_snprint_verbose(cv,
|
||||||
sink->flags & PA_SINK_DECIBEL_VOLUME ? "\n\t " : "",
|
sizeof(cv),
|
||||||
sink->flags & PA_SINK_DECIBEL_VOLUME ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), pa_sink_get_volume(sink, false)) : "",
|
pa_sink_get_volume(sink, false),
|
||||||
|
&sink->channel_map,
|
||||||
|
sink->flags & PA_SINK_DECIBEL_VOLUME),
|
||||||
pa_cvolume_get_balance(pa_sink_get_volume(sink, false), &sink->channel_map),
|
pa_cvolume_get_balance(pa_sink_get_volume(sink, false), &sink->channel_map),
|
||||||
pa_volume_snprint(v, sizeof(v), sink->base_volume),
|
pa_volume_snprint_verbose(v, sizeof(v), sink->base_volume, sink->flags & PA_SINK_DECIBEL_VOLUME),
|
||||||
sink->flags & PA_SINK_DECIBEL_VOLUME ? "\n\t " : "",
|
|
||||||
sink->flags & PA_SINK_DECIBEL_VOLUME ? pa_sw_volume_snprint_dB(vdb, sizeof(vdb), sink->base_volume) : "",
|
|
||||||
sink->n_volume_steps,
|
sink->n_volume_steps,
|
||||||
pa_yes_no(pa_sink_get_mute(sink, false)),
|
pa_yes_no(pa_sink_get_mute(sink, false)),
|
||||||
(double) pa_sink_get_latency(sink) / (double) PA_USEC_PER_MSEC,
|
(double) pa_sink_get_latency(sink) / (double) PA_USEC_PER_MSEC,
|
||||||
|
|
@ -366,10 +364,8 @@ char *pa_source_list_to_string(pa_core *c) {
|
||||||
|
|
||||||
PA_IDXSET_FOREACH(source, c->sources, idx) {
|
PA_IDXSET_FOREACH(source, c->sources, idx) {
|
||||||
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX],
|
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX],
|
||||||
cv[PA_CVOLUME_SNPRINT_MAX],
|
cv[PA_CVOLUME_SNPRINT_VERBOSE_MAX],
|
||||||
cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX],
|
v[PA_VOLUME_SNPRINT_VERBOSE_MAX],
|
||||||
v[PA_VOLUME_SNPRINT_MAX],
|
|
||||||
vdb[PA_SW_VOLUME_SNPRINT_DB_MAX],
|
|
||||||
cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t;
|
cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t;
|
||||||
const char *cmn;
|
const char *cmn;
|
||||||
|
|
||||||
|
|
@ -384,9 +380,9 @@ char *pa_source_list_to_string(pa_core *c) {
|
||||||
"\tstate: %s\n"
|
"\tstate: %s\n"
|
||||||
"\tsuspend cause: %s%s%s%s\n"
|
"\tsuspend cause: %s%s%s%s\n"
|
||||||
"\tpriority: %u\n"
|
"\tpriority: %u\n"
|
||||||
"\tvolume: %s%s%s\n"
|
"\tvolume: %s\n"
|
||||||
"\t balance %0.2f\n"
|
"\t balance %0.2f\n"
|
||||||
"\tbase volume: %s%s%s\n"
|
"\tbase volume: %s\n"
|
||||||
"\tvolume steps: %u\n"
|
"\tvolume steps: %u\n"
|
||||||
"\tmuted: %s\n"
|
"\tmuted: %s\n"
|
||||||
"\tcurrent latency: %0.2f ms\n"
|
"\tcurrent latency: %0.2f ms\n"
|
||||||
|
|
@ -412,13 +408,13 @@ char *pa_source_list_to_string(pa_core *c) {
|
||||||
source->suspend_cause & PA_SUSPEND_IDLE ? "IDLE " : "",
|
source->suspend_cause & PA_SUSPEND_IDLE ? "IDLE " : "",
|
||||||
source->suspend_cause & PA_SUSPEND_SESSION ? "SESSION" : "",
|
source->suspend_cause & PA_SUSPEND_SESSION ? "SESSION" : "",
|
||||||
source->priority,
|
source->priority,
|
||||||
pa_cvolume_snprint(cv, sizeof(cv), pa_source_get_volume(source, false)),
|
pa_cvolume_snprint_verbose(cv,
|
||||||
source->flags & PA_SOURCE_DECIBEL_VOLUME ? "\n\t " : "",
|
sizeof(cv),
|
||||||
source->flags & PA_SOURCE_DECIBEL_VOLUME ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), pa_source_get_volume(source, false)) : "",
|
pa_source_get_volume(source, false),
|
||||||
|
&source->channel_map,
|
||||||
|
source->flags & PA_SOURCE_DECIBEL_VOLUME),
|
||||||
pa_cvolume_get_balance(pa_source_get_volume(source, false), &source->channel_map),
|
pa_cvolume_get_balance(pa_source_get_volume(source, false), &source->channel_map),
|
||||||
pa_volume_snprint(v, sizeof(v), source->base_volume),
|
pa_volume_snprint_verbose(v, sizeof(v), source->base_volume, source->flags & PA_SOURCE_DECIBEL_VOLUME),
|
||||||
source->flags & PA_SOURCE_DECIBEL_VOLUME ? "\n\t " : "",
|
|
||||||
source->flags & PA_SOURCE_DECIBEL_VOLUME ? pa_sw_volume_snprint_dB(vdb, sizeof(vdb), source->base_volume) : "",
|
|
||||||
source->n_volume_steps,
|
source->n_volume_steps,
|
||||||
pa_yes_no(pa_source_get_mute(source, false)),
|
pa_yes_no(pa_source_get_mute(source, false)),
|
||||||
(double) pa_source_get_latency(source) / PA_USEC_PER_MSEC,
|
(double) pa_source_get_latency(source) / PA_USEC_PER_MSEC,
|
||||||
|
|
@ -486,7 +482,7 @@ char *pa_source_output_list_to_string(pa_core *c) {
|
||||||
pa_strbuf_printf(s, "%u source output(s) available.\n", pa_idxset_size(c->source_outputs));
|
pa_strbuf_printf(s, "%u source output(s) available.\n", pa_idxset_size(c->source_outputs));
|
||||||
|
|
||||||
PA_IDXSET_FOREACH(o, c->source_outputs, idx) {
|
PA_IDXSET_FOREACH(o, c->source_outputs, idx) {
|
||||||
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t, clt[28];
|
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_VERBOSE_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t, clt[28];
|
||||||
pa_usec_t cl;
|
pa_usec_t cl;
|
||||||
const char *cmn;
|
const char *cmn;
|
||||||
pa_cvolume v;
|
pa_cvolume v;
|
||||||
|
|
@ -503,9 +499,8 @@ char *pa_source_output_list_to_string(pa_core *c) {
|
||||||
|
|
||||||
if (pa_source_output_is_volume_readable(o)) {
|
if (pa_source_output_is_volume_readable(o)) {
|
||||||
pa_source_output_get_volume(o, &v, true);
|
pa_source_output_get_volume(o, &v, true);
|
||||||
volume_str = pa_sprintf_malloc("%s\n\t %s\n\t balance %0.2f",
|
volume_str = pa_sprintf_malloc("%s\n\t balance %0.2f",
|
||||||
pa_cvolume_snprint(cv, sizeof(cv), &v),
|
pa_cvolume_snprint_verbose(cv, sizeof(cv), &v, &o->channel_map, true),
|
||||||
pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &v),
|
|
||||||
pa_cvolume_get_balance(&v, &o->channel_map));
|
pa_cvolume_get_balance(&v, &o->channel_map));
|
||||||
} else
|
} else
|
||||||
volume_str = pa_xstrdup("n/a");
|
volume_str = pa_xstrdup("n/a");
|
||||||
|
|
@ -585,7 +580,7 @@ char *pa_sink_input_list_to_string(pa_core *c) {
|
||||||
pa_strbuf_printf(s, "%u sink input(s) available.\n", pa_idxset_size(c->sink_inputs));
|
pa_strbuf_printf(s, "%u sink input(s) available.\n", pa_idxset_size(c->sink_inputs));
|
||||||
|
|
||||||
PA_IDXSET_FOREACH(i, c->sink_inputs, idx) {
|
PA_IDXSET_FOREACH(i, c->sink_inputs, idx) {
|
||||||
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t, clt[28];
|
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t, clt[28];
|
||||||
pa_usec_t cl;
|
pa_usec_t cl;
|
||||||
const char *cmn;
|
const char *cmn;
|
||||||
pa_cvolume v;
|
pa_cvolume v;
|
||||||
|
|
@ -602,9 +597,8 @@ char *pa_sink_input_list_to_string(pa_core *c) {
|
||||||
|
|
||||||
if (pa_sink_input_is_volume_readable(i)) {
|
if (pa_sink_input_is_volume_readable(i)) {
|
||||||
pa_sink_input_get_volume(i, &v, true);
|
pa_sink_input_get_volume(i, &v, true);
|
||||||
volume_str = pa_sprintf_malloc("%s\n\t %s\n\t balance %0.2f",
|
volume_str = pa_sprintf_malloc("%s\n\t balance %0.2f",
|
||||||
pa_cvolume_snprint(cv, sizeof(cv), &v),
|
pa_cvolume_snprint_verbose(cv, sizeof(cv), &v, &i->channel_map, true),
|
||||||
pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &v),
|
|
||||||
pa_cvolume_get_balance(&v, &i->channel_map));
|
pa_cvolume_get_balance(&v, &i->channel_map));
|
||||||
} else
|
} else
|
||||||
volume_str = pa_xstrdup("n/a");
|
volume_str = pa_xstrdup("n/a");
|
||||||
|
|
@ -678,7 +672,7 @@ char *pa_scache_list_to_string(pa_core *c) {
|
||||||
|
|
||||||
PA_IDXSET_FOREACH(e, c->scache, idx) {
|
PA_IDXSET_FOREACH(e, c->scache, idx) {
|
||||||
double l = 0;
|
double l = 0;
|
||||||
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX] = "n/a", cv[PA_CVOLUME_SNPRINT_MAX], cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX] = "n/a", *t;
|
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX] = "n/a", cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX] = "n/a", *t;
|
||||||
const char *cmn;
|
const char *cmn;
|
||||||
|
|
||||||
cmn = pa_channel_map_to_pretty_name(&e->channel_map);
|
cmn = pa_channel_map_to_pretty_name(&e->channel_map);
|
||||||
|
|
@ -698,7 +692,6 @@ char *pa_scache_list_to_string(pa_core *c) {
|
||||||
"\tlength: %lu\n"
|
"\tlength: %lu\n"
|
||||||
"\tduration: %0.1f s\n"
|
"\tduration: %0.1f s\n"
|
||||||
"\tvolume: %s\n"
|
"\tvolume: %s\n"
|
||||||
"\t %s\n"
|
|
||||||
"\t balance %0.2f\n"
|
"\t balance %0.2f\n"
|
||||||
"\tlazy: %s\n"
|
"\tlazy: %s\n"
|
||||||
"\tfilename: <%s>\n",
|
"\tfilename: <%s>\n",
|
||||||
|
|
@ -710,8 +703,7 @@ char *pa_scache_list_to_string(pa_core *c) {
|
||||||
cmn ? cmn : "",
|
cmn ? cmn : "",
|
||||||
(long unsigned)(e->memchunk.memblock ? e->memchunk.length : 0),
|
(long unsigned)(e->memchunk.memblock ? e->memchunk.length : 0),
|
||||||
l,
|
l,
|
||||||
e->volume_is_set ? pa_cvolume_snprint(cv, sizeof(cv), &e->volume) : "n/a",
|
e->volume_is_set ? pa_cvolume_snprint_verbose(cv, sizeof(cv), &e->volume, &e->channel_map, true) : "n/a",
|
||||||
e->volume_is_set ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &e->volume) : "n/a",
|
|
||||||
(e->memchunk.memblock && e->volume_is_set) ? pa_cvolume_get_balance(&e->volume, &e->channel_map) : 0.0f,
|
(e->memchunk.memblock && e->volume_is_set) ? pa_cvolume_get_balance(&e->volume, &e->channel_map) : 0.0f,
|
||||||
pa_yes_no(e->lazy),
|
pa_yes_no(e->lazy),
|
||||||
e->filename ? e->filename : "n/a");
|
e->filename ? e->filename : "n/a");
|
||||||
|
|
|
||||||
|
|
@ -54,39 +54,47 @@ START_TEST (volume_test) {
|
||||||
v, (v*100)/PA_VOLUME_NORM, dB, f, pa_sw_volume_from_dB(dB), pa_sw_volume_from_linear(f));
|
v, (v*100)/PA_VOLUME_NORM, dB, f, pa_sw_volume_from_dB(dB), pa_sw_volume_from_linear(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (v = PA_VOLUME_MUTED; v <= PA_VOLUME_NORM*2; v += 256) {
|
|
||||||
char s[PA_CVOLUME_SNPRINT_MAX], t[PA_SW_CVOLUME_SNPRINT_DB_MAX];
|
|
||||||
|
|
||||||
pa_cvolume_set(&cv, 2, v);
|
|
||||||
|
|
||||||
pa_log_debug("Volume: %3i [%s] [%s]", v, pa_cvolume_snprint(s, sizeof(s), &cv), pa_sw_cvolume_snprint_dB(t, sizeof(t), &cv));
|
|
||||||
}
|
|
||||||
|
|
||||||
map.channels = cv.channels = 2;
|
map.channels = cv.channels = 2;
|
||||||
map.map[0] = PA_CHANNEL_POSITION_LEFT;
|
map.map[0] = PA_CHANNEL_POSITION_LEFT;
|
||||||
map.map[1] = PA_CHANNEL_POSITION_RIGHT;
|
map.map[1] = PA_CHANNEL_POSITION_RIGHT;
|
||||||
|
|
||||||
|
for (v = PA_VOLUME_MUTED; v <= PA_VOLUME_NORM*2; v += 256) {
|
||||||
|
char s[PA_CVOLUME_SNPRINT_VERBOSE_MAX];
|
||||||
|
|
||||||
|
pa_cvolume_set(&cv, 2, v);
|
||||||
|
|
||||||
|
pa_log_debug("Volume: %3i [%s]", v, pa_cvolume_snprint_verbose(s, sizeof(s), &cv, &map, true));
|
||||||
|
}
|
||||||
|
|
||||||
for (cv.values[0] = PA_VOLUME_MUTED; cv.values[0] <= PA_VOLUME_NORM*2; cv.values[0] += 4096)
|
for (cv.values[0] = PA_VOLUME_MUTED; cv.values[0] <= PA_VOLUME_NORM*2; cv.values[0] += 4096)
|
||||||
for (cv.values[1] = PA_VOLUME_MUTED; cv.values[1] <= PA_VOLUME_NORM*2; cv.values[1] += 4096) {
|
for (cv.values[1] = PA_VOLUME_MUTED; cv.values[1] <= PA_VOLUME_NORM*2; cv.values[1] += 4096) {
|
||||||
char s[PA_CVOLUME_SNPRINT_MAX];
|
char s[PA_CVOLUME_SNPRINT_VERBOSE_MAX];
|
||||||
|
|
||||||
pa_log_debug("Volume: [%s]; balance: %2.1f", pa_cvolume_snprint(s, sizeof(s), &cv), pa_cvolume_get_balance(&cv, &map));
|
pa_log_debug("Volume: [%s]; balance: %2.1f",
|
||||||
|
pa_cvolume_snprint_verbose(s, sizeof(s), &cv, &map, true),
|
||||||
|
pa_cvolume_get_balance(&cv, &map));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cv.values[0] = PA_VOLUME_MUTED+4096; cv.values[0] <= PA_VOLUME_NORM*2; cv.values[0] += 4096)
|
for (cv.values[0] = PA_VOLUME_MUTED+4096; cv.values[0] <= PA_VOLUME_NORM*2; cv.values[0] += 4096)
|
||||||
for (cv.values[1] = PA_VOLUME_MUTED; cv.values[1] <= PA_VOLUME_NORM*2; cv.values[1] += 4096)
|
for (cv.values[1] = PA_VOLUME_MUTED; cv.values[1] <= PA_VOLUME_NORM*2; cv.values[1] += 4096)
|
||||||
for (b = -1.0f; b <= 1.0f; b += 0.2f) {
|
for (b = -1.0f; b <= 1.0f; b += 0.2f) {
|
||||||
char s[PA_CVOLUME_SNPRINT_MAX];
|
char s[PA_CVOLUME_SNPRINT_VERBOSE_MAX];
|
||||||
pa_cvolume r;
|
pa_cvolume r;
|
||||||
float k;
|
float k;
|
||||||
|
|
||||||
pa_log_debug("Before: volume: [%s]; balance: %2.1f", pa_cvolume_snprint(s, sizeof(s), &cv), pa_cvolume_get_balance(&cv, &map));
|
pa_log_debug("Before: volume: [%s]; balance: %2.1f",
|
||||||
|
pa_cvolume_snprint_verbose(s, sizeof(s), &cv, &map, true),
|
||||||
|
pa_cvolume_get_balance(&cv, &map));
|
||||||
|
|
||||||
r = cv;
|
r = cv;
|
||||||
pa_cvolume_set_balance(&r, &map,b);
|
pa_cvolume_set_balance(&r, &map,b);
|
||||||
|
|
||||||
k = pa_cvolume_get_balance(&r, &map);
|
k = pa_cvolume_get_balance(&r, &map);
|
||||||
pa_log_debug("After: volume: [%s]; balance: %2.1f (intended: %2.1f) %s", pa_cvolume_snprint(s, sizeof(s), &r), k, b, k < b-.05 || k > b+.5 ? "MISMATCH" : "");
|
pa_log_debug("After: volume: [%s]; balance: %2.1f (intended: %2.1f) %s",
|
||||||
|
pa_cvolume_snprint_verbose(s, sizeof(s), &r, &map, true),
|
||||||
|
k,
|
||||||
|
b,
|
||||||
|
k < b - .05 || k > b + .5 ? "MISMATCH" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (v = PA_VOLUME_MUTED; v <= PA_VOLUME_NORM*2; v += 51) {
|
for (v = PA_VOLUME_MUTED; v <= PA_VOLUME_NORM*2; v += 51) {
|
||||||
|
|
|
||||||
|
|
@ -242,10 +242,8 @@ static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_
|
||||||
|
|
||||||
char
|
char
|
||||||
s[PA_SAMPLE_SPEC_SNPRINT_MAX],
|
s[PA_SAMPLE_SPEC_SNPRINT_MAX],
|
||||||
cv[PA_CVOLUME_SNPRINT_MAX],
|
cv[PA_CVOLUME_SNPRINT_VERBOSE_MAX],
|
||||||
cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX],
|
v[PA_VOLUME_SNPRINT_VERBOSE_MAX],
|
||||||
v[PA_VOLUME_SNPRINT_MAX],
|
|
||||||
vdb[PA_SW_VOLUME_SNPRINT_DB_MAX],
|
|
||||||
cm[PA_CHANNEL_MAP_SNPRINT_MAX],
|
cm[PA_CHANNEL_MAP_SNPRINT_MAX],
|
||||||
f[PA_FORMAT_INFO_SNPRINT_MAX];
|
f[PA_FORMAT_INFO_SNPRINT_MAX];
|
||||||
char *pl;
|
char *pl;
|
||||||
|
|
@ -286,9 +284,9 @@ static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_
|
||||||
"\tChannel Map: %s\n"
|
"\tChannel Map: %s\n"
|
||||||
"\tOwner Module: %u\n"
|
"\tOwner Module: %u\n"
|
||||||
"\tMute: %s\n"
|
"\tMute: %s\n"
|
||||||
"\tVolume: %s%s%s\n"
|
"\tVolume: %s\n"
|
||||||
"\t balance %0.2f\n"
|
"\t balance %0.2f\n"
|
||||||
"\tBase Volume: %s%s%s\n"
|
"\tBase Volume: %s\n"
|
||||||
"\tMonitor Source: %s\n"
|
"\tMonitor Source: %s\n"
|
||||||
"\tLatency: %0.0f usec, configured %0.0f usec\n"
|
"\tLatency: %0.0f usec, configured %0.0f usec\n"
|
||||||
"\tFlags: %s%s%s%s%s%s%s\n"
|
"\tFlags: %s%s%s%s%s%s%s\n"
|
||||||
|
|
@ -302,13 +300,9 @@ static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_
|
||||||
pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),
|
pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),
|
||||||
i->owner_module,
|
i->owner_module,
|
||||||
pa_yes_no(i->mute),
|
pa_yes_no(i->mute),
|
||||||
pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
|
pa_cvolume_snprint_verbose(cv, sizeof(cv), &i->volume, &i->channel_map, i->flags & PA_SINK_DECIBEL_VOLUME),
|
||||||
i->flags & PA_SINK_DECIBEL_VOLUME ? "\n\t " : "",
|
|
||||||
i->flags & PA_SINK_DECIBEL_VOLUME ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &i->volume) : "",
|
|
||||||
pa_cvolume_get_balance(&i->volume, &i->channel_map),
|
pa_cvolume_get_balance(&i->volume, &i->channel_map),
|
||||||
pa_volume_snprint(v, sizeof(v), i->base_volume),
|
pa_volume_snprint_verbose(v, sizeof(v), i->base_volume, i->flags & PA_SINK_DECIBEL_VOLUME),
|
||||||
i->flags & PA_SINK_DECIBEL_VOLUME ? "\n\t " : "",
|
|
||||||
i->flags & PA_SINK_DECIBEL_VOLUME ? pa_sw_volume_snprint_dB(vdb, sizeof(vdb), i->base_volume) : "",
|
|
||||||
pa_strnull(i->monitor_source_name),
|
pa_strnull(i->monitor_source_name),
|
||||||
(double) i->latency, (double) i->configured_latency,
|
(double) i->latency, (double) i->configured_latency,
|
||||||
i->flags & PA_SINK_HARDWARE ? "HARDWARE " : "",
|
i->flags & PA_SINK_HARDWARE ? "HARDWARE " : "",
|
||||||
|
|
@ -355,10 +349,8 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int
|
||||||
|
|
||||||
char
|
char
|
||||||
s[PA_SAMPLE_SPEC_SNPRINT_MAX],
|
s[PA_SAMPLE_SPEC_SNPRINT_MAX],
|
||||||
cv[PA_CVOLUME_SNPRINT_MAX],
|
cv[PA_CVOLUME_SNPRINT_VERBOSE_MAX],
|
||||||
cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX],
|
v[PA_VOLUME_SNPRINT_VERBOSE_MAX],
|
||||||
v[PA_VOLUME_SNPRINT_MAX],
|
|
||||||
vdb[PA_SW_VOLUME_SNPRINT_DB_MAX],
|
|
||||||
cm[PA_CHANNEL_MAP_SNPRINT_MAX],
|
cm[PA_CHANNEL_MAP_SNPRINT_MAX],
|
||||||
f[PA_FORMAT_INFO_SNPRINT_MAX];
|
f[PA_FORMAT_INFO_SNPRINT_MAX];
|
||||||
char *pl;
|
char *pl;
|
||||||
|
|
@ -399,9 +391,9 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int
|
||||||
"\tChannel Map: %s\n"
|
"\tChannel Map: %s\n"
|
||||||
"\tOwner Module: %u\n"
|
"\tOwner Module: %u\n"
|
||||||
"\tMute: %s\n"
|
"\tMute: %s\n"
|
||||||
"\tVolume: %s%s%s\n"
|
"\tVolume: %s\n"
|
||||||
"\t balance %0.2f\n"
|
"\t balance %0.2f\n"
|
||||||
"\tBase Volume: %s%s%s\n"
|
"\tBase Volume: %s\n"
|
||||||
"\tMonitor of Sink: %s\n"
|
"\tMonitor of Sink: %s\n"
|
||||||
"\tLatency: %0.0f usec, configured %0.0f usec\n"
|
"\tLatency: %0.0f usec, configured %0.0f usec\n"
|
||||||
"\tFlags: %s%s%s%s%s%s\n"
|
"\tFlags: %s%s%s%s%s%s\n"
|
||||||
|
|
@ -415,13 +407,9 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int
|
||||||
pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),
|
pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),
|
||||||
i->owner_module,
|
i->owner_module,
|
||||||
pa_yes_no(i->mute),
|
pa_yes_no(i->mute),
|
||||||
pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
|
pa_cvolume_snprint_verbose(cv, sizeof(cv), &i->volume, &i->channel_map, i->flags & PA_SOURCE_DECIBEL_VOLUME),
|
||||||
i->flags & PA_SOURCE_DECIBEL_VOLUME ? "\n\t " : "",
|
|
||||||
i->flags & PA_SOURCE_DECIBEL_VOLUME ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &i->volume) : "",
|
|
||||||
pa_cvolume_get_balance(&i->volume, &i->channel_map),
|
pa_cvolume_get_balance(&i->volume, &i->channel_map),
|
||||||
pa_volume_snprint(v, sizeof(v), i->base_volume),
|
pa_volume_snprint_verbose(v, sizeof(v), i->base_volume, i->flags & PA_SOURCE_DECIBEL_VOLUME),
|
||||||
i->flags & PA_SOURCE_DECIBEL_VOLUME ? "\n\t " : "",
|
|
||||||
i->flags & PA_SOURCE_DECIBEL_VOLUME ? pa_sw_volume_snprint_dB(vdb, sizeof(vdb), i->base_volume) : "",
|
|
||||||
i->monitor_of_sink_name ? i->monitor_of_sink_name : _("n/a"),
|
i->monitor_of_sink_name ? i->monitor_of_sink_name : _("n/a"),
|
||||||
(double) i->latency, (double) i->configured_latency,
|
(double) i->latency, (double) i->configured_latency,
|
||||||
i->flags & PA_SOURCE_HARDWARE ? "HARDWARE " : "",
|
i->flags & PA_SOURCE_HARDWARE ? "HARDWARE " : "",
|
||||||
|
|
@ -623,7 +611,7 @@ static void get_card_info_callback(pa_context *c, const pa_card_info *i, int is_
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info *i, int is_last, void *userdata) {
|
static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info *i, int is_last, void *userdata) {
|
||||||
char t[32], k[32], s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], f[PA_FORMAT_INFO_SNPRINT_MAX];
|
char t[32], k[32], s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_VERBOSE_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], f[PA_FORMAT_INFO_SNPRINT_MAX];
|
||||||
char *pl;
|
char *pl;
|
||||||
|
|
||||||
if (is_last < 0) {
|
if (is_last < 0) {
|
||||||
|
|
@ -667,7 +655,6 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info
|
||||||
"\tCorked: %s\n"
|
"\tCorked: %s\n"
|
||||||
"\tMute: %s\n"
|
"\tMute: %s\n"
|
||||||
"\tVolume: %s\n"
|
"\tVolume: %s\n"
|
||||||
"\t %s\n"
|
|
||||||
"\t balance %0.2f\n"
|
"\t balance %0.2f\n"
|
||||||
"\tBuffer Latency: %0.0f usec\n"
|
"\tBuffer Latency: %0.0f usec\n"
|
||||||
"\tSink Latency: %0.0f usec\n"
|
"\tSink Latency: %0.0f usec\n"
|
||||||
|
|
@ -683,8 +670,7 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info
|
||||||
pa_format_info_snprint(f, sizeof(f), i->format),
|
pa_format_info_snprint(f, sizeof(f), i->format),
|
||||||
pa_yes_no(i->corked),
|
pa_yes_no(i->corked),
|
||||||
pa_yes_no(i->mute),
|
pa_yes_no(i->mute),
|
||||||
pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
|
pa_cvolume_snprint_verbose(cv, sizeof(cv), &i->volume, &i->channel_map, true),
|
||||||
pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &i->volume),
|
|
||||||
pa_cvolume_get_balance(&i->volume, &i->channel_map),
|
pa_cvolume_get_balance(&i->volume, &i->channel_map),
|
||||||
(double) i->buffer_usec,
|
(double) i->buffer_usec,
|
||||||
(double) i->sink_usec,
|
(double) i->sink_usec,
|
||||||
|
|
@ -695,7 +681,7 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_source_output_info_callback(pa_context *c, const pa_source_output_info *i, int is_last, void *userdata) {
|
static void get_source_output_info_callback(pa_context *c, const pa_source_output_info *i, int is_last, void *userdata) {
|
||||||
char t[32], k[32], s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], f[PA_FORMAT_INFO_SNPRINT_MAX];
|
char t[32], k[32], s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_VERBOSE_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], f[PA_FORMAT_INFO_SNPRINT_MAX];
|
||||||
char *pl;
|
char *pl;
|
||||||
|
|
||||||
if (is_last < 0) {
|
if (is_last < 0) {
|
||||||
|
|
@ -739,7 +725,6 @@ static void get_source_output_info_callback(pa_context *c, const pa_source_outpu
|
||||||
"\tCorked: %s\n"
|
"\tCorked: %s\n"
|
||||||
"\tMute: %s\n"
|
"\tMute: %s\n"
|
||||||
"\tVolume: %s\n"
|
"\tVolume: %s\n"
|
||||||
"\t %s\n"
|
|
||||||
"\t balance %0.2f\n"
|
"\t balance %0.2f\n"
|
||||||
"\tBuffer Latency: %0.0f usec\n"
|
"\tBuffer Latency: %0.0f usec\n"
|
||||||
"\tSource Latency: %0.0f usec\n"
|
"\tSource Latency: %0.0f usec\n"
|
||||||
|
|
@ -755,8 +740,7 @@ static void get_source_output_info_callback(pa_context *c, const pa_source_outpu
|
||||||
pa_format_info_snprint(f, sizeof(f), i->format),
|
pa_format_info_snprint(f, sizeof(f), i->format),
|
||||||
pa_yes_no(i->corked),
|
pa_yes_no(i->corked),
|
||||||
pa_yes_no(i->mute),
|
pa_yes_no(i->mute),
|
||||||
pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
|
pa_cvolume_snprint_verbose(cv, sizeof(cv), &i->volume, &i->channel_map, true),
|
||||||
pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &i->volume),
|
|
||||||
pa_cvolume_get_balance(&i->volume, &i->channel_map),
|
pa_cvolume_get_balance(&i->volume, &i->channel_map),
|
||||||
(double) i->buffer_usec,
|
(double) i->buffer_usec,
|
||||||
(double) i->source_usec,
|
(double) i->source_usec,
|
||||||
|
|
@ -767,7 +751,7 @@ static void get_source_output_info_callback(pa_context *c, const pa_source_outpu
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int is_last, void *userdata) {
|
static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int is_last, void *userdata) {
|
||||||
char t[PA_BYTES_SNPRINT_MAX], s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
|
char t[PA_BYTES_SNPRINT_MAX], s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_VERBOSE_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
|
||||||
char *pl;
|
char *pl;
|
||||||
|
|
||||||
if (is_last < 0) {
|
if (is_last < 0) {
|
||||||
|
|
@ -803,7 +787,6 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int
|
||||||
"\tSample Specification: %s\n"
|
"\tSample Specification: %s\n"
|
||||||
"\tChannel Map: %s\n"
|
"\tChannel Map: %s\n"
|
||||||
"\tVolume: %s\n"
|
"\tVolume: %s\n"
|
||||||
"\t %s\n"
|
|
||||||
"\t balance %0.2f\n"
|
"\t balance %0.2f\n"
|
||||||
"\tDuration: %0.1fs\n"
|
"\tDuration: %0.1fs\n"
|
||||||
"\tSize: %s\n"
|
"\tSize: %s\n"
|
||||||
|
|
@ -814,8 +797,7 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int
|
||||||
i->name,
|
i->name,
|
||||||
pa_sample_spec_valid(&i->sample_spec) ? pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec) : _("n/a"),
|
pa_sample_spec_valid(&i->sample_spec) ? pa_sample_spec_snprint(s, sizeof(s), &i->sample_spec) : _("n/a"),
|
||||||
pa_sample_spec_valid(&i->sample_spec) ? pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map) : _("n/a"),
|
pa_sample_spec_valid(&i->sample_spec) ? pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map) : _("n/a"),
|
||||||
pa_cvolume_snprint(cv, sizeof(cv), &i->volume),
|
pa_cvolume_snprint_verbose(cv, sizeof(cv), &i->volume, &i->channel_map, true),
|
||||||
pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &i->volume),
|
|
||||||
pa_cvolume_get_balance(&i->volume, &i->channel_map),
|
pa_cvolume_get_balance(&i->volume, &i->channel_map),
|
||||||
(double) i->duration/1000000.0,
|
(double) i->duration/1000000.0,
|
||||||
t,
|
t,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue