Open ruby0b opened 7 months ago
Nice to see you working on that. Together with my UI rework, the 0.14.0 update will feature quite a lot of voice chat improvements!
Voice chat toggle keybinding (upstreaming https://github.com/ruby0b/ttt2-voice-chat-toggle)
What's the general consensus on this? Should this really be a secondary keybind? Or a setting in the client voice setting where you can switch between different modes like "push to talk", "push to mute", "toggle" and "voice activation"?
IMHO we don't need a new keybind for this. It could use the already existing one. We should also make sure that the global voicechat is automatically muted as soon as the team voice chat is engaged.
I agree that it's probably unnecessary to introduce another keybind, we should just use a dropdown for the different options. Toggle and voice activation would be the same thing though because as far as I can tell the voice chat always uses some built-in threshold, right?
I found it a bit difficult to wrap my head around how team chat should work when using anything other than push-to-talk, so I made some diagrams. I guess for toggle it would be like this (G = global voice chat key, T = team voice chat key):
Push to mute seems a little more confusing since pressing the key is supposed to mute you. But I guess it could work like this, where you switch voice chat by pressing and then releasing the key:
as far as I can tell the voice chat always uses some built-in threshold, right?
Yes, but you still have to press a key to start talking. I'd like to add an option to use voice without. Maybe it doesn't work like I thought, then I'll scrap that idea.
About your other question: I thought these fancy voice modes are only relevant for global voice chat. I think team voice can always be push to talk, this would make it so much simpler. No matter what mode you are in, as soon as the team chat key is pressed, the global voice is muted.
Makes sense, there's probably no reason to use anything other than push-to-talk for team voice. Would releasing the team voice key always put you back to being muted or would it be "smart" and put you back into the global voice state you had previously? (The former would probably be simpler to implement)
About having to press the toggle to start talking: I think you essentially want the game to automatically press the toggle bind once whenever you join, right? So something like this line that I'm using in my addon:
hook.Add("InitPostEntity", "voice_toggle/AutoEnableVoiceChat",
function() if cv_auto_enable:GetBool() then voice_enable() end end)
I would probably call that mode "Toggle (on by default)" or something like that (and maybe call the regular toggle "Toggle (off by default)"?). Could also just be a sub-option that's greyed out if you're not using toggle (if it's possible to conditionally grey out options).
or would it be "smart" and put you back into the global voice state you had previously?
Depends on the mode: If it was in toggle mode and previously enabled, it should return to being enabled. If it was in push to talk and the global talk key is no longer pressed, it should be disabled. And so on.
The rest looks good to me, but imho such details can be discussed later on
@ruby0b You seem to be more knowledgeable than me with this topic. Does your #1503 address the issue described in #1482? To me it seems like it is only possible to cut off the voice chat range, not to extend it
The way I understand it, 3D sound is very much baked into gmod itself and it sadly exposes no way to configure it besides turning it on and off in the PlayerCanHearPlayers hook. This 3D sound does not seem to have any cutoff, instead just getting very quiet at long distances, so technically the range is infinite by default! Cutting the voice range short in the way I've done in #1503 was fairly simple but is of course not that clean since now the volume is not a continuous function that approaches 0 as the speaker is nearing the range cutoff but rather we just have a hard drop to 0 once the speaker goes out of range.
Of course we do have ways to modify the audio output of each player and so we could downscale the volume accordingly with our cut-off point (which I think is what @EntranceJew is proposing in #1482). I'm not sure if we can increase the volume of far away players this way since we can't upscale player volumes afaik, would have to check.
At the end of the day there's always the option of manually processing incoming voice data from clients and writing an entirely custom 3d voice implementation on the server which would solve all of these issues but that would obviously be non-trivial and can probably not be done in pure lua :)
Thanks for that insight, I'll relay that information to that issue
I forgot where we had this discussion, but the voice UI now supports team changes, the change was rather easy: https://github.com/TTT-2/TTT2/pull/1473/commits/86881f47e71e6a57c363371cb9ce746a7b063b02
Updated the milestone to give you more time to finish the last todo on your list.
Planning to implement most of these myself as mentioned on the Discord, just putting a cleaned up list here to keep track / discuss:
Server-side:
Client-side: