#include <stdio.h>
#include <stdbool.h>
#include <string.h>
int main(int argc, char *argv[])
{
char buffer[1024] = {0};
if (size < 0)
{
printf("Uh oh, error writing bundle %d.\n", size);
return 1;
}
{
buffer + size, (
cosc_int32)
sizeof(buffer) - size, &message,
-1, NULL
);
if (ret < 0)
{
printf("Uh oh, error writing message %d.\n", ret);
return 2;
size += ret;
}
}
printf("%d bytes written for the bundle.\n", size);
if (size < 0)
{
printf("Uh oh, error reading bundle %d.\n", size);
return 3;
}
printf("Bundle timestamp: %f\n", seconds + nanos / 1000000000.0);
while (size - 4 < bundle_size)
{
buffer + size, sizeof(buffer) - size, &message,
&packet_size, 0, true
);
if (ret < 0)
{
printf("Uh oh, error reading message %d.\n", ret);
return 4;
}
printf("Message was %d bytes in size, packetsize is %d.\n", ret, packet_size);
char tmps[1024];
printf("%s\n", tmps);
size += ret;
}
printf("%d bytes read for the bundle.\n", size);
return 0;
}
OSC library for C99 or C++11.
COSC_TYPE_INT32 cosc_int32
Signed 32-bit integer.
Definition cosc.h:253
COSC_API cosc_int32 cosc_write_message(void *buffer, cosc_int32 size, const struct cosc_message *message, cosc_int32 psize, cosc_int32 *value_count)
Write an OSC message.
Definition cosc.c:1923
COSC_TYPE_UINT64 cosc_uint64
Unsigned 64-bit integer.
Definition cosc.h:345
COSC_API cosc_int32 cosc_write_bundle(void *buffer, cosc_int32 size, cosc_uint64 timetag, cosc_int32 psize)
Write an OSC bundle head.
Definition cosc.c:1508
COSC_API cosc_uint32 cosc_timetag_to_time(cosc_uint64 timetag, cosc_uint32 *nanos)
Convert a timetag to seconds and nanoseconds.
Definition cosc.c:970
COSC_API cosc_uint64 cosc_time_to_timetag(cosc_uint32 seconds, cosc_uint32 nanos)
Convert time to a timetag.
Definition cosc.c:996
COSC_API cosc_int32 cosc_write_int32(void *buffer, cosc_int32 size, cosc_int32 value)
Write a 32-bit big endian signed integer.
Definition cosc.c:1147
COSC_API cosc_int32 cosc_message_dump(char *s, cosc_int32 n, const struct cosc_message *message)
Dump an OSC message to string.
Definition cosc.c:2105
COSC_API cosc_int32 cosc_read_bundle(const void *buffer, cosc_int32 size, cosc_uint64 *timetag, cosc_int32 *psize)
Read an OSC bundle head.
Definition cosc.c:1539
COSC_TYPE_UINT32 cosc_uint32
Unsigned 32-bit integer.
Definition cosc.h:248
COSC_API cosc_int32 cosc_read_message(const void *buffer, cosc_int32 size, struct cosc_message *message, cosc_int32 *psize, cosc_int32 *value_count, cosc_int32 exit_early)
Read an OSC message.
Definition cosc.c:1975
A message.
Definition cosc.h:536
cosc_int32 values_n
Write/read at most this many values.
Definition cosc.h:581
cosc_int32 address_n
When writing read at most this many bytes from the address, when reading the length excluding the zer...
Definition cosc.h:547
union cosc_message::@050073337162334015163030171201070055033256045255 values
Const safety.
const char * typetag
The typetag.
Definition cosc.h:552
const char * address
The address.
Definition cosc.h:541
const union cosc_value * write
Write values.
Definition cosc.h:569
cosc_int32 typetag_n
When writing read at most this many bytes from the typetag, when reading the length excluding the zer...
Definition cosc.h:558
A value.
Definition cosc.h:447