space-wizards / RobustToolbox

Robust multiplayer game engine, used by Space Station 14
https://spacestation14.io
Other
548 stars 408 forks source link

Audio rework issues #4614

Open metalgearsloth opened 11 months ago

metalgearsloth commented 11 months ago
metalgearsloth commented 11 months ago
Uriende commented 11 months ago

So I did some digging. Quite a bit mostly trying to figure out the reason why global sounds are not playing for me. specifically it got me here https://github.com/space-wizards/RobustToolbox/blob/eb6f28cce088bc29730026789e3ba9f39d5177b7/Robust.Client/Audio/Sources/BaseAudioSource.cs#L175-L198 The moment that gain would be defined as 0 there is no way to change it from that point as priorGain / _gain would always be equal to NaN. I fixed it locally like this:

                AL.GetSource(SourceHandle, ALSourcef.Gain, out var priorGain);
                priorOcclusion = priorGain / _gain;
                if (Double.IsNaN(priorOcclusion)) {
                    priorOcclusion = 1f;
                }

But I'm less certain if that is me fixing it but missing the original bug. Figured I'll post my findings here for now

Kelrak commented 11 months ago

Ok figured out why some other sounds work while others do not. The thing that essentially makes it so gain is fixed after being set to zero is here: https://github.com/space-wizards/RobustToolbox/blob/43138669ec3d259387be3995df03385e260a1ce9/Robust.Client/Audio/AudioSystem.cs#L357 Since it is the only other place that sets the gain of the sounds without going through the Gain setter.

Global audio never reaches that point. And so does any sound that that goes through here: https://github.com/space-wizards/RobustToolbox/blob/43138669ec3d259387be3995df03385e260a1ce9/Robust.Client/Audio/AudioSystem.cs#L306-L331 I didn't understand fully what it checks but that for example leaves the hyperspace sound muted.

metalgearsloth commented 10 months ago

AFAIK it's just non-EFX platform issues and apparently MIDIs still lock contend somehow so I need to drop the update rate yet again.

Kelrak commented 10 months ago

Can you revert https://github.com/space-wizards/RobustToolbox/pull/4680 in this case? Or do you think there's a better solution?

metalgearsloth commented 10 months ago

Can you revert #4680 in this case? Or do you think there's a better solution?

0.5 isn't a good solution so I will find a better one.

Kelrak commented 10 months ago

Cool. Let me know if you want me to test anything locally

VasilisThePikachu commented 10 months ago

Just as a note InvalidValue seems to be a common issue still being spat out frequently.

https://discord.com/channels/310555209753690112/1178754439226593382/1184985536268599307 https://discord.com/channels/310555209753690112/790656972801572905/1184971583505309787

two examples of people seeing it.

me and pjb have also seen it happen

metalgearsloth commented 10 months ago

Just as a note InvalidValue seems to be a common issue still being spat out frequently.

discord.com/channels/310555209753690112/1178754439226593382/1184985536268599307 discord.com/channels/310555209753690112/790656972801572905/1184971583505309787

two examples of people seeing it.

me and pjb have also seen it happen

Anyone have steps to repro as I did not reproduce it locally despite trying mapping changes a lot.

Kelrak commented 10 months ago

I'll try to check tomorrow if I can reproduce it locally. Would it be possible to add to the error log from which sound is the error coming from? Might help.

metalgearsloth commented 10 months ago

I'll try to check tomorrow if I can reproduce it locally. Would it be possible to add to the error log from which sound is the error coming from? Might help.

It might help knowing if it's global or PVS-related, thanks.

VasilisThePikachu commented 10 months ago

Honestly no, the one time I saw it happen is when I was following an admin ghost going into an uninitialized grid. Idk if it was just going then in the background tho

All I know is that it happens in game somehow

Kelrak commented 10 months ago

Tried and failed to replicate locally. My only guess now that it's related to midis.

TemporalOroboros commented 10 months ago

Had a local instance spam Open AL errors involving NaN Gain and such at a rate of ~400/s a couple hours ago while testing an unrelated PR.

Kelrak commented 10 months ago

I made this draft figuring it might be helpful to get additional info in the logs https://github.com/space-wizards/RobustToolbox/pull/4714 since I never managed to replicate anything locally. But I'm doubtful it's the best way to do that.

Kelrak commented 10 months ago

I just noticed that most of the errors I'm seeing get replicated on replays. I wanted to see if I can debug it but I can't get the hash to match. Can anyone point me on how I can sort that out?

VasilisThePikachu commented 10 months ago

This is a known issue, all replays are broken for now. There's no known workaround or fix

metalgearsloth commented 10 months ago

I do not get the gain issue so someone who gets it needs to send me their audio settings and reproducible steps as I'm not going to spend more time investigating something I can't reproduce.

metalgearsloth commented 10 months ago

Might fix it https://github.com/space-wizards/RobustToolbox/pull/4738 but no guarantee

Kelrak commented 10 months ago

I think all the issues I have left at the moment are the crashes (Separate issue but related to audio). But I didn't figure out a good way to replicate that yet. I'll check now to see if there are any other errors I can see

Kelrak commented 10 months ago

This is what I still see now from time to time but not sure how to replicate or which sounds it relates to

[ERRO] clyde.oal: [Playing:93] AL error: -1
[ERRO] clyde.oal: [Playing:93] AL error: -1
[ERRO] clyde.oal: [Playing:93] AL error: -1
[ERRO] clyde.oal: [Gain:212] AL error: -1, Gain is 0.10 and priorOcclusion is 1.00. EFX supported: False
[ERRO] clyde.oal: [Playing:93] AL error: -1
[ERRO] clyde.oal: [Playing:93] AL error: -1
[ERRO] clyde.oal: [Playing:93] AL error: -1
[ERRO] clyde.oal: [Playing:93] AL error: -1
metalgearsloth commented 10 months ago

This is what I still see now from time to time but not sure how to replicate or which sounds it relates to

[ERRO] clyde.oal: [Playing:93] AL error: -1
[ERRO] clyde.oal: [Playing:93] AL error: -1
[ERRO] clyde.oal: [Playing:93] AL error: -1
[ERRO] clyde.oal: [Gain:212] AL error: -1, Gain is 0.10 and priorOcclusion is 1.00. EFX supported: False
[ERRO] clyde.oal: [Playing:93] AL error: -1
[ERRO] clyde.oal: [Playing:93] AL error: -1
[ERRO] clyde.oal: [Playing:93] AL error: -1
[ERRO] clyde.oal: [Playing:93] AL error: -1

Is that the first error or the last error?

Kelrak commented 10 months ago

It's mostly a spam of this without any further context from time to time. I didn't figure out why aside from it not happening locally. I saw somewhere but can't find it now that it might be related to a limit of sources that is different on OSx

Also I didn't notice any sound issues while the errors were ongoing. Aside from once that I had to restart my game to fix some sounds.

Is there a way you can think of of creating a lot of sound sources locally? To test is that's the issue?

IamVelcroboy commented 10 months ago

I get this whenever I run in Release. I just tested while walking around the arrivals station and it stops when I delete light sources. Not just lights but things like vending machines, etc

IamVelcroboy commented 10 months ago

If this helps

image image image