Jump to content

You're browsing the 2004-2023 VATSIM Forums archive. All content is preserved in a read-only fashion.
For the latest forum posts, please visit https://forum.vatsim.net.

Need to find something? Use the Google search below.

XSquawkbox / XPlane / Linux audio issues (fix ?)


Paul Robson
 Share

Recommended Posts

Paul Robson
Posted
Posted

Morning everyone. I'm a developer who is new to VATSIM.

I have had an issue with XSquawkbox connecting ; it would work maybe every other time, sometimes it would connect virtually every time, sometimes it wouldn't at all, sometimes it was either or. No errors appear on the screen or the log, it just fails to work even though it says you have voice capability and it pings (using a different output system I think)

It looks like more than one other person has had issues, so I thought I would put my fix seperately. (I do not know if the Windows problems are the same thing)

I think the problem is related to latency in pulseaudio's alsa plugin. It is described here https://juho.tykkala.fi/Pulseaudio-and-latency and I have raised it as an issue with AFV-Native here https://github.com/xsquawkbox/AFV-Native/issues/2 as my understanding is this code is used in XSquawkbox, Swift etc.

There are two ways to check it. One is to run XPlane in a terminal and try to connect. If there is a line something like "Expression 'PaAlsaStream_WaitForFrames( stream, &framesAvail, &xrun )' failed in 'src/hostapi/alsa/pa_linux_alsa.c'" this indicates this problem. Another is to see the latency by typing "pacctl list sinks | grep Latency" into a terminal, which should display the latency in us. If this is up close to 100,000 this may be the problem.

The solution is to change default-fragments and default-fragment-size-msec in /etc/pulse/daemon.conf (keep a backup copy in case it doesn't work). These are commented out by default on Arch and Ubuntu ; the values I have which seem to work reliably are 3 and 5 respectively (the defaults are 4 and 25 apparently). There doesn't appear to be any knock on effects yet. Slower machines than mine may struggle perhaps. These give a latency on my machine of about 15000us or thereabouts.

Link to comment
Share on other sites

  • 1 month later...
James Preiss
Posted
Posted (edited)

I was having the same flaky audio and the `WaitForFrames` error. I did not see high latency in my `pacctl list links | grep Latency`. I applied your suggested changes to daemon.conf anyway, and it worked. Thank you so much!!

(btw, using Ubuntu 20.04 with an external USB audio interface. I select the "pulse" device in xSquawkBox audio config.)

Edited by James Preiss
add note on system
Link to comment
Share on other sites

Paul Robson
Posted
Posted

I don't think it matters. AFAICS (Arch Linux) it runs Pulse anyway if you have it installed, it uses the Pulse alsa emulation or Pulse direct.

It might not be the latency, it's not something I'm too knowledgeable about. But if it works :)

Link to comment
Share on other sites

 Share