Fork of, triyin to rewrite for mbed 5. WIP not yet finished but working. ----------------------- An Open Sound Control library for the mbed, created to be compatible with Recotana's OSCClass library (http://recotana.com) for the Arduino with Ethernet shield. It also uses parts of the OSC Transceiver(Sender/Receiver) code by xshige written by: Alvaro Cassinelli, October 2011 tweaked by: Toby Harris / *spark audio-visual, March 2012
Diff: OSCBundle.cpp
- Revision:
- 18:3c678e1d5a84
- Parent:
- 16:36d28d8e5491
- Child:
- 19:35408d190f4e
--- a/OSCBundle.cpp Fri Dec 14 19:47:55 2018 +0100 +++ b/OSCBundle.cpp Fri Dec 14 20:51:12 2018 +0100 @@ -209,15 +209,23 @@ //write the bundle header static const uint8_t header[] = {'#', 'b', 'u', 'n', 'd', 'l', 'e', 0}; strcat(buff, (char *)header); + lengthEnd=strlen(buff); + // p.write(header, 8); //write the timetag { osctime_t time = timetag; uint32_t d = BigEndian(time.seconds); uint8_t * ptr = (uint8_t *) &d; + for(int i = 0; i < 4; i++){ + buff[lengthEnd++]=ptr[i]; + } // p.write(ptr, 4); d = BigEndian(time.fractionofseconds); ptr = (uint8_t *) &d; + for(int i = 0; i < 4; i++){ + buff[lengthEnd++]=ptr[i]; + } // p.write(ptr, 4); } @@ -229,9 +237,14 @@ uint32_t s32 = BigEndian((uint32_t) msgSize); uint8_t * sptr = (uint8_t *) &s32; //write the messsage size + for(int i = 0; i < 4; i++){ + buff[lengthEnd++]=sptr[i]; + } + // p.write(sptr, 4); msg->send(p, host, port); } + p.sendto(host, port, buff, lengthEnd); return *this; }