blob: e87d584832381744c7f9dfd32f752da3bdf1606a (
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
|
package messages
import "github.com/pektezol/bitreader"
type SvcSounds struct {
ReliableSound bool
Size int8
Length int16
Data []byte
}
func ParseSvcSounds(reader *bitreader.ReaderType) SvcSounds {
svcSounds := SvcSounds{
ReliableSound: reader.TryReadBool(),
}
if svcSounds.ReliableSound {
svcSounds.Size = 1
svcSounds.Length = int16(reader.TryReadBits(8))
} else {
svcSounds.Size = int8(reader.TryReadBits(8))
svcSounds.Length = int16(reader.TryReadBits(16))
}
svcSounds.Data = reader.TryReadBitsToSlice(int(svcSounds.Length))
return svcSounds
}
|