[pulseaudio-discuss] [PATCH] new virtual-sink and virtual-source modules
pl bossart
bossart.nospam at gmail.com
Thu Feb 11 14:47:03 PST 2010
The patches I am about to post provide two modules that could be of
interest to the PulseAudio community.
module-virtual-sink is a template for the addition of PCM processing.
It's basically based on the LADSPA module, I use it for internal
experiments and will enhance it in the future.
module-virtual-source is something new. This is the continuation of my
earlier work to enable paths that were not possible in PulseAudio.
With module-loopback I enabled a source to be played on a sink. Well,
this virtual-source module is the missing complement. It wasn't
possible until now to mix music with the microphone inputs. Now you
can send data to the 'uplink sink' exposed in this module, and it'll
be mixed with the inputs and provided to apps by a virtual source
element.
For example you could be talking with Skype and sharing your music
with the remote party. Or send beeps/tones/alerts/DTMF/whatever. Or
record a conversation.
In addition, this virtual source can be used to add PCM processing on
the inputs if you don't care for this mixing capability but want to
add EQ, DRC, on a capture path.
I played for some time with the idea of adding such a mixing
capability for all sources, just like we have monitor sources on all
sinks, however you may want to do some processing on the inputs before
mixing, and I preferred to implement this mixing capability as an
optional feature in a separate module.
I did struggle to implement some of the callbacks; this is fairly
hairy PulseAudio stuff, you will see a lot of FIXMEs on the code
handling latency/state/volume changes. Contributions are welcome to
stabilize the code.
One known issue: I added some code to wake-up the source when the
virtual sink become active, but at some point the suspend-on-idle
kicks in and the client gets stuck. I need to find a way to prevent
the source from being suspended in that case, even if no client is
connected to the source.
To enable both modules, just add these lines in default.pa
load-module module-virtual-sink sink_name=vsink
set-default-source vsink
load-module module-virtual-source source_name=vsource uplink_sink=uplink
set-default-source vsource
You can then test all this with pavucontrol and reroute the data
wherever you want. Thanks for your feedback.
Cheers,
- Pierre
More information about the pulseaudio-discuss
mailing list