From ad214980e84c32ac93b43301f54406c6952c0819 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 4 Feb 2011 12:17:06 +0000 Subject: active-sink api beginning to emerge --- src/active-sink.c | 11 ++++++++++- src/active-sink.h | 4 ++++ src/pulseaudio-mgr.c | 14 ++++++++++---- 3 files changed, 24 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/active-sink.c b/src/active-sink.c index 7e84b58..e85aab8 100644 --- a/src/active-sink.c +++ b/src/active-sink.c @@ -101,4 +101,13 @@ active_sink_get_index (ActiveSink* self) { return 0; } - \ No newline at end of file + +void +active_sink_update_volume (ActiveSink* self, gdouble percent) +{ +} + +void +active_sink_update_mute (ActiveSink* self, gboolean muted) +{ +} diff --git a/src/active-sink.h b/src/active-sink.h index 051da85..251d0a7 100644 --- a/src/active-sink.h +++ b/src/active-sink.h @@ -61,6 +61,10 @@ void active_sink_update_details (ActiveSink* sink, sink_details* details); gboolean active_sink_is_populated (ActiveSink* sink); gboolean active_sink_is_muted (ActiveSink* self); gint active_sink_get_index (ActiveSink* self); +void active_sink_update_volume (ActiveSink* self, gdouble vol_percent); +void active_sink_update_mute (ActiveSink* self, gboolean muted); + + G_END_DECLS #endif diff --git a/src/pulseaudio-mgr.c b/src/pulseaudio-mgr.c index 5f128eb..5089e23 100644 --- a/src/pulseaudio-mgr.c +++ b/src/pulseaudio-mgr.c @@ -30,7 +30,7 @@ with this program. If not, see . #include #include -#include "pulse-manager.h" +#include "pulseaudio-mgr.h" #define RECONNECT_DELAY 5 @@ -376,8 +376,8 @@ pm_sink_input_info_callback (pa_context *c, } ActiveSink* a_sink = ACTIVE_SINK (userdata); - if (active_sink_get_index (a_sink) == info->sink->index && - active_sink_is_muted () == TRUE) { + if (active_sink_get_index (a_sink) == info->sink && + active_sink_is_muted (a_sink) == TRUE) { // TODO fire off blocking signal } } @@ -393,7 +393,13 @@ pm_update_active_sink (pa_context *c, return; } else{ - + if (IS_ACTIVE_SINK (userdata) == FALSE){ + g_warning ("update_active_sink - our user data is not what we think it should be"); + return; + } + pa_volume_t vol = pa_cvolume_max (&info->volume); + gdouble volume_percent = ((gdouble) vol * 100) / PA_VOLUME_NORM; + active_sink_update_volume (ACTIVE_SINK(userdata), volume_percent); } } -- cgit v1.2.3