Houston4444 / RaySession

Session manager for linux musical programs
GNU General Public License v2.0
150 stars 18 forks source link

MPD issues #222

Closed Apep-the-snek closed 4 months ago

Apep-the-snek commented 5 months ago

I cannot launch MPD inside of RaySession it seems, i can start it manually outside of raysession so that it appears inside raysession, however i want to have it connected to a certain program (PD - Pure Data), once i play a sound file using MPD, the outputs of MPD appear inside raysession, it automatically connects to the input of my headset, i can disconnect it from there and connect it to the desired PD inputs, and it works fine as long as i don't pause or play another file.

i have set the option always_on to "yes" under audio_output in mpd.conf, so it should just stay connected to PD, but it doesn't, randomly it works, randomly it disconnects from PD and connects to the input of my headset, randomly a new song stops at 0:00, randomly it disconnects from PD and connects to my headset inputs and stops at 0:00, and randomly it does the former and i can no longer play anything unless i restart MPD.

i have tried to ask a lot about this in the MPD IRC channel, and i haven't solved it yet, as it seems like a RaySession or pipewire problem.

Apep-the-snek commented 5 months ago

update: it works fine now after i saved the patchbay, except for the fact that sometimes when i play a file, it connects to my headset input, but doesn't disconnect from PD, still not desirable at all. oh and it is still sometimes stuck at 0:00 which is probably a MPD issue. all previous issues still occur, just not disconnecting from PD.

Apep-the-snek commented 5 months ago

update: it does disconnect from PD, it just reconnect automatically creating a delay at the start...

Weirdly, the issues does not seem to happen with video files i have downloaded with yt-dlp, but it does occur with soundfiles i have downloaded elsewhere it seems....

Houston4444 commented 5 months ago

Hi.

Working with JACK (or Pipewire in the jack way) with programs that create JACK clients on demand (starting the JACK client when you start to play a file) is always problematic. That is for example the case for Audacity or VLC if they are configured to use JACK. Personally, if I use one of theses programs, I configure them to use PulseAudio, more exactly I do nothing, because it's the default choice (I still don't use Pipewire for the moment).

With JACK, you can prevent a program to automatically connect its outputs to the main outputs (engine parameter -> self-connect-mode), this option certainly exists in pipewire too. If you can set this option, then mpd should never connect its outputs to the main outputs (your headphones).

ray-jackpatch (JACK connections) in RaySession can remember and recall the connections, so it reconnects here MPD to PD, but it does it slowly, and it is voluntary. If it was too fast, problems could appear in programs trying to make connections already done by ray-jackpatch. The delay probably comes from this.

I have no solution using PipeWire, I don't say it's impossible, solutions may exist to have a fixed client, but I don't know them. However, With JACK + PulseAudio, it's possible to run several PulseAudio bridges (which for PulseAudio clients are simply devices), configure the programs to use the wanted bridge, and connect the bridge output to the desired input in the JACK patchbay.

Apep-the-snek commented 4 months ago

sorry, i know this isn't the place, but i tried to get knowledge on how destination_ports work in MPD under jack, but got no response, been waiting 4 days: https://github.com/MusicPlayerDaemon/MPD/issues/1988 do you have an answer? as i said in that issue i linked, i have looked for documentation pretty much everywhere, i couldn't find it, i also asked on IRC, and got no response. also i can't seem to find the option for self connect-mode or engine parameter in raysession jack_control, sorry. i'm using pure Jack right now as it works with most things, except for MPD for my usecase.

Apep-the-snek commented 4 months ago

someone just clarified it was a jack issue on IRC now that i asked again, sorry to bother you, i think i'll be able to figure this out.

Apep-the-snek commented 4 months ago

I found a fix to my problem, i installed jack-matchmaker, it helped me find the input ports for pure data that i needed using option -c: destination_ports "pure_data:input_3,pure_data:input_4" would be input_1 and 2 if you are using the default first two ports.