Repository navigation
feat: support VoiceTranscoder API 3.1 - #396
Merged
Nord1cWarr1or merged 5 commits intoNov 6, 2026
Merged
Conversation
…roadcast - sync vendored vtc_api.h with the real VTC module (2017RC5, API 3.1): MajorVersion/MinorVersion, BlockClient/UnblockClient/IsClientBlocked - cache the real minor version at init; VTC 3.0 stays supported (the minor gate is a notice now, not fatal) - new natives VTC_BlockClient/VTC_UnblockClient/VTC_IsClientBlocked with an API 3.1 guard (LogError + FALSE on older VTC) - VTC_PlaySound: allow receiver = 0 (broadcast to all clients, natively supported by VTC); receivers above maxClients are still rejected
- reapi_vtc.inc: declare VTC_BlockClient/VTC_UnblockClient/VTC_IsClientBlocked - VTC_PlaySound: document receiver 0 = all clients, gamedir-relative path and the PCM WAV requirement
4 tasks done
Running an older VTC is the server owner's choice, so announcing the minor version mismatch at startup is noise: the module works either way. Only the block natives need API 3.1, and they already log the error when a plugin actually calls them.
Conflict in reapi_vtc.inc: the docs overhaul (rehlds#395) rewrote the VTC_PlaySound block while this branch added the broadcast note there. Kept the branch's note; the file now differs from master only by the block natives and the receiver = 0 documentation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🖤
Purpose
The vendored
reapi/include/vtc_api.hhad drifted from the actual VoiceTranscoder module (2017RC5, API 3.1): 3.0-eraGet*naming, and no declarations for the block API the module has exposed since 3.1. Pawn plugins had no way to hard-block a client's voice.Approach
Header sync.
vtc_api.hreplaced with the real module header:MajorVersion()/MinorVersion()naming plus the previously missingBlockClient()/UnblockClient()/IsClientBlocked(). The vtable slot order for slots 0–9 is unchanged, so existing binaries keep working against both API 3.0 and 3.1 modules.New natives, guarded at runtime by the cached minor version — on VTC < 3.1 they log an error and return
FALSEinstead of risking a vtable overrun:native VTC_BlockClient(const index);native VTC_UnblockClient(const index);native bool:VTC_IsClientBlocked(const index);Unlike
VTC_MuteClient, which drops the voice at distribution stage (speaking events still fire),BlockClientdrops the voice packets at parse time — the player is not treated as speaking at all (Main.cpp:646vs:869).VTC_PlaySoundbroadcast. The VTC API natively treatsreceiver = 0as "play to all clients" (client = nullptrskips the per-destination filter), but the adapter rejected it viaCHECK_ISPLAYER. The check is now0..maxClients, so plugins can broadcast.Compatibility. The minor-version gate in
VTC_Api_Init()is gone entirely: VTC 3.0 modules keep working (all pre-existing natives unaffected), and only the new block natives require API ≥ 3.1 — they report the error when a plugin actually calls them, so nothing is printed at startup just because an older VTC is installed. Running an older VTC is the server owner's choice; the mechanism gates on use, not on install.Open Questions and Pre-Merge TODOs
DT_TEXTRELld warning.VTC_Block*native names — clean.API.cpp,Main.cpp); the 3.0 path is covered by the runtime guard..incin this same PR; the general docs overhaul (docs: overhaul Pawn include documentation #395) keeps only the current-behavior notes.reapi_vtc.increwritten by docs: overhaul Pawn include documentation #395 — resolved by keeping thereceiver = 0note, so the file differs from master only by the block natives and that note.Learning
Ground truth: VoiceTranscoder 2017RC5 sources (
API.cpp,Main.cpp); indices are 1-based everywhere;PlaySoundtakes a gamedir-relative PCM WAV path. A companion finding in the VTC module itself — an unboundedfgetcchunk scan inPlaySoundthat hangs on a non-WAV file — will be reported to the VTC maintainer separately.See also: #395