You are not logged in.

#1 2018-11-23 13:51:17

kokoko3k
Member
Registered: 2008-11-14
Posts: 1,762

Auto-redirect playing audio from pulseaudio to jack?

Today i started jack without paying care to pulseaudio and i noticed that jack successfully grabbed the audio device and pulseaudio automatically suspended.
This is good, i don't remember it worked that way in the past, so i digged into the pulseaudio configuration to understand how that was possible and i noticed that module-jackdbus-detect was loaded.

Nice, how does it work?
Documentation here: https://www.freedesktop.org/wiki/Softwa … /#index9h2
It states:

module-jackdbus-detect

This module automatically adds JACK sinks and sources whenever the JACK server is started. For this to work, you need to use JACK 2, and enable JACK's D-Bus interface.

I've had installed plain jack2, so i removed it and installed jack2-dbus; then i started jack via jack_control start.
I expected, at this point, that not only jack was still able to grab the audio device, but that pulse client were automatically redirected to jack.
Well, this does not happened, i think because something remain suspended, see:

#(pulseaudio clients playing)

koko@Gozer# jack_control start
--- start
#(Audio stops here)
koko@Gozer# pacmd list-sources|grep -B4 suspend
        name: <alsa_output.pci-0000_00_1b.0.analog-stereo.monitor>
        driver: <module-alsa-card.c>
        flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
        state: SUSPENDED
        suspend cause: APPLICATION
--
        name: <alsa_input.pci-0000_00_1b.0.analog-stereo>
        driver: <module-alsa-card.c>
        flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
        state: SUSPENDED
        suspend cause: APPLICATION|IDLE
--
        name: <jack_out.monitor>
        driver: <module-jack-sink.c>
        flags: DECIBEL_VOLUME LATENCY 
        state: SUSPENDED
        suspend cause: IDLE
--
        name: <jack_in>
        driver: <module-jack-source.c>
        flags: DECIBEL_VOLUME LATENCY 
        state: SUSPENDED
        suspend cause: IDLE

koko@Gozer# pacmd list-sinks|grep -B4 suspend
        name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
        driver: <module-alsa-card.c>
        flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
        state: SUSPENDED
        suspend cause: APPLICATION
--
        name: <jack_out>
        driver: <module-jack-sink.c>
        flags: DECIBEL_VOLUME LATENCY 
        state: SUSPENDED
        suspend cause: IDLE

I thought that the problem could be the idle pulseaudio module:

koko@Gozer# pacmd unload-module module-suspend-on-idle

koko@Gozer# jack_control stop
--- stop

#(AUDIO PLAYING)

koko@Gozer# jack_control start
--- start

#(AUDIO STOPPED)

koko@Gozer# pacmd list-sinks|grep -B4 -A1 SUSPENDED
    index: 2
        name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
        driver: <module-alsa-card.c>
        flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
        state: SUSPENDED
        suspend cause: APPLICATION

koko@Gozer# pacmd list-sources|grep -B4 -A1 SUSPENDED
    index: 3
        name: <alsa_output.pci-0000_00_1b.0.analog-stereo.monitor>
        driver: <module-alsa-card.c>
        flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
        state: SUSPENDED
        suspend cause: APPLICATION
--
    index: 4
        name: <alsa_input.pci-0000_00_1b.0.analog-stereo>
        driver: <module-alsa-card.c>
        flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
        state: SUSPENDED
        suspend cause: APPLICATION

I also noticed that if at this point i issue:

koko@Gozer# pacmd
Welcome to PulseAudio 12.2! Use "help" for usage information.
>>> exit
>>> 

...the audio start playing and pulseaudio redirects streams to jack inputs, but i've triggered it manually somehow.

Why doesn't it work by his own?

---
EDIT
Man, i feel so stupid...
pacmd load-module switch-on-connect did the trick.
---
EDIT
Nope, sometimes it work, sometimes it wont.
Manually moving the playing streams works.

Last edited by kokoko3k (2018-11-27 14:55:54)

Offline

Board footer

Powered by FluxBB