MPlayer loses JACK connections on every track change

Unofficial support for the KXStudio Linux distribution and applications.
More info at http://kxstudio.linuxaudio.org/

Moderators: khz, MattKingUSA

Post Reply
MountainX
Established Member
Posts: 29
Joined: Sat Aug 31, 2013 7:24 pm

MPlayer loses JACK connections on every track change

Post by MountainX »

I'm running KX Studio on Kubuntu 12.04. I have a Komplete Audio K6. I use Claudia to save studios. I use SMPlayer GUI (which calls MPlayer). When I begin playing a folder of MP3 files (e.g., an audiobook) I set up the JACK connections so that MPlayer out_0 connects to alsa_pcm hw:K6,0:in1, in3, in5 and out_1 connects to in2, in4, in6. I save that. But with every track change, those connections are lost and MPlayer establishes connections only to in1 and in2.

Here is my XML config file:

Code: Select all

<?xml version="1.0"?>
<!--
ladish Studio configuration.
-->
<!-- Fri Oct  4 13:06:06 2013 -->
<studio>
  <jack>
    <conf>
      <parameter path="/engine/driver">alsa</parameter>
      <parameter path="/engine/realtime">false</parameter>
      <parameter path="/engine/realtime-priority">70</parameter>
      <parameter path="/engine/verbose">false</parameter>
      <parameter path="/engine/client-timeout">500</parameter>
      <parameter path="/engine/port-max">512</parameter>
      <parameter path="/engine/alias">true</parameter>
      <parameter path="/driver/device">hw:K6,0</parameter>
      <parameter path="/driver/capture">hw:K6,0</parameter>
      <parameter path="/driver/playback">hw:K6,0</parameter>
      <parameter path="/driver/rate">48000</parameter>
      <parameter path="/driver/period">2048</parameter>
      <parameter path="/driver/nperiods">3</parameter>
      <parameter path="/driver/hwmon">false</parameter>
      <parameter path="/driver/hwmeter">false</parameter>
      <parameter path="/driver/duplex">true</parameter>
      <parameter path="/driver/softmode">false</parameter>
      <parameter path="/driver/monitor">false</parameter>
      <parameter path="/driver/dither">n</parameter>
      <parameter path="/driver/shorts">false</parameter>
      <parameter path="/driver/hw-alias">false</parameter>
    </conf>
    <clients>
      <client name="alsa_pcm" uuid="3fb94e2d-9dc5-4dd7-baf5-562694bb6f80">
        <ports>
          <port name="hw:K6,0:out1" uuid="b3e04f9c-3838-4c70-947c-26e934d061c1" />
          <port name="hw:K6,0:out2" uuid="2478433e-a52b-4b01-a2bb-27800e959496" />
          <port name="hw:K6,0:out3" uuid="39a234b0-e091-4583-9940-82340672376d" />
          <port name="hw:K6,0:out4" uuid="428d0d95-0bcc-46f8-b520-8e8a31026eef" />
          <port name="hw:K6,0:out5" uuid="dcce9f4a-da5b-4a94-8f83-47851c34a048" />
          <port name="hw:K6,0:out6" uuid="705e66c1-ddc2-405a-831c-065afa8a14be" />
          <port name="hw:K6,0:in1" uuid="1535a730-73a1-498c-88b4-9514998c50c7" />
          <port name="hw:K6,0:in2" uuid="1115207d-d97b-4935-aa53-8829ab25d229" />
          <port name="hw:K6,0:in3" uuid="584c66cf-4083-4874-b677-d41f5395095b" />
          <port name="hw:K6,0:in4" uuid="b28baf8e-440e-4d10-92b0-b559f76b6025" />
          <port name="hw:K6,0:in5" uuid="3366fedb-a585-4e75-b288-baca5a432d34" />
          <port name="hw:K6,0:in6" uuid="06baf093-dd37-4fc7-b782-1384419cc667" />
        </ports>
      </client>
      <client name="claudia" uuid="dfbb15d6-a3e4-4d44-a0fb-4b1a5ca174ed">
        <ports>
        </ports>
      </client>
      <client name="cadence-aloop-daemon" uuid="625c2d47-4260-47ce-a4e5-f5de0bc049f2">
        <ports>
        </ports>
      </client>
      <client name="alsa2jack" uuid="ca5004d2-04d6-4ebc-ae84-ba656ebab2a4">
        <ports>
          <port name="capture_1" uuid="7c630c12-109e-48af-9b2d-dd6a02484fdf" />
          <port name="capture_2" uuid="bf55e118-b83d-4871-8091-801246500d59" />
        </ports>
      </client>
      <client name="jack2alsa" uuid="e36c12fa-070f-4814-b869-3da9aff25db1">
        <ports>
          <port name="playback_1" uuid="f6290d6d-69d9-4117-b674-586ca4342203" />
          <port name="playback_2" uuid="80a1b1d4-08b0-4d18-a86c-b9425b454a78" />
        </ports>
      </client>
      <client name="MPlayer [347]" uuid="2c7f35c9-4117-4432-9df4-11b442ca5114">
        <ports>
          <port name="out_0" uuid="d2a46e94-dda0-48fe-bce2-76808f58ef7f" />
          <port name="out_1" uuid="7b67a2ad-5ce7-4d36-8609-0a584b112670" />
        </ports>
      </client>
    </clients>
  </jack>
  <clients>
    <client name="alsa_pcm" uuid="5825f229-5190-448c-9fec-04735211f6fd" naming="app">
      <ports>
        <port name="hw:K6,0:out1" uuid="b3e04f9c-3838-4c70-947c-26e934d061c1" type="audio" direction="output" />
        <port name="hw:K6,0:out2" uuid="2478433e-a52b-4b01-a2bb-27800e959496" type="audio" direction="output" />
        <port name="hw:K6,0:out3" uuid="39a234b0-e091-4583-9940-82340672376d" type="audio" direction="output" />
        <port name="hw:K6,0:out4" uuid="428d0d95-0bcc-46f8-b520-8e8a31026eef" type="audio" direction="output" />
        <port name="hw:K6,0:out5" uuid="dcce9f4a-da5b-4a94-8f83-47851c34a048" type="audio" direction="output" />
        <port name="hw:K6,0:out6" uuid="705e66c1-ddc2-405a-831c-065afa8a14be" type="audio" direction="output" />
        <port name="hw:K6,0:in1" uuid="1535a730-73a1-498c-88b4-9514998c50c7" type="audio" direction="input" />
        <port name="hw:K6,0:in2" uuid="1115207d-d97b-4935-aa53-8829ab25d229" type="audio" direction="input" />
        <port name="hw:K6,0:in3" uuid="584c66cf-4083-4874-b677-d41f5395095b" type="audio" direction="input" />
        <port name="hw:K6,0:in4" uuid="b28baf8e-440e-4d10-92b0-b559f76b6025" type="audio" direction="input" />
        <port name="hw:K6,0:in5" uuid="3366fedb-a585-4e75-b288-baca5a432d34" type="audio" direction="input" />
        <port name="hw:K6,0:in6" uuid="06baf093-dd37-4fc7-b782-1384419cc667" type="audio" direction="input" />
      </ports>
      <dict>
        <key name="http://ladish.org/ns/canvas/x">1313.066924778761</key>
        <key name="http://ladish.org/ns/canvas/y">1121.0223082595871</key>
      </dict>
    </client>
    <client name="alsa2jack" uuid="4a11e614-afa7-4a68-a95f-4e70da28a25f" naming="app">
      <ports>
        <port name="capture_1" uuid="7c630c12-109e-48af-9b2d-dd6a02484fdf" type="audio" direction="output" />
        <port name="capture_2" uuid="bf55e118-b83d-4871-8091-801246500d59" type="audio" direction="output" />
      </ports>
    </client>
    <client name="jack2alsa" uuid="ec85f496-7740-4a9b-b646-49ff543f37c1" naming="app">
      <ports>
        <port name="playback_1" uuid="f6290d6d-69d9-4117-b674-586ca4342203" type="audio" direction="input" />
        <port name="playback_2" uuid="80a1b1d4-08b0-4d18-a86c-b9425b454a78" type="audio" direction="input" />
      </ports>
    </client>
    <client name="MPlayer [347]" uuid="c21fbaca-e2bc-4d01-9d8b-a74618a63801" naming="app">
      <ports>
        <port name="out_0" uuid="d2a46e94-dda0-48fe-bce2-76808f58ef7f" type="audio" direction="output" />
        <port name="out_1" uuid="7b67a2ad-5ce7-4d36-8609-0a584b112670" type="audio" direction="output" />
      </ports>
      <dict>
        <key name="http://ladish.org/ns/canvas/x">1045.0</key>
        <key name="http://ladish.org/ns/canvas/y">1109.0</key>
      </dict>
    </client>
  </clients>
  <connections>
    <connection port1="b3e04f9c-3838-4c70-947c-26e934d061c1" port2="f6290d6d-69d9-4117-b674-586ca4342203" />
    <connection port1="2478433e-a52b-4b01-a2bb-27800e959496" port2="80a1b1d4-08b0-4d18-a86c-b9425b454a78" />
    <connection port1="7c630c12-109e-48af-9b2d-dd6a02484fdf" port2="1535a730-73a1-498c-88b4-9514998c50c7" />
    <connection port1="bf55e118-b83d-4871-8091-801246500d59" port2="1115207d-d97b-4935-aa53-8829ab25d229" />
    <connection port1="d2a46e94-dda0-48fe-bce2-76808f58ef7f" port2="1535a730-73a1-498c-88b4-9514998c50c7" />
    <connection port1="7b67a2ad-5ce7-4d36-8609-0a584b112670" port2="1115207d-d97b-4935-aa53-8829ab25d229" />
    <connection port1="d2a46e94-dda0-48fe-bce2-76808f58ef7f" port2="584c66cf-4083-4874-b677-d41f5395095b" />
    <connection port1="7b67a2ad-5ce7-4d36-8609-0a584b112670" port2="b28baf8e-440e-4d10-92b0-b559f76b6025" />
    <connection port1="d2a46e94-dda0-48fe-bce2-76808f58ef7f" port2="3366fedb-a585-4e75-b288-baca5a432d34" />
    <connection port1="7b67a2ad-5ce7-4d36-8609-0a584b112670" port2="06baf093-dd37-4fc7-b782-1384419cc667" />
  </connections>
  <applications>
    <application name="ALSA Audio JACK Bridge" uuid="7c70460b-642c-42cb-9fb8-cb64fa5a366b" terminal="true" level="0" autorun="true">cadence-aloop-daemon</application>      
  </applications>
</studio>


bazsound
Established Member
Posts: 480
Joined: Sat Aug 03, 2013 11:46 am

Re: MPlayer loses JACK connections on every track change

Post by bazsound »

yes this has been the behaviour of media plays for a while (not just mplay, vlc and clementine do this aswell)

The only solution i have found is to use also with media plays. If you use the cadence soundloop deamon the aslajack ports stay open all the time so once you route it somewhere it stays.

lazyklimm
Established Member
Posts: 244
Joined: Tue Jul 23, 2013 4:59 pm

Re: MPlayer loses JACK connections on every track change

Post by lazyklimm »

from man mplayer:
jack audio output through JACK (Jack Audio Connection Kit)

port=<name>
Connects to the ports with the given name (default: physical ports).

name=<client>
Client name that is passed to JACK (default: MPlayer [<PID>]). Useful if you want to have certain connections established automatically.
Try to change mplayer client name to something static, so ladish can(?) connect it automatically

emarsk
Established Member
Posts: 96
Joined: Wed Jul 27, 2011 3:50 pm

Re: MPlayer loses JACK connections on every track change

Post by emarsk »

If you use qjackctl, you can configure the patchbay to keep (recreate) the connections.
You can snapshot the current ones and see how it looks like; it usually does the right thing, that is it inserts wildcards where appropriate (for example, "vlc_[0-9]+"), this way you don't need to tell mplayer to have a fixed name.

Nice to know that audacious is sane :)
How difficult would be for the others to it right?
Please, avoid some common spelling errors:
http://theoatmeal.com/comics/misspelling

MountainX
Established Member
Posts: 29
Joined: Sat Aug 31, 2013 7:24 pm

Re: MPlayer loses JACK connections on every track change

Post by MountainX »

emarsk wrote:If you use qjackctl, you can configure the patchbay to keep (recreate) the connections.
You can snapshot the current ones and see how it looks like; it usually does the right thing, that is it inserts wildcards where appropriate (for example, "vlc_[0-9]+"), this way you don't need to tell mplayer to have a fixed name.
Are you saying that in my XML in the OP, I can change this:

Code: Select all

<client name="MPlayer [347]" uuid="2c7f35c9-4117-4432-9df4-11b442ca5114">
to this:

Code: Select all

<client name="MPlayer \[[0-9]+\]" uuid="2c7f35c9-4117-4432-9df4-11b442ca5114">
And it should work? If so, I will try it this evening when I get home.

MountainX
Established Member
Posts: 29
Joined: Sat Aug 31, 2013 7:24 pm

Re: MPlayer loses JACK connections on every track change

Post by MountainX »

emarsk wrote:If you use qjackctl, you can configure the patchbay to keep (recreate) the connections.
You can snapshot the current ones and see how it looks like; it usually does the right thing, that is it inserts wildcards where appropriate (for example, "vlc_[0-9]+"), this way you don't need to tell mplayer to have a fixed name.
So far I cannot get this to work. I have tried:

Code: Select all

<client name="MPlayer \[[0-9]+\]" uuid="2c7f35c9-4117-4432-9df4-11b442ca5114">
and

Code: Select all

<client name="MPlayer [.*]" uuid="2c7f35c9-4117-4432-9df4-11b442ca5114">
and other variations on regexs that I thought might work...

Suggestions? Thanks

MountainX
Established Member
Posts: 29
Joined: Sat Aug 31, 2013 7:24 pm

Re: MPlayer loses JACK connections on every track change

Post by MountainX »

lazyklimm wrote:from man mplayer:
jack audio output through JACK (Jack Audio Connection Kit)

port=<name>
Connects to the ports with the given name (default: physical ports).

name=<client>
Client name that is passed to JACK (default: MPlayer [<PID>]). Useful if you want to have certain connections established automatically.
Try to change mplayer client name to something static, so ladish can(?) connect it automatically
This works. Thanks.

In SMPlayer preferences -> Advanced -> Options for MPlayer -> Options:

Code: Select all

-ao jack:name=MPlayer_Jack
In .ladish XML config file:

Code: Select all

<jack>
<clients>
<client name="MPlayer_Jack" uuid="f7418e67-whatever">
...
</jack>
<clients>
<client name="MPlayer_Jack" uuid="5c2c722c-whatever" naming="app">
...

MountainX
Established Member
Posts: 29
Joined: Sat Aug 31, 2013 7:24 pm

Re: MPlayer loses JACK connections on every track change

Post by MountainX »

Does anyone know how to accomplish the same result for VLC? (SMPlayer is working great with JACK with the changes shown in my last post. Hope to accomplish the same with VLC now.)

lazyklimm
Established Member
Posts: 244
Joined: Tue Jul 23, 2013 4:59 pm

Re: MPlayer loses JACK connections on every track change

Post by lazyklimm »

As i can see https://wiki.videolan.org/Documentation:Modules/jack/ there's no way to set client name, but you can use something like jack-rack, make static routes from jack-rack out and run

vlc --jack-connect-regex jack-rack

Post Reply