blob: cc155e5006e7a7343fb4c1cfbe0c7a0452955edf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package messages
import (
"github.com/pektezol/bitreader"
"github.com/pektezol/sdp.go/pkg/types"
)
type SvcSounds struct {
ReliableSound bool `json:"reliable_sound"`
SoundCount uint8 `json:"sound_count"`
Length uint16 `json:"length"`
Data []byte `json:"data"`
}
func ParseSvcSounds(reader *bitreader.Reader, demo *types.Demo) SvcSounds {
svcSounds := SvcSounds{
ReliableSound: reader.TryReadBool(),
}
if svcSounds.ReliableSound {
svcSounds.SoundCount = 1
svcSounds.Length = uint16(reader.TryReadUInt8())
} else {
svcSounds.SoundCount = reader.TryReadUInt8()
svcSounds.Length = reader.TryReadUInt16()
}
svcSounds.Data = reader.TryReadBitsToSlice(uint64(svcSounds.Length))
demo.Writer.TempAppendLine("\t\tReliable Sound: %t", svcSounds.ReliableSound)
demo.Writer.TempAppendLine("\t\tSound Count: %d", svcSounds.SoundCount)
demo.Writer.TempAppendLine("\t\tData: %v", svcSounds.Data)
return svcSounds
}
|