[pulseaudio-discuss] pulse support not working properly in application on F12,

Lennart Poettering lennart at poettering.net
Wed Oct 7 11:47:06 PDT 2009

On Wed, 07.10.09 10:31, stan (gryt2 at q.com) wrote:

> Hi,
> I am adding (trying to add) pulse support to an application I author.
> But no matter what I do, I can't get it to play correct sound.  Here is
> the sordid history.
> I first added pa_simple support as this seemed tailor made for what I
> want to do - send buffers of data at regular intervals to a sound
> device.  I used the sample from the web page and looked at
> implementations from several other applications - Csound, sox,
> helix-player.  It compiled cleanly, gave every indication it was
> working, but the sound that came out sounded like a dying whale.  I
> traced it in gdb to the point of writing the buffer as a chunk
> someplace, and everything looked fine.

Maybe you are filling pa_sample_spec in improperly? Or maybe there is
some confusion between samples and frames and you write incomplete

"Sounds like a dying whale" is a little bit too little to tell what
might be going wrong from my perspective.

> So I upgraded to using the standard model - I copied the
> xmms-pulse plugin.c as a template and modified it until it compiled on
> my system without issues.  Same problem, sound is horrible.  To
> actually use callbacks would require a complete change in architecture
> for the application, and I'm not going there.

Uh. xmms is not maintained and dead and removed from quite a few
distros. Something similar is true for xmms-pulse. This is really not
where you should be looking.

> >From this list I discovered the pacmd interface.  I turned on logging
> to level 4 and set source line flagging.  I now see messages about
> being unable to push to the queue, and the line is 1355 in
> protocol-native.c.

That usually means that your client doesn't read enough, you send too
many little requests or something like this.

> I've added my user to the pulse, pulse-rt, and pulse-access groups.

Don't do that. pulse-rt is obsolete since 0.9.16, and the other two
groups are only relevant if you run PA in system mode, which you
should not. And under no circumstances any user should become a member
of the pulse group, except for the pulse user itself.

> Some bugs/issues I've found along the way.
> The xmms-pulse plugin.c call to pa_stream_write has
> PA_SEEK_STREAM_RELATIVE and offset reversed from the template in the
> stream.h header file.

Indeed. Fixed that in my checkout. Unlikely I will ever do another
release of this though.

> Configure complains about the /usr/include/pulse/stream.h file unless
> the following two includes are added:
> #include <pulse/context.h>
> #include <pulse/proplist.h>

Uh, it is recommended to include pulse/pulseaudio.h instead of the
seperate header files. We probably should add some macro magic that
warns the user about this.

Nonetheless, fixed now.

> Configure complains about the /usr/include/pulse/ext-stream-restore.h
> file unless the following two includes are added:
> #include <pulse/volume.h>
> #include <pulse/channelmap.h>


> This is taking waaaayyy too long.  It is peripheral to the purpose of
> my app, and I'd rather be adding new features.  So I would be grateful
> for any insight.

Is your software Free Software? If so, may I have a peek on your code?


Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4

More information about the pulseaudio-discuss mailing list