hydrogen-music / hydrogen

The advanced drum machine for Linux, macOS, and Windows
http://www.hydrogen-music.org
GNU General Public License v2.0
1.05k stars 173 forks source link

connection to audio driver/jack closes when opening new song #695

Open nathanaelmeister opened 5 years ago

nathanaelmeister commented 5 years ago

Hydrogen version * : 0.9.7 Operating system + version : Debian GNU/Linux buster/sid Audio driver + version : jackdmp version 1.9.12


every time time I start the open-window to open a new song, the connection to the audio-driver (jack) gets closed.

kind regards :-) bildschirmfoto von 2019-02-03 09-38-32

theGreatWhiteShark commented 5 years ago

This seems to be a JACK-related error since this message is shown when the JACK server informs its clients about its intent to shutdown. Does this happen with other audio programs too?

Can you tell which options/command you used to start up the JACK server?

nathanaelmeister commented 5 years ago

jackd -P 10 -d alsa hw:S6USB20 -X raw -C hw:S6USB20 -P hw:S6USB20 is the command I use most frequently if I do not use qjackctl. When I only work with hydrogen I let hydrogen start jack on its own. It uses to happen in all three scenarios. I never experienced this problem with other applications like qTraktor, Seq24 or Ardour5. With hydrogen it only happens when I open the open-song dialog ctr+o.

Audio Preferences Hydrogen: bildschirmfoto vom 2019-02-05 02-23-59

Preferences Qjackctl: bildschirmfoto vom 2019-02-05 02-23-07

theGreatWhiteShark commented 5 years ago

Unfortunately I can not reproduce this bug. Have you tried using a more recent Hydrogen version compiled from source?

trebmuh commented 5 years ago

I can't reproduce as well (using a fresh build from git master head (https://github.com/hydrogen-music/hydrogen/commit/bbeaed1a5d46414360cbce74e81fbcc0a05e26f6) running on a Debian Stretch / LibraZiK-2 system)

lbriais commented 5 years ago

I have the same problem (same Hydrogen version on Ubuntu 18.04 up to date). All applications are working fine with jackd (ardour, audacity, gucview etc...), but Hydrogen has a very strange behaviour.

I didn't spot any clear pattern apart from the open-song dialog which the same message as mentioned, but only the first time this dialog is opened. It often happens as well when simply starting Hydrogen.

Symptom is that Hydrogen is disconnected from jackd outputs, but simply reconnecting or restarting Hydrogen is not enough and outputs some errors in the jackd logs:

Wed Aug  7 16:00:53 2019: New client 'Hydrogen' with PID 4977
Wed Aug  7 16:00:53 2019: ERROR: Unknown destination port in attempted (dis)connection src_name [Hydrogen:out_L] dst_name [alsa_pcm:playback_1]
Wed Aug  7 16:00:53 2019: Connecting 'Hydrogen:out_L' to 'system:playback_1'
Wed Aug  7 16:00:53 2019: Connecting 'Hydrogen:out_R' to 'system:playback_2'

Nevertheless sometimes I am able to recover from this situation through a combination of re-opening the song and clicking in the preference-dialog / audio system on "restart output" (sorry my system is in French and I do not know the exact label in English...). I say sometimes because it doesn't work all the time... Sometimes I have to first close Hydrogen.

This is happening for quite a while. So I completely stopped using Hydrogen because of that, but as I forgot why I didn't use it I retried recently and the problem is still there. In the past I never had any issue with it...

lbriais commented 5 years ago

By the way when it happens and when I get the message that the server is shutdown it is actually wrong as all other programs running keep on working and the jack server itself has no issue... Only Hydrogen is impacted.

trebmuh commented 5 years ago

(sorry my system is in French and I do not know the exact label in English...)

Pour info, tu peux démarrer Hydrogen en anglais à partir d'un terminal avec : LANG=C hydrogen

theGreatWhiteShark commented 5 years ago

Ah, I see.

I didn't spot any clear pattern apart from the open-song dialog which the same message as mentioned, but only the first time this dialog is opened. It often happens as well when simply starting Hydrogen.

At this point Hydrogen is trying to register a to the JACK server as a client (which works properly according to your log messages) and to connect its output ports to the system's default. Most probably the latter causes the issue . Especially if only Hydrogen is affected.

Can you try unchecking the option that Hydrogen should automatically connect to the default output and retry?

Also can you run the jack_lsp command (or take a look at the qjackctl Connections window) and check whether the names of the system's default port does change during different sessions (maybe startups).

lbriais commented 5 years ago

The system default ports are always named the same. Unchecking the auto-connect option doesn't solve the issue. Because when after trying to open a song even with the auto-connect option unchecked I get the following when trying to manually connect Hydrogen output to a system output:

10:25:51.398 Changement des connexions JACK.
10:25:51.435 Changement du graphique des connexions JACK.
Fri Aug  9 10:25:51 2019: ERROR: Cannot connect ports owned by inactive clients: "Hydrogen" is not active

But as previously if I restart the output driver then I can connect normally...

trebmuh commented 5 years ago

@lbriais how did you start jack? (Cadence? QjackCtl? CLI? other?)

lbriais commented 5 years ago

QJackCtl

theGreatWhiteShark commented 5 years ago

Could you start up Hydrogen using hydrogen -VDebug and post its output in here? Maybe this gives us some more hints on what's going wrong.

trebmuh commented 5 years ago

try with starting jackd from the command line (in order to disqualify a potential qjackctl bug)

lbriais commented 5 years ago

Looking for a way to attach the log file. The generated file is about 640kb and few kb zipped but github doesn't let me attach neither the text nor the zipped version...

lbriais commented 5 years ago

Ok, created a gist

Here it is.

lbriais commented 5 years ago

@trebmuh I started jackd using the command in ~/.jackdrc as generated by qjackctl:

/usr/bin/jackd -r -m -dalsa -r44100 -p1024 -n2 -m -H -M -D -Chw:U24XL -Phw:PCH

I get exactly the same behavior...

theGreatWhiteShark commented 5 years ago

Okay. So, Hydrogen is not able to read your configurations properly and both the song and the drumkit are created using a much older version of Hydrogen (thus reading does only work in legacy mode).

Could you provide your /usr/share/hydrogen/data/hydrogen.default.conf file and the song you used? Maybe using those ingredients we are able to reproduce this issue.

martinosborne commented 4 years ago

I can reproduce this error:

Hydrogen version * : 0.9.7 or higher Operating system + version : Ubuntu 16.04 (4.4.0-170-lowlatency num199-Ubuntu SMP PREEMPT Thu Nov 14 02:18:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux) Audio driver + version : jackd version 1.9.12 Echo Layla3G Audio/Midi Interface


It happens consistently with first use of Project -> Open song, Project -> Save As. Project -> Export Pattern As, etc....

Untitled

No other connected applications (Ardour, Yoshimi, SetBFree etc) are affected and jackd does not stop running although the Hydrogen connections become unresponsive.

When I click "Restart Output" in Tools->Preferences->Audio System, everything is fine and is a viable (but a little annoying) workaround. The error only occurs in hydrogen and only before "Restart Output" is clicked.

I am using an aging Echo Layla3G Audio/Midi Interface.Though its old it otherwise plays well with the system.

This is the jackd startup command:

/usr/bin/jackd -dalsa -r48000 -p128 -n2 -Xraw -D -Chw:Layla3G -Phw:Layla3G

I can repeat the bug consistently in 0.9.7.

I have also debugged the application in qtcreator using the latest git clone. Unfortunately my C++ is very rusty but I did get it to build and debug successfully.

The error occurs somewhere between clicking the menu item and hitting the break-point on the first line of the function: (MainForm::action_file_open() line 710)

This is the messages from qjackctl : (Note, there are many hundreds of the Process Error commands generated:

Starting up:

Tue Jan  7 23:03:53 2020: New client 'qjackctl' with PID 26997
23:04:49.236 JACK connection graph change.
23:04:49.390 JACK connection change.
Tue Jan  7 23:04:49 2020: New client 'Hydrogen' with PID 27068
Tue Jan  7 23:04:49 2020: New client 'hydrogen-midi' with PID 27068

This when the error is thrown:

23:05:15.570 JACK connection graph change.
Tue Jan  7 23:05:15 2020: ERROR: JackAudioDriver::ProcessGraphAsyncMaster: Process error
Tue Jan  7 23:05:15 2020: ERROR: JackAudioDriver::ProcessGraphAsyncMaster: Process error

The hydrogen application output is:

SuspendRefNum error
JackClient::Execute error name = Hydrogen

This is the contents of /usr/share/hydrogen/data/hydrogen.default.conf

hydrogen.default.conf.txt

theGreatWhiteShark commented 4 years ago

Unfortunately, I can not reproduce the issue (even using your configuration file). Does is still appear with the latest version of H2 and a fresh download of any drumkit?

martinosborne commented 4 years ago

I tried downloading a new kit running from the head of the master branch and the issue is still occurring. In fact, the issue also occurs when importing a new drum kit. It looks like it is triggered any time the file browser dialog is invoked.