aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pavolctld.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/pavolctld.c b/pavolctld.c
index b266ab0..e291db5 100644
--- a/pavolctld.c
+++ b/pavolctld.c
@@ -14,29 +14,28 @@ static int command_sink_index; // commands will modify this sink
/* output callbacks */
static void sink_info_volume_callback(pa_context *c, const pa_sink_info *i, int eol, void *userdata) {
- pa_volume_t vol;
+ pa_volume_t vol = pa_cvolume_avg(&i->volume);
if (eol) return;
- vol = pa_cvolume_avg(&i->volume);
printf("v%d,%d,%.02f,%d\n", i->index, ROUND_POS(vol*100.0f/PA_VOLUME_NORM), pa_sw_volume_to_dB(vol), i->mute);
fflush(stdout);
}
-static void sink_info_default_index_callback(pa_context *c, const pa_sink_info *i, int eol, void *userdata) {
+static void sink_info_sink_desc_callback(pa_context *c, const pa_sink_info *i, int eol, void *userdata) {
if (eol) return;
- default_sink_index = i->index;
+ printf("s%d,%s,%s\n", i->index, i->name, i->description);
+ fflush(stdout);
}
-static void sink_info_sink_desc_callback(pa_context *c, const pa_sink_info *i, int eol, void *userdata) {
+static void sink_info_default_index_callback(pa_context *c, const pa_sink_info *i, int eol, void *userdata) {
if (eol) return;
- printf("s%d,%s,%s\n", i->index, i->name, i->description);
+ default_sink_index = i->index;
+ printf("f%d\n", default_sink_index);
fflush(stdout);
}
static void server_info_default_sink_callback(pa_context *c, const pa_server_info *i, void *userdata) {
pa_context_get_sink_info_by_name(c, i->default_sink_name, sink_info_default_index_callback, userdata);
- printf("f%d\n", default_sink_index);
- fflush(stdout);
}
/* subscription callback is called whenever a listened-to event occurs */