demostf / parser

Parsing of tf2 demo files
54 stars 17 forks source link

Rename VoiceInit extra_data to sampling_rate #1

Closed dalegaard closed 4 years ago

dalegaard commented 4 years ago

When quality is 255, an extra field is included in the VoiceInit message. This field is the sampling rate for the voice codec selected. This commit simply renames that field from extra_data as it is currently known.

Interestingly, this field is present, but doesn't match when CELT HQ is used. If sv_voicecodec = vaudio_celt_high on the server, the sampling rate is still specified as 22050 Hz(as for CELT non-HQ) rather than the expected 44100 Hz. The client code will instead look for vaudio_celt and vaudio_celt_high as codec name, and use these to to index a lookup table that specifies the correct sampling rate and frame size. For vaudio_celt 22050 Hz with 512 samples per frame is used, while vaudio_celt_high uses 44100 Hz with 1024 samples per frame.

icewind1991 commented 4 years ago

Thanks!