tim-janik / beast

Beast - Music Synthesizer and Composer
GNU Lesser General Public License v2.1
84 stars 12 forks source link

No sound without -p alsa=pulse #119

Closed swesterfeld closed 2 years ago

swesterfeld commented 5 years ago

BEAST for a very long time now refused to produce audio out of the box without the command line args -p alsa=pulse - I am using (setup by Cadence)

Problems have been reported by other users (https://github.com/tim-janik/beast/issues/92 https://github.com/tim-janik/beast/issues/80). Since the new Electron UI doesn't have command line args, the workaround cannot be used there, so the new UI has no sound.

In order to make this work out-of-the-box: why does the workaround work, whereas auto-detected audio output fails?

First of all, it doesn't matter if you use -p alsa=default or -p alsa=pulse. The default device is pulse. So this is the first device the ALSA driver tries to open during auto detect. But open fails during auto detect. The reason here is that during auto detect, BEAST tries to open the default device in full duplex mode. Why doesn't this work?

Using printf()s in the alsa pcm driver, I found that although read_handle and write_handle can be opened for pulse, the following fails

   if (error == 0 && alsa->read_handle && alsa->write_handle &&
       snd_pcm_link (alsa->read_handle, alsa->write_handle) < 0)
     error = Bse::Error::DEVICES_MISMATCH;

This was observed already here: https://github.com/tim-janik/beast/issues/80#issuecomment-421115474

In any case, the auto detection will try all available devices in duplex mode, and settle for some audio device that I don't use - instead of the default device - like for instance onboard audio which is not connected.

If I on the other hand specify -p alsa=pulse, BEAST will try to open the audio output in duplex mode, and fail. Then it will try to open pulseaudio in output-only mode, and succeed.

Some ideas how to make it work out-of-the-box:

tim-janik commented 2 years ago

Beast development is continued in Anklang which has Jack support. If you think snd_pcm_link errors should be ignored during auto detection, please make a case there.