mirror of
https://github.com/jwetzell/osc-go.git
synced 2026-08-17 20:43:58 +00:00
bundle encoding
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user