JACoders/OpenJK

OpenJK SP interacting with UI/menu breaks sound

Closed this issue · 6 comments

Reporting a bug? Please make sure you've given the following information - thanks!

Operating system and version:

Windows 11 23H2 build 22631.3155 x64

Is this for single player or multiplayer?

Singleplayer

Description of the bug (and if possible, steps to reproduce the bug):

Interacting with game menus breaks sound in SP. Clicking or just hovering over the menu button cuts the sound and ingame dialogue. Easiest way to reproduce is to hit tab while on a mission. Also, mission briefings hovering over the next button while Kyle or Luke goes over the mission the sound breaks. Also the weapon selection and force upgrade screens. Or saving the game, hovering and clicking the menu buttons the sound cuts off. Also character creation screen. It's only briefly but it can be very jarring. It doesn't happen in MP.

EAX is turned off as it's disabled by default, it's not even an option in the x64 build.

What did you expect to happen instead?
Sound is continuous without cutting itself or breaking. If you only play multiplayer it's not affected and you won't notice the bug. Older versions in the old openJK build site work fine.

Today I downloaded and installed OBS, I recorded a short video clip demonstrating this issue.

If you're interested in seeing it. just tell me, I'll upload to youtube. I also recorded the multiplayer bot issue.

Wonder if this is caused by newer SDL and certain OS and hardware configurations depending on the backend used.

This commit and possibly others could be related

etlegacy/etlegacy@beb4f92

LOL "Setting lower sample count improves audio latency, at the cost of potentially introducing audio issues, such as cracking."

My PC is 6 cores 6 threads, 32GB RAM with integrated Intel graphics. Theoretically I shouldn't experience this.

Could my PC be TOO FAST???

I found part of the cause of this issue but not sure the exact reason why its doing this.

When you turn developer on you can see that it is spamming trying to load font:
Can't find fonts/arialnb_sharp1.fontdat

cc @Daggolin

Related to PR #1184 / 97c7291

Also seems to only affect SP, not MP.

Upon further analysis, it seems related to Item_Paint -> (a text item with keyword descText) triggers 2 calls to MenuFontToReal(4) which polls UI_RegisterFont 2x per frame of rendering each object in the menu that has the descText when hovering over them.

Seems the intention is to use 4 == smallFont2 which is arialnb however smallFont2 is not referenced in SP menu registration code like it is in MP.

Actually, if you look at vanilla jasp main.menu there is:

		smallFont				"aurabesh" 	18	
		mediumFont				"ergoec" 	18
		bigFont					"anewhope" 	20
		smallFont				"arialnb" 	14	

So I'm not sure which one is really referenced in the menu parser.

I found part of the cause of this issue but not sure the exact reason why its doing this.

When you turn developer on you can see that it is spamming trying to load font: Can't find fonts/arialnb_sharp1.fontdat

cc @Daggolin

Related to PR #1184 / 97c7291

Also seems to only affect SP, not MP.

Upon further analysis, it seems related to Item_Paint -> (a text item with keyword descText) triggers 2 calls to MenuFontToReal(4) which polls UI_RegisterFont 2x per frame of rendering each object in the menu that has the descText when hovering over them.

Seems the intention is to use 4 == smallFont2 which is arialnb however smallFont2 is not referenced in SP menu registration code like it is in MP.

Actually, if you look at vanilla jasp main.menu there is:

		smallFont				"aurabesh" 	18	
		mediumFont				"ergoec" 	18
		bigFont					"anewhope" 	20
		smallFont				"arialnb" 	14	

So I'm not sure which one is really referenced in the menu parser.

#1221
Have just opened this PR that seems related.