Hi,

when I call pa_stream_connect_playback I always obtain bad state. Why?


I am using this code:

        m = pa_mainloop_new();
        pa_mainloop_api* mainloop_api = pa_mainloop_get_api(m);
        pa_proplist* proplist = pa_proplist_new();

        /* Create a new connection context */
        if (!(pulsecontext = pa_context_new_with_proplist(mainloop_api, NULL,
proplist)))
        {
                qDebug() << "pa_context_new_with_proplist() failed";
        }

        pa_context_flags flags = PA_CONTEXT_NOFAIL;

        /* Connect the context */
        if (pa_context_connect(pulsecontext, 0, flags, NULL) < 0)
        {
                qDebug() << "pa_context_connect() failed: " <<
pa_strerror(pa_context_errno(pulsecontext));
        }


        s = pa_stream_new (pulsecontext, "CTFULL", &ss, NULL);
        if(s == 0)
        {
                qDebug() << "Error creating stream audio";
                mute = true;
        }

        pa_cvolume cv;
        pa_cvolume_set (&cv, channels, PA_VOLUME_NORM);

        if (pa_stream_connect_playback (s, 0, 0, flags, &cv, 0) < 0)
        {
                connect_fail = true;
                qDebug() << "Unable to connect to PulseAudio";
                qDebug() << "pa_stream_connect_playback() failed: " <<
pa_strerror(pa_context_errno(pulsecontext));
        }
        else
                qDebug() << "Connected to PulseAudio";



thanks a lot,

-- 
Ing. Gian Lorenzo Meocci
http://www.meocci.it
_______________________________________________
pulseaudio-discuss mailing list
[email protected]
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss

Reply via email to