UltraStar-Deluxe / USDX

The free and open source karaoke singing game UltraStar Deluxe, inspired by Sony SingStar™
https://usdx.eu
GNU General Public License v2.0
812 stars 160 forks source link

Not starting w/o jackd activated beforehand #396

Open jose1711 opened 5 years ago

jose1711 commented 5 years ago

Actual behaviour

Currently USDX only works for me if I start jackd server prior to invoking it.

Expected behaviour

I don't see jackd listed as a hard dependency for USDX so I am wondering if this is a misconfiguration on my part or a compatibility issue.

Steps to reproduce

pulseaudio is running, jackd is NOT running

$ LANG=C ultrastardx
ALSA lib pcm_dmix.c:1099:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm_dmix.c:1099:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm_dmix.c:1099:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm_dmix.c:1099:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm_dmix.c:1099:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 923
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1099:(snd_pcm_dmix_open) unable to open slave
Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 923
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
An unhandled exception occurred at $00007F13A81A23C3:
EAccessViolation: Access violation
  $00007F13A81A23C3

No luck with pasuspender either.

Details

Provide some additional information:

s09bQ5 commented 5 years ago

I'm using USDX with ALSA. No Pulseaudio, no Jack. How does this issue relate to #395? Is it a different Arch installation or did you just delete .asoundrc?

jose1711 commented 5 years ago

i disabled pulseaudio run under gdm on login so that no pulseaudio process is active now. also to be really sure pulseaudio is not started i ran chmod 0 /usr/bin/pulseaudio. in /usr/share/alsa/alsa.conf i commented the following lines:

#pcm.surround21 cards.pcm.surround21
#pcm.surround40 cards.pcm.surround40
#pcm.surround41 cards.pcm.surround41
#pcm.surround50 cards.pcm.surround50
#pcm.surround51 cards.pcm.surround51
#pcm.surround71 cards.pcm.surround71

now the log is a bit shorter but it still does not work:

$ LANG=C ultrastardx
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
An unhandled exception occurred at $00007FD23072B3C3:
EAccessViolation: Access violation
  $00007FD23072B3C3

395 is the same installation but it uses the arch-recommended way of starting jackd. specifically the following pre-start:

pacmd suspend true

and post-start commands:

pactl load-module module-jack-sink channels=2
pactl load-module module-jack-source channels=2
pacmd set-default-sink jack_out
pacmd set-default-source jack_in

the following procedure makes it possible to run:

# pulseaudio may or may not be started
jack_control start
jack_control ds alsa
jack_control dps device hw:HD0
jack_control dps rate 48000
jack_control dps nperiods 2
jack_control dps period 64
jose1711 commented 5 years ago

this is weird. as soon as i build UDX with debug (configure --enable-debug) it acts normally. same source code, same machine, really the only difference is presence of the configure switch.

GunnarDahlgren commented 4 years ago

@jose1711 thanks a lot for that piece of information. USDX ceased to work here after updating from Ubuntu 18.04 to 20.04, and I've been tearing my hair for a while. But just as you mention, building with debug enabled magically makes it work again.

jose1711 commented 4 years ago

@GunnarDahlgren thank you, it's kinda reassuring to learn that I am not the only one having the issue :-)

s09bQ5 commented 4 years ago

Your ~/.asoundrc may be empty, but distributions nowadays install lots of files in /etc/alsa/conf.d/ that get included by /usr/share/alsa/alsa.conf. One of these files usually defines a device called "jack" that connects to a local jackd.

On startup USDX checks which capture devices can be opened. That's why it tries to connect to jack. The question is why it crashes when there is no jackd.

Can you change UAudioCore_Portaudio.pas to execute the else branch of {$IF Defined(Debug) and Defined(Linux)} and build with --enable-debug so that we get a better stack trace when it crashes?

As a workaround you can also try ./configure --without-portaudio. USDX will then use SDL for capture, which will most likely ask PulseAudio for available devices. And PulseAudio will only use real hardware ALSA devices unless you explicitly configure it to use something like jackd.

jose1711 commented 4 years ago

Thanks @s09bQ5 for your suggestions. Here's the console output with --enable-debug and else branch activated:

..
ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5170:(snd_config_expand) Args evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM bluealsa
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5170:(snd_config_expand) Args evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM bluealsa
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ERROR:  Error: Audio callback is not called [TAudioCore_Portaudio.TestDevice]
ERROR:  Device "HDA Intel: ALC888 Digital (hw:0,1)" does not work [TAudioInput_Portaudio.EnumDevices]
Expression 'ret' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1811
ERROR:  Error checking format: Unanticipated host error [TAudioCore_Portaudio.TestDevice]
ERROR:  Device "samplerate" does not work [TAudioInput_Portaudio.EnumDevices]
Expression 'ret' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1811
ERROR:  Error checking format: Unanticipated host error [TAudioCore_Portaudio.TestDevice]
ERROR:  Device "speexrate" does not work [TAudioInput_Portaudio.EnumDevices]
Expression 'ret' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1735
Expression 'AlsaOpen( hostApi, parameters, streamDir, &pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1767
ERROR:  Error checking format: Device unavailable [TAudioCore_Portaudio.TestDevice]
ERROR:  Device "speex" does not work [TAudioInput_Portaudio.EnumDevices]
Expression 'ret' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1735
Expression 'AlsaOpen( hostApi, parameters, streamDir, &pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1767
ERROR:  Error checking format: Device unavailable [TAudioCore_Portaudio.TestDevice]
ERROR:  Device "upmix" does not work [TAudioInput_Portaudio.EnumDevices]
An unhandled exception occurred at $00007FAAD412E3C3:
EAccessViolation: Access violation
  $00007FAAD412E3C3

An unhandled exception occurred at $00007FAADB27AAD2:
EAccessViolation: 
  $00007FAADB27AAD2

I can also confirm that using --without-portaudio instead of --enable-debug also fixed the issue.