mirror of
https://github.com/jwetzell/osc-go.git
synced 2026-08-10 01:23:39 +00:00
21 lines
413 B
Go
21 lines
413 B
Go
package osc
|
|
|
|
import "encoding/binary"
|
|
|
|
func (b *OSCBundle) ToBytes() []byte {
|
|
|
|
bytes := stringToOSCBytes("#bundle")
|
|
|
|
bytes = binary.BigEndian.AppendUint64(bytes, b.TimeTag)
|
|
|
|
for _, packet := range b.Contents {
|
|
packetBytes := packet.ToBytes()
|
|
packetLength := len(packet.ToBytes())
|
|
|
|
bytes = append(bytes, int32ToOSCBytes(int32(packetLength))...)
|
|
bytes = append(bytes, packetBytes...)
|
|
}
|
|
|
|
return bytes
|
|
}
|