Jump to content
The Dark Mod Forums

A patch to fix the problem with popping audio under Linux


NagaHuntress

Recommended Posts

I've created a patch to fix the problem where audio would sometimes start popping/crackling when the game starts. And in the cosole this would be seen repeated:

snd_pcm_writei 4096 frames failed: Broken pipe

preparing audio device for output

I have a feeling that this fix is more of a kludge that works around the issue, rather than fixes it at the source. However, it does appear to work well enough to mask the problem.

Changes:
-If a call to snd_pcm_writei() returns an EPIPE error it will re-prepare the connection and then try to send the audio data again, but it will also try to send a partial duplicate. The number of frames duplicated is set by 's_alsa_underrun_extrafill'.


I've only tested it on Linux Mint 17.2, 64 bit.

 

tdm-linux-sound-fix.txt

  • Like 2
Link to comment
Share on other sites

Is there any chance this is related to #4148 do you think? That happened a lot at map start, and randomly at other times. The bug is still in the current TDM 2.03 release, but it'll be fixed in the next version.

 

The bug was in the calculation of 3d sound propagation, so only happened during play. If your bug happens on menu screens, that'd be different. What the bug does is cause the result of a division-by-zero (a NaN) to be fed into the sound card.

Link to comment
Share on other sites

Good to see somebody working on the Linux issues. I suppose the "gold standard" solution to this issue would be to add full PulseAudio support (for better or worse, PA is now the standard on Linux desktops), but obviously that would require somebody with a lot of time and familiarity with PulseAudio client development.

Link to comment
Share on other sites

  • 2 weeks later...

In the patch, the CVAR added should be some sort of integer and capped to some sabe values, like mininum 256 (or something > 0) and maximum (4096?). Otherwise a wrong setting of that variable could cause havoc.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

I forgot the specifics, but it is possible to declare CVARS as int (so nobody can set it to "4.5" or even "abc" :) and add min/max values.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Thanks again for another patch. Committed at rev 6529.

 

I can't test-compile code hidden from my MS system by compiler switches, but I'll ask grayman for the release packaging software so I can check the build works with any changes. I'm a bit clueless around OSes.

Link to comment
Share on other sites

I've figured out how to set the CVar as an integer and how to clamp it's range. I've uploaded a new patch to the bug tracker.

 

Thank you kindly. :)

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

  • 2 years later...

Thanx for your fix! Unfortunately I do not know how implement it (copy it somewhere I gues?!). Fortunately I found out that I have to switch my card to 44.1 Khz before starting the game. There're diferent ways to do that on Linux, so maybe that might help someone.

 

I use an E-MU1212m with a creative chipset and the emu10k1 driver, btw.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...