diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-09-17 18:24:18 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-09-20 11:10:20 +0300 |
| commit | 6aa511f2ae3d5c84e7db02627ffd4d7f6796ce75 (patch) | |
| tree | e925740a5c04b1c5c44e725dab04f9b1833cf9e3 /pkg/messages/types/svcVoiceInit.go | |
| parent | parse netSignOnState flags (diff) | |
| download | sdp.go-6aa511f2ae3d5c84e7db02627ffd4d7f6796ce75.tar.gz sdp.go-6aa511f2ae3d5c84e7db02627ffd4d7f6796ce75.tar.bz2 sdp.go-6aa511f2ae3d5c84e7db02627ffd4d7f6796ce75.zip | |
decide what message types are left
Diffstat (limited to 'pkg/messages/types/svcVoiceInit.go')
| -rw-r--r-- | pkg/messages/types/svcVoiceInit.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/pkg/messages/types/svcVoiceInit.go b/pkg/messages/types/svcVoiceInit.go index afabfc9..a6d711a 100644 --- a/pkg/messages/types/svcVoiceInit.go +++ b/pkg/messages/types/svcVoiceInit.go | |||
| @@ -3,18 +3,24 @@ package messages | |||
| 3 | import "github.com/pektezol/bitreader" | 3 | import "github.com/pektezol/bitreader" |
| 4 | 4 | ||
| 5 | type SvcVoiceInit struct { | 5 | type SvcVoiceInit struct { |
| 6 | Codec string | 6 | Codec string |
| 7 | Quality uint8 | 7 | Quality uint8 |
| 8 | Unk float32 | 8 | SampleRate int32 |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | func ParseSvcVoiceInit(reader *bitreader.Reader) SvcVoiceInit { | 11 | func ParseSvcVoiceInit(reader *bitreader.Reader) SvcVoiceInit { |
| 12 | svcVoiceInit := SvcVoiceInit{ | 12 | svcVoiceInit := SvcVoiceInit{ |
| 13 | Codec: reader.TryReadString(), | 13 | Codec: reader.TryReadString(), |
| 14 | Quality: uint8(reader.TryReadBits(8)), | 14 | Quality: reader.TryReadUInt8(), |
| 15 | } | 15 | } |
| 16 | if svcVoiceInit.Quality == 0b11111111 { | 16 | if svcVoiceInit.Quality == 0b11111111 { |
| 17 | svcVoiceInit.Unk = reader.TryReadFloat32() | 17 | svcVoiceInit.SampleRate = reader.TryReadSInt32() |
| 18 | } else { | ||
| 19 | if svcVoiceInit.Codec == "vaudio_celt" { | ||
| 20 | svcVoiceInit.SampleRate = 22050 | ||
| 21 | } else { | ||
| 22 | svcVoiceInit.SampleRate = 11025 | ||
| 23 | } | ||
| 18 | } | 24 | } |
| 19 | return svcVoiceInit | 25 | return svcVoiceInit |
| 20 | } | 26 | } |