Question

How to play multiple audio streams using libpulse. I know it is possible by summing multiple streams and playing using libaudio but is it possible to write multiple streams on lib pulse api and have PulseAudio do the summing?

Was it helpful?

Solution

I got the solution by implementing this. libpulse API

Synchronising Multiple Playback Streams

PulseAudio allows applications to fully synchronize multiple playback streams that are connected to the same output device. That means the streams will always be played back sample-by-sample synchronously. If stream operations like pa_stream_cork() are issued on one of the synchronized streams, they are simultaneously issued on the others. To synchronize a stream to another, just pass the "master" stream as last argument to pa_stream_connect_playback(). To make sure that the freshly created stream doesn't start playback right-away, make sure to pass PA_STREAM_START_CORKED and – after all streams have been created – uncork them all with a single call to pa_stream_cork() for the master stream. To make sure that a particular stream doesn't stop to play when a server side buffer underrun happens on it while the other synchronized streams continue playing and hence deviate, you need to pass a "prebuf" pa_buffer_attr of 0 when connecting it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top