| 987 | SendMsg(const_cast<BYTE*>(pkt.data()), static_cast<int>(pkt.size()), msgID, NMFHighPriority); |
| 988 | }); |
| 989 | |
| 990 | SetNetTransportClientVoiceSenderId([c]() { return c; }, static_cast<uint32_t>(playerNo)); |
| 991 | |
| 992 | LOG_INFO(Network, "VoN client initialized (player={})", playerNo); |
| 993 | return true; |
| 994 | } |
| 995 | |
| 996 | bool NetClient::IsVoicePlaying(int player) |
| 997 | { |
| 998 | PumpVoiceSpeakers(); |
| 999 | auto found = _vonSpeakers.find(static_cast<uint32_t>(player)); |
| 1000 | return found != _vonSpeakers.end() && found->second && found->second->active && found->second->level > 0.001f; |
| 1001 | } |
| 1002 | |
| 1003 | bool NetClient::IsVoiceRecording() |
| 1004 | { |
| 1005 | auto* c = _vonSystem.client(); |
| 1006 | return c && c->isTransmitting(); |
| 1007 | } |
| 1008 | |
| 1009 | void NetClient::GetVoiceSpeakers(AutoArray<NetVoiceSpeakerInfo, Poseidon::Foundation::MemAllocSA>& speakers) |
| 1010 | { |
| 1011 | PumpVoiceSpeakers(); |
| 1012 | for (auto& [player, speaker] : _vonSpeakers) |
| 1013 | { |
| 1014 | if (!speaker) |
| 1015 | { |
| 1016 | continue; |
| 1017 | } |
| 1018 | NetVoiceSpeakerInfo info; |
| 1019 | info.player = static_cast<int>(player); |
| 1020 | const auto channel = _vonSpeakerChannels.find(player); |
| 1021 | info.channel = channel != _vonSpeakerChannels.end() ? static_cast<int>(channel->second) |
| 1022 | : static_cast<int>(VoNChatChannel::Global); |
| 1023 | info.active = speaker->active && speaker->level > 0.001f; |
| 1024 | info.level = speaker->level; |
| 1025 | speakers.Add(info); |
| 1026 | } |
| 1027 | } |
| 1028 | |
| 1029 | void NetClient::PumpVoiceSpeakers() |
| 1030 | { |
| 1031 | auto* c = _vonSystem.client(); |
| 1032 | if (!c) |
| 1033 | return; |
| 1034 | |
| 1035 | DWORD now = GlobalTickCount(); |
| 1036 | if (_lastVoicePumpTime != 0 && now - _lastVoicePumpTime < 15) |
| 1037 | return; |
| 1038 | _lastVoicePumpTime = now; |
| 1039 | |
| 1040 | for (auto& [ch, spk] : _vonSpeakers) |
| 1041 | { |
| 1042 | if (!spk) |
| 1043 | continue; |
| 1044 | |
| 1045 | const auto channel = _vonSpeakerChannels.find(ch); |
| 1046 | spk->setChannel(channel != _vonSpeakerChannels.end() ? channel->second : VoNChatChannel::Global); |
nothing calls this directly
no test coverage detected