[pulseaudio-discuss] Routing of audio to loudspeakers or headphones

Kim Therkelsen kim_t26 at hotmail.com
Tue Sep 14 02:48:52 PDT 2010


Based on the advice from Colin Guthrie I am now trying to modify the module-ladspa-sink module so that it takes a "master_port" argument and only creates the virtual sink when the master sink's port matches the argument value (and unload it when it changes). I think it should be possible to leave the master_port argument out and let the functionality fall back to the original functionality to ensure backward compatibility.  

Furthermore I have updated module-ladspa-sink to support multiple audio channels based on:

Unfortunately I can not find much information about how to handle these "ports" in the source code. 
I can see that pavucontrol can switch between the ports and from the "info" command in pulseaudio I get:

1 sink(s) available.
  * index: 0
    name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
    driver: <module-alsa-card.c>
        analog-output: Analog Output (priority 9900)
        analog-output-speaker: Analog Speakers (priority 10000)
        analog-output-headphones: Analog Headphones (priority 9000)
    active port: <analog-output-headphones>

But how do I update int pa__init(pa_module*m) to perform the port check? Which command should I use to ask PA which port is active?

I need to load the LADSPA module once right after PA has started. After that processing through the LADSPA module should only happen when audio is routed to the PC loudspeakers and not when something (like headphones) is connected to the PC output mini-jack. The user should not have to change anything - it should happen automatically.  
Based on that how can I avoid creating the virtual sink if the master sink's port does not not match the argument (returning -1 in pa__init does not seem right as it will indicate an error)? How do you make it unload/load automatically as the headphone jack is plugged/unplugged?

Perhaps you have a link to some source code where something similar has been done?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20100914/bde165a8/attachment.htm>

More information about the pulseaudio-discuss mailing list