On Mon, Mar 16, 2009 at 2:53 PM, David Guibert <david.guib...@gmail.com> wrote:
> Signed-off-by: David Guibert <david.guib...@gmail.com>
> ---
> Avuton,
>
> I hope this help to find which part clearly fails.
> It should give me more information about bugs
> - 2136
> - 2138
> - 2139
>
> Regards
>
>  src/mixer/pulse_mixer.c |   45 ++++++++++++++++++++++-----------------------
>  1 files changed, 22 insertions(+), 23 deletions(-)
>
> diff --git a/src/mixer/pulse_mixer.c b/src/mixer/pulse_mixer.c
> index a300a29..7f2651a 100644
> --- a/src/mixer/pulse_mixer.c
> +++ b/src/mixer/pulse_mixer.c
> @@ -48,22 +48,19 @@ sink_input_cb(G_GNUC_UNUSED pa_context *context, const 
> pa_sink_input_info *i,
>  {
>
>        struct pulse_mixer *pm = userdata;
> -       if (eol) {
> -               g_debug("eol error sink_input_cb");
> +       if (eol)
>                return;
> -       }
>
>        if (!i) {
>                g_debug("Sink input callback failure");
>                return;
>        }
> -       g_debug("sink input cb %s, index %d ",i->name,i->index);
> -       if(strcmp(i->name,pm->output_name)==0) {
> -               pm->index=i->index;
> -               pm->online=true;
> -               *pm->volume=i->volume;
> -       } else
> -               g_debug("bad name");
> +       if(strcmp(i->name,pm->output_name) == 0) {
> +               g_debug("Sink input cb %s, index %d",i->name,i->index);
> +               pm->index   = i->index;
> +               pm->online  = true;
> +               *pm->volume = i->volume;
> +       }
>  }
>
>  static void
> @@ -72,21 +69,19 @@ sink_input_vol(G_GNUC_UNUSED pa_context *context, const 
> pa_sink_input_info *i,
>  {
>
>        struct pulse_mixer *pm = userdata;
> -       if (eol) {
> -               g_debug("eol error sink_input_vol");
> +       if (eol)
>                return;
> -       }
>
>        if (!i) {
> -               g_debug("Sink input callback failure");
> +               g_debug("Sink input volume failure");
>                return;
>        }
> -       g_debug("sink input vol %s, index %d ", i->name, i->index);
> -       *pm->volume=i->volume;
> +       g_debug("Sink input vol %s, index %d", i->name, i->index);
> +       *pm->volume = i->volume;
>  }
>
>  static void
> -subscribe_cb(G_GNUC_UNUSED pa_context *c, pa_subscription_event_type_t t,
> +subscribe_cb(pa_context *context, pa_subscription_event_type_t t,
>             uint32_t idx, void *userdata)
>  {
>
> @@ -101,7 +96,7 @@ subscribe_cb(G_GNUC_UNUSED pa_context *c, 
> pa_subscription_event_type_t t,
>                else {
>                        pa_operation *o;
>
> -                       if (!(o = pa_context_get_sink_input_info(pm->context, 
> idx, sink_input_cb, pm))) {
> +                       if (!(o = pa_context_get_sink_input_info(context, 
> idx, sink_input_cb, pm))) {
>                                g_debug("pa_context_get_sink_input_info() 
> failed");
>                                return;
>                        }
> @@ -202,8 +197,9 @@ pulse_mixer_open(G_GNUC_UNUSED struct mixer *data)
>                return false;
>        }
>
> +       pa_threaded_mainloop_lock(pm->mainloop);
>        if(!(pm->context = 
> pa_context_new(pa_threaded_mainloop_get_api(pm->mainloop),
> -                                         "Mixer mpd"))) {
> +                                         "Mixer MPD"))) {
>                g_debug("failed context");
>                return false;
>        }
> @@ -212,20 +208,21 @@ pulse_mixer_open(G_GNUC_UNUSED struct mixer *data)
>
>        if (pa_context_connect(pm->context, pm->server,
>                               (pa_context_flags_t)0, NULL) < 0) {
> -               g_debug("context server fail");
> +               g_warning("Failed to connect to server: %s", 
> pa_strerror(pa_context_errno(pm->context)));
>                return false;
>        }
>
> -       pa_threaded_mainloop_lock(pm->mainloop);
>        if (pa_threaded_mainloop_start(pm->mainloop) < 0) {
> -               g_debug("error start mainloop");
> +               g_warning("Failed to start main loop");
>                return false;
>        }
>
> +       /* Wait until the context is ready */
>        pa_threaded_mainloop_wait(pm->mainloop);
>
>        if (pa_context_get_state(pm->context) != PA_CONTEXT_READY) {
> -               g_debug("error context not ready");
> +               g_warning("Failed to connect to server: %s", 
> pa_strerror(pa_context_errno(pm->context)));
> +               pa_threaded_mainloop_unlock(pm->mainloop);
>                return false;
>        }
>
> @@ -283,6 +280,8 @@ pulse_mixer_set_volume(struct mixer *mixer, unsigned 
> volume)
>  {
>        struct pulse_mixer *pm=(struct pulse_mixer *) mixer;
>        pa_operation *o;
> +       g_debug("set_volume %s %d",
> +               pm->online == TRUE ? "online" : "offline", volume);
>        if (pm->online) {
>                pa_cvolume_set(pm->volume, (pm->volume)->channels,
>                                (pa_volume_t)(volume)*PA_VOLUME_NORM/100+0.5);


Guess I'm an impatient guy. I had given up on you guys :). Well, the
good news is the problem doesn't exist anymore, the bad news is the
mixer doesn't do anything now ;)

Getting these once a second with gmpc open though.
pulse_mixer: get_volume offline

When I try to adjust I get:
client: [1] process command "setvol "100""
pulse_mixer: set_volume offline 100

Nothing too eventful. Anything else I can help with?

Thanks!
-- 
avuton
--
|  (\_/)  This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to