|
cosc 0.1.0
OSC library for C99 or C++11.
|
OSC library for C99 or C++11. More...
#include <stdint.h>Go to the source code of this file.
Classes | |
| struct | cosc_64bits |
| Used when 64-bit types are not available. More... | |
| union | cosc_value |
| A value. More... | |
| struct | cosc_message |
| A message. More... | |
| struct | cosc_level |
| Used to manage the levels of a serial. More... | |
| struct | cosc_serial |
| A serial. More... | |
Macros | |
| #define | COSC_API |
| Used to declare linkage for functions. | |
| #define | COSC_TYPE_INT32 int32_t |
| Used to typedef cosc_int32. | |
| #define | COSC_TYPE_UINT32 uint32_t |
| Used to typedef cosc_uint32. | |
| #define | COSC_TYPE_INT64 int64_t |
| Used to typedef cosc_int64. | |
| #define | COSC_TYPE_UINT64 uint64_t |
| Used to typedef cosc_uint64. | |
| #define | COSC_TYPE_FLOAT32 float |
| Used to typedef cosc_float32. | |
| #define | COSC_TYPE_FLOAT64 double |
| Used to typedef cosc_float64. | |
| #define | COSC_INT32MAX 2147483647 |
| Maximum value of a signed 32-bit integer. | |
| #define | COSC_INT32MIN ((-2147483647)-1) |
| Minimum value of a signed 32-bit integer. | |
| #define | COSC_UINT32MAX 4294967295 |
| Minimum value of an unsigned 32-bit integer. | |
| #define | COSC_INT64MAX 9223372036854775807LL |
| Maximum value of a signed 64-bit integer. | |
| #define | COSC_INT64MIN ((-9223372036854775807LL)-1) |
| Minimum value of a signed 64-bit integer. | |
| #define | COSC_UINT64MAX 18446744073709551615ULL |
| Minimum value of an unsigned 32-bit integer. | |
| #define | COSC_64BITS_INIT(hi_, lo_) |
| Helper initializer when defining cosc_64bits structs. | |
| #define | COSC_64BITS_SET(bits_, hi_, lo_) |
| Helper to set the members of a cosc_64bits struct. | |
| #define | COSC_64BITS_HI(bits_) |
| Helper to access the high member of a cosc_64bits struct. | |
| #define | COSC_64BITS_LO(bits_) |
| Helper to access the low member of a cosc_64bits struct. | |
| #define | COSC_INT64_INIT_ZERO 0 |
| Initializer cosc_int64 or cosc_uint64 as zero. | |
| #define | COSC_INT64_SET_ZERO(ptr) |
| Set cosc_int64 or cosc_uint64 as zero. | |
| #define | COSC_FLOAT64_INIT_ZERO 0 |
| Initializer cosc_float64 or cosc_ufloat64 as zero. | |
| #define | COSC_FLOAT64_SET_ZERO(ptr) |
| Set cosc_float64 or cosc_ufloat64 as zero. | |
| #define | COSC_SIZE_MAX 2147483644 |
| The maximum 4 byte aligned size that fits in a signed 32-bit integer. | |
| #define | COSC_PADMUST(sz) |
| Get the required zero pad size for strings that require a zero terminator and 4 byte alignment. | |
| #define | COSC_PAD(sz) |
| Get the required zero pad size for 4 byte alignment. | |
| #define | COSC_LEVEL_TYPE_BUNDLE 'B' |
| The level type is a bundle. | |
| #define | COSC_LEVEL_TYPE_MESSAGE 'M' |
| The level type is a message. | |
| #define | COSC_LEVEL_TYPE_BLOB 'b' |
| The level type is a blob. | |
| #define | COSC_SERIAL_PSIZE 1 |
| Tell the serial that the first bundle or message is prefixed with a packet size. | |
| #define | COSC_EOVERRUN -2 |
| Buffer overrun. | |
| #define | COSC_ESIZEMAX -3 |
| Size exceeds COSC_SIZE_MAX. | |
| #define | COSC_ETYPE -4 |
| Invalid type. | |
| #define | COSC_EPSIZE -5 |
| Invalid packet size. | |
| #define | COSC_EINVAL -6 |
| Invalid argument or operation. | |
| #define | COSC_ELEVELMAX -7 |
| Writer or reader reached maximum level. | |
| #define | COSC_ELEVELTYPE -8 |
| Invalid operation for the current level type. | |
| #define | COSC_EPSIZEFLAG -9 |
| Trying to chain multiple bundles or messages without packet size flag. | |
| #define | COSC_EMSGTYPE -10 |
| Trying to write or read a message member of the wrong or invalid type. | |
| #define | COSC_SERIAL_ISWRITER(serial_) |
| Macro to check if a serial is a writer. | |
| #define | COSC_SERIAL_ISREADER(serial_) |
| Macro to check if a serial is a reader. | |
Typedefs | |
| typedef COSC_TYPE_UINT32 | cosc_uint32 |
| Unsigned 32-bit integer. | |
| typedef COSC_TYPE_INT32 | cosc_int32 |
| Signed 32-bit integer. | |
| typedef COSC_TYPE_INT64 | cosc_int64 |
| Signed 64-bit integer. | |
| typedef COSC_TYPE_UINT64 | cosc_uint64 |
| Unsigned 64-bit integer. | |
| typedef COSC_TYPE_FLOAT32 | cosc_float32 |
| 32-bit floating point. | |
| typedef COSC_TYPE_FLOAT64 | cosc_float64 |
| 64-bit floating point. | |
Functions | |
| COSC_API cosc_int32 | cosc_feature_int64 (void) |
| Feature test for 64-bit integer support. | |
| COSC_API cosc_int32 | cosc_feature_float32 (void) |
| Feature test for 32-bit float support. | |
| COSC_API cosc_int32 | cosc_feature_float64 (void) |
| Feature test for 64-bit float support. | |
| COSC_API cosc_int32 | cosc_feature_swap (void) |
| Feature test for endian swapping. | |
| COSC_API cosc_int32 | cosc_feature_array (void) |
| Feature test for array support. | |
| COSC_API cosc_int32 | cosc_feature_pattern (void) |
| Feature test for pattern support. | |
| COSC_API cosc_int32 | cosc_feature_timetag (void) |
| Feature test for timetag conversion support. | |
| COSC_API cosc_int32 | cosc_feature_fltconv (void) |
| Feature test for float conversion support. | |
| COSC_API cosc_int32 | cosc_feature_writer (void) |
| Feature test for writer support. | |
| COSC_API cosc_int32 | cosc_feature_reader (void) |
| Feature test for reader support. | |
| COSC_API cosc_int32 | cosc_big_endian (void) |
| If big endian was detected when building this function returns non-zero, otherwise zero. | |
| COSC_API cosc_int32 | cosc_address_char_validate (cosc_int32 c) |
| Check if an address character is valid. | |
| COSC_API cosc_int32 | cosc_address_validate (const char *address, cosc_int32 address_n, cosc_int32 *invalid) |
| Scan address for invalid characters. | |
| COSC_API cosc_int32 | cosc_typetag_char_validate (cosc_int32 c) |
| Check if an typetag character is valid. | |
| COSC_API cosc_int32 | cosc_typetag_validate (const char *typetag, cosc_int32 typetag_n, cosc_int32 *invalid) |
| Scan typetag for invalid characters. | |
| COSC_API cosc_int32 | cosc_typetag_payload (char *s, cosc_int32 s_n, const char *typetag, cosc_int32 typetag_n, cosc_int32 *array_members) |
| Scan typetag for types with payload, ignoring the comma prefix, array syntax and types T, F, N and I. | |
| COSC_API cosc_int32 | cosc_pattern_char_validate (cosc_int32 c) |
| Check if an pattern character is valid. | |
| COSC_API cosc_int32 | cosc_pattern_validate (const char *s, cosc_int32 s_n, cosc_int32 *invalid) |
| Scan matching pattern for invalid characters. | |
| COSC_API cosc_int32 | cosc_pattern_match (const char *s, cosc_int32 s_n, const char *pattern, cosc_int32 pattern_n) |
| Match an address or typetag. | |
| COSC_API cosc_int32 | cosc_signature_match (const void *buffer, cosc_int32 size, const char *apattern, cosc_int32 apattern_n, const char *tpattern, cosc_int32 tpattern_n, cosc_int32 prefix) |
| Match an address and typetag. | |
| COSC_API cosc_uint32 | cosc_timetag_to_time (cosc_uint64 timetag, cosc_uint32 *nanos) |
| Convert a timetag to seconds and nanoseconds. | |
| COSC_API cosc_uint64 | cosc_time_to_timetag (cosc_uint32 seconds, cosc_uint32 nanos) |
| Convert time to a timetag. | |
| COSC_API cosc_float32 | cosc_float64_to_float32 (cosc_float64 value) |
| Convert a 64-bit float to a 32-bit float. | |
| COSC_API cosc_float64 | cosc_float32_to_float64 (cosc_float32 value) |
| Convert a 32-bit float to a 64-bit float. | |
| COSC_API cosc_int32 | cosc_write_uint32 (void *buffer, cosc_int32 size, cosc_uint32 value) |
| Write a 32-bit, big endian unsigned integer. | |
| COSC_API cosc_int32 | cosc_read_uint32 (const void *buffer, cosc_int32 size, cosc_uint32 *value) |
| Read a 32-bit big endian unsigned integer. | |
| COSC_API cosc_int32 | cosc_write_int32 (void *buffer, cosc_int32 size, cosc_int32 value) |
| Write a 32-bit big endian signed integer. | |
| COSC_API cosc_int32 | cosc_read_int32 (const void *buffer, cosc_int32 size, cosc_int32 *value) |
| Read a 32-bit big endian signed integer. | |
| COSC_API cosc_int32 | cosc_write_float32 (void *buffer, cosc_int32 size, cosc_float32 value) |
| Write a 32-bit big endian floating point. | |
| COSC_API cosc_int32 | cosc_read_float32 (const void *buffer, cosc_int32 size, cosc_float32 *value) |
| Read a 32-bit big endian floating point. | |
| COSC_API cosc_int32 | cosc_write_uint64 (void *buffer, cosc_int32 size, cosc_uint64 value) |
| Write a 64-bit, big endian unsigned integer. | |
| COSC_API cosc_int32 | cosc_read_uint64 (const void *buffer, cosc_int32 size, cosc_uint64 *value) |
| Read a 64-bit big endian unsigned integer. | |
| COSC_API cosc_int32 | cosc_write_int64 (void *buffer, cosc_int32 size, cosc_int64 value) |
| Write a 64-bit big endian signed integer. | |
| COSC_API cosc_int32 | cosc_read_int64 (const void *buffer, cosc_int32 size, cosc_int64 *value) |
| Read a 64-bit big endian signed integer. | |
| COSC_API cosc_int32 | cosc_write_float64 (void *buffer, cosc_int32 size, cosc_float64 value) |
| Write a 64-bit big endian floating point. | |
| COSC_API cosc_int32 | cosc_read_float64 (const void *buffer, cosc_int32 size, cosc_float64 *value) |
| Read a 64-bit big endian floating point. | |
| COSC_API cosc_int32 | cosc_write_string (void *buffer, cosc_int32 size, const char *value, cosc_int32 value_n, cosc_int32 *length) |
| Write a string. | |
| COSC_API cosc_int32 | cosc_read_string (const void *buffer, cosc_int32 size, char *value, cosc_int32 value_n, cosc_int32 *length) |
| Read a string. | |
| COSC_API cosc_int32 | cosc_write_blob (void *buffer, cosc_int32 size, const void *value, cosc_int32 value_n) |
| Write a blob. | |
| COSC_API cosc_int32 | cosc_read_blob (const void *buffer, cosc_int32 size, void *value, cosc_int32 value_n, const void **data, cosc_int32 *data_size) |
| Read a blob. | |
| COSC_API cosc_int32 | cosc_write_char (void *buffer, cosc_int32 size, cosc_int32 value) |
| Write an ASCII character. | |
| COSC_API cosc_int32 | cosc_read_char (const void *buffer, cosc_int32 size, cosc_int32 *value) |
| Read an ASCII character. | |
| COSC_API cosc_int32 | cosc_write_midi (void *buffer, cosc_int32 size, const unsigned char value[4]) |
| Write a MIDI message. | |
| COSC_API cosc_int32 | cosc_read_midi (const void *buffer, cosc_int32 size, unsigned char value[4]) |
| Read an ASCII character. | |
| COSC_API cosc_int32 | cosc_write_bundle (void *buffer, cosc_int32 size, cosc_uint64 timetag, cosc_int32 psize) |
| Write an OSC bundle head. | |
| COSC_API cosc_int32 | cosc_read_bundle (const void *buffer, cosc_int32 size, cosc_uint64 *timetag, cosc_int32 *psize) |
| Read an OSC bundle head. | |
| COSC_API cosc_int32 | cosc_write_signature (void *buffer, cosc_int32 size, const char *address, cosc_int32 address_n, const char *typetag, cosc_int32 typetag_n, cosc_int32 psize) |
| Write an OSC message signature. | |
| COSC_API cosc_int32 | cosc_read_signature (const void *buffer, cosc_int32 size, const char **address, cosc_int32 *address_n, const char **typetag, cosc_int32 *typetag_n, cosc_int32 *psize) |
| Read an OSC message signature. | |
| COSC_API cosc_int32 | cosc_write_value (void *buffer, cosc_int32 size, char type, const union cosc_value *value) |
| Write an OSC value. | |
| COSC_API cosc_int32 | cosc_read_value (const void *buffer, cosc_int32 size, char type, union cosc_value *value) |
| Read an OSC value. | |
| COSC_API cosc_int32 | cosc_write_values (void *buffer, cosc_int32 size, const char *types, cosc_int32 types_n, const union cosc_value *values, cosc_int32 values_n, cosc_int32 *value_count) |
| Write OSC values. | |
| COSC_API cosc_int32 | cosc_read_values (const void *buffer, cosc_int32 size, const char *types, cosc_int32 types_n, union cosc_value *values, cosc_int32 values_n, cosc_int32 *value_count, cosc_int32 exit_early) |
| Read OSC values. | |
| 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. | |
| 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. | |
| COSC_API cosc_int32 | cosc_value_dump (char *s, cosc_int32 n, char type, const union cosc_value *value) |
| Dump an OSC value to string. | |
| COSC_API cosc_int32 | cosc_message_dump (char *s, cosc_int32 n, const struct cosc_message *message) |
| Dump an OSC message to string. | |
| COSC_API cosc_int32 | cosc_serial_get_buffer_size (const struct cosc_serial *serial) |
| The maximum number of bytes that can be written/read to/from the buffer. | |
| COSC_API cosc_int32 | cosc_serial_get_size (const struct cosc_serial *serial) |
| Get the number of written or read bytes. | |
| COSC_API cosc_int32 | cosc_serial_get_msgtype (const struct cosc_serial *serial) |
| Get the current typetag type of a message level. | |
| COSC_API void | cosc_serial_reset (struct cosc_serial *serial) |
| Reset serial. | |
| COSC_API void | cosc_writer_setup (struct cosc_serial *serial, void *buffer, cosc_int32 buffer_size, struct cosc_level *levels, cosc_int32 level_max, cosc_uint32 flags) |
| Setup a serial for writing. | |
| COSC_API cosc_int32 | cosc_writer_start_bundle (struct cosc_serial *serial, cosc_uint64 timetag) |
| Start a new bundle level. | |
| COSC_API cosc_int32 | cosc_writer_end_bundle (struct cosc_serial *serial) |
| End a bundle level. | |
| COSC_API cosc_int32 | cosc_writer_start_message (struct cosc_serial *serial, const char *address, cosc_int32 address_n, const char *typetag, cosc_int32 typetag_n) |
| Start a new message level. | |
| COSC_API cosc_int32 | cosc_writer_end_message (struct cosc_serial *serial) |
| End a message level. | |
| COSC_API cosc_int32 | cosc_writer_start_blob (struct cosc_serial *serial) |
| Start a new blob level. | |
| COSC_API cosc_int32 | cosc_writer_end_blob (struct cosc_serial *serial) |
| End a blob level. | |
| COSC_API cosc_int32 | cosc_writer_uint32 (struct cosc_serial *serial, cosc_uint32 value) |
| Write an unsigned 32-bit integer. | |
| COSC_API cosc_int32 | cosc_writer_int32 (struct cosc_serial *serial, cosc_int32 value) |
| Write a signed 32-bit integer. | |
| COSC_API cosc_int32 | cosc_writer_float32 (struct cosc_serial *serial, cosc_float32 value) |
| Write a 32-bit float. | |
| COSC_API cosc_int32 | cosc_writer_uint64 (struct cosc_serial *serial, cosc_uint64 value) |
| Write an unsigned 64-bit integer. | |
| COSC_API cosc_int32 | cosc_writer_int64 (struct cosc_serial *serial, cosc_int64 value) |
| Write a signed 64-bit integer. | |
| COSC_API cosc_int32 | cosc_writer_float64 (struct cosc_serial *serial, cosc_float64 value) |
| Write a 64-bit float. | |
| COSC_API cosc_int32 | cosc_writer_string (struct cosc_serial *serial, const char *value, cosc_int32 value_n, cosc_int32 *length) |
| Write a string. | |
| COSC_API cosc_int32 | cosc_writer_blob (struct cosc_serial *serial, const void *value, cosc_int32 value_n) |
| Write a blob. | |
| COSC_API cosc_int32 | cosc_writer_char (struct cosc_serial *serial, cosc_int32 value) |
| Write an ASCII character. | |
| COSC_API cosc_int32 | cosc_writer_midi (struct cosc_serial *serial, const unsigned char value[4]) |
| Write a MIDI message. | |
| COSC_API cosc_int32 | cosc_writer_value (struct cosc_serial *serial, cosc_int32 type, const union cosc_value *value) |
| Write a value. | |
| COSC_API cosc_int32 | cosc_writer_message (struct cosc_serial *serial, const struct cosc_message *message, cosc_int32 *value_count) |
| Write an OSC message. | |
| COSC_API cosc_int32 | cosc_writer_bytes (struct cosc_serial *serial, const void *value, cosc_int32 value_n) |
| Write bytes to a started blob level. | |
| COSC_API cosc_int32 | cosc_writer_skip (struct cosc_serial *serial) |
| Skip a value, if the value has payload it will be zeroes. | |
| COSC_API cosc_int32 | cosc_writer_repeat (struct cosc_serial *serial) |
| Repeat typetag from the beginning of an array start, where the array starts with a '['. | |
| COSC_API void | cosc_reader_setup (struct cosc_serial *serial, const void *buffer, cosc_int32 buffer_size, struct cosc_level *levels, cosc_int32 level_max, cosc_uint32 flags) |
| Setup a serial for reading. | |
| COSC_API cosc_int32 | cosc_reader_peek_bundle (struct cosc_serial *serial, cosc_uint64 *timetag, cosc_int32 *psize) |
| Check if the buffer has a bundle at the current read size. | |
| COSC_API cosc_int32 | cosc_reader_start_bundle (struct cosc_serial *serial, cosc_uint64 *timetag) |
| Start a new bundle level. | |
| COSC_API cosc_int32 | cosc_reader_end_bundle (struct cosc_serial *serial) |
| End a bundle level. | |
| COSC_API cosc_int32 | cosc_reader_start_message (struct cosc_serial *serial, const char **address, cosc_int32 *address_n, const char **typetag, cosc_int32 *typetag_n) |
| Start a new message level. | |
| COSC_API cosc_int32 | cosc_reader_end_message (struct cosc_serial *serial, cosc_int32 exit_early) |
| End a message level. | |
| COSC_API cosc_int32 | cosc_reader_start_blob (struct cosc_serial *serial, cosc_int32 *value_size) |
| Start a new blob level. | |
| COSC_API cosc_int32 | cosc_reader_end_blob (struct cosc_serial *serial) |
| End a blob level. | |
| COSC_API cosc_int32 | cosc_reader_uint32 (struct cosc_serial *serial, cosc_uint32 *value) |
| Write an unsigned 32-bit integer. | |
| COSC_API cosc_int32 | cosc_reader_int32 (struct cosc_serial *serial, cosc_int32 *value) |
| Write a signed 32-bit integer. | |
| COSC_API cosc_int32 | cosc_reader_float32 (struct cosc_serial *serial, cosc_float32 *value) |
| Write a 32-bit float. | |
| COSC_API cosc_int32 | cosc_reader_uint64 (struct cosc_serial *serial, cosc_uint64 *value) |
| Write an unsigned 64-bit integer. | |
| COSC_API cosc_int32 | cosc_reader_int64 (struct cosc_serial *serial, cosc_int64 *value) |
| Write a signed 64-bit integer. | |
| COSC_API cosc_int32 | cosc_reader_float64 (struct cosc_serial *serial, cosc_float64 *value) |
| Write a 64-bit float. | |
| COSC_API cosc_int32 | cosc_reader_string (struct cosc_serial *serial, char *value, cosc_int32 value_n, cosc_int32 *length) |
| Write a string. | |
| COSC_API cosc_int32 | cosc_reader_blob (struct cosc_serial *serial, void *value, cosc_int32 value_n, const void **data, cosc_int32 *data_size) |
| Write a blob. | |
| COSC_API cosc_int32 | cosc_reader_char (struct cosc_serial *serial, cosc_int32 *value) |
| Write an ASCII character. | |
| COSC_API cosc_int32 | cosc_reader_midi (struct cosc_serial *serial, unsigned char value[4]) |
| Write a MIDI message. | |
| COSC_API cosc_int32 | cosc_reader_value (struct cosc_serial *serial, cosc_int32 type, union cosc_value *value) |
| Read a value. | |
| COSC_API cosc_int32 | cosc_reader_message (struct cosc_serial *serial, struct cosc_message *message, cosc_int32 *value_count, cosc_int32 exit_early) |
| Read an OSC message. | |
| COSC_API cosc_int32 | cosc_reader_bytes (struct cosc_serial *serial, void *value, cosc_int32 value_n) |
| Read bytes to a started blob level. | |
| COSC_API cosc_int32 | cosc_reader_skip (struct cosc_serial *serial) |
| Skip a value, if the value has payload it will be zeroes. | |
| COSC_API cosc_int32 | cosc_reader_repeat (struct cosc_serial *serial) |
| Repeat typetag from the beginning of an array start, not including the starting '[' character. | |
OSC library for C99 or C++11.
Defined at compile AND include time:
stdint.h (or cstdint if C++).cosc_int64 and cosc_uint64 as cosc_64bits.cosc_float32 as cosc_uint32.cosc_float64 as cosc_64bits.Type overrides (also at compile AND include time):
NOTE that type overrides will not work for types affected by COSC_NOINT64, COSC_FLOAT32 or COSC_NOFLOAT64 when those are defined.
| #define COSC_64BITS_HI | ( | bits_ | ) |
Helper to access the high member of a cosc_64bits struct.
| bits_ | A pointer to the cosc_64bits struct. |
| #define COSC_64BITS_INIT | ( | hi_, | |
| lo_ ) |
Helper initializer when defining cosc_64bits structs.
| hi_ | The 32 most significant bits. |
| lo_ | The 32 least significant bits. |
| #define COSC_64BITS_LO | ( | bits_ | ) |
Helper to access the low member of a cosc_64bits struct.
| bits_ | A pointer to the cosc_64bits struct. |
| #define COSC_64BITS_SET | ( | bits_, | |
| hi_, | |||
| lo_ ) |
Helper to set the members of a cosc_64bits struct.
| bits_ | A pointer to the cosc_64bits struct. |
| hi_ | The 32 most significant bits. |
| lo_ | The 32 least significant bits. |
| #define COSC_FLOAT64_INIT_ZERO 0 |
Initializer cosc_float64 or cosc_ufloat64 as zero.
| ptr | A pofloater to the cosc_float64 or cosc_ufloat64. |
| #define COSC_FLOAT64_SET_ZERO | ( | ptr | ) |
Set cosc_float64 or cosc_ufloat64 as zero.
| ptr | A pofloater to the cosc_float64 or cosc_ufloat64. |
| #define COSC_INT64_INIT_ZERO 0 |
Initializer cosc_int64 or cosc_uint64 as zero.
| ptr | A pointer to the cosc_int64 or cosc_uint64. |
| #define COSC_INT64_SET_ZERO | ( | ptr | ) |
Set cosc_int64 or cosc_uint64 as zero.
| ptr | A pointer to the cosc_int64 or cosc_uint64. |
| #define COSC_PAD | ( | sz | ) |
Get the required zero pad size for 4 byte alignment.
| sz | The byte size of the object. |
| #define COSC_PADMUST | ( | sz | ) |
Get the required zero pad size for strings that require a zero terminator and 4 byte alignment.
| sz | The byte size of the string, excluding the zero terminator. |
| #define COSC_SERIAL_ISREADER | ( | serial_ | ) |
Macro to check if a serial is a reader.
| serial_ | A pointer to the serial. |
| #define COSC_SERIAL_ISWRITER | ( | serial_ | ) |
Macro to check if a serial is a writer.
| serial_ | A pointer to the serial. |
| #define COSC_TYPE_FLOAT32 float |
Used to typedef cosc_float32.
| #define COSC_TYPE_FLOAT64 double |
Used to typedef cosc_float64.
| #define COSC_TYPE_INT32 int32_t |
Used to typedef cosc_int32.
| #define COSC_TYPE_INT64 int64_t |
Used to typedef cosc_int64.
| #define COSC_TYPE_UINT32 uint32_t |
Used to typedef cosc_uint32.
| #define COSC_TYPE_UINT64 uint64_t |
Used to typedef cosc_uint64.
| COSC_API cosc_int32 cosc_address_char_validate | ( | cosc_int32 | c | ) |
Check if an address character is valid.
| c | The character. |
| COSC_API cosc_int32 cosc_address_validate | ( | const char * | address, |
| cosc_int32 | address_n, | ||
| cosc_int32 * | invalid ) |
Scan address for invalid characters.
| address | The address. | |
| address_n | Read at most this many bytes from address. | |
| [out] | invalid | If non-NULL and the function returns 0 the index of the invalid character is stored here. |
invalid will be -1. | COSC_API cosc_int32 cosc_big_endian | ( | void | ) |
If big endian was detected when building this function returns non-zero, otherwise zero.
| COSC_API cosc_int32 cosc_feature_array | ( | void | ) |
Feature test for array support.
| COSC_API cosc_int32 cosc_feature_float32 | ( | void | ) |
Feature test for 32-bit float support.
| COSC_API cosc_int32 cosc_feature_float64 | ( | void | ) |
Feature test for 64-bit float support.
| COSC_API cosc_int32 cosc_feature_fltconv | ( | void | ) |
Feature test for float conversion support.
| COSC_API cosc_int32 cosc_feature_int64 | ( | void | ) |
Feature test for 64-bit integer support.
| COSC_API cosc_int32 cosc_feature_pattern | ( | void | ) |
Feature test for pattern support.
| COSC_API cosc_int32 cosc_feature_reader | ( | void | ) |
Feature test for reader support.
| COSC_API cosc_int32 cosc_feature_swap | ( | void | ) |
Feature test for endian swapping.
| COSC_API cosc_int32 cosc_feature_timetag | ( | void | ) |
Feature test for timetag conversion support.
| COSC_API cosc_int32 cosc_feature_writer | ( | void | ) |
Feature test for writer support.
| COSC_API cosc_float64 cosc_float32_to_float64 | ( | cosc_float32 | value | ) |
Convert a 32-bit float to a 64-bit float.
| value | The 32-bit float. |
| COSC_API cosc_float32 cosc_float64_to_float32 | ( | cosc_float64 | value | ) |
Convert a 64-bit float to a 32-bit float.
| value | The 64-bit float. |
| COSC_API cosc_int32 cosc_message_dump | ( | char * | s, |
| cosc_int32 | n, | ||
| const struct cosc_message * | message ) |
Dump an OSC message to string.
| [out] | s | If non-NULL store to this string. |
| n | Store at most this many bytes to s. | |
| message | The message. |
n indicating that the string was truncated. | COSC_API cosc_int32 cosc_pattern_char_validate | ( | cosc_int32 | c | ) |
Check if an pattern character is valid.
| c | The character. |
| COSC_API cosc_int32 cosc_pattern_match | ( | const char * | s, |
| cosc_int32 | s_n, | ||
| const char * | pattern, | ||
| cosc_int32 | pattern_n ) |
Match an address or typetag.
| s | The address or typetag to match with. |
| s_n | Read at most this many bytes from s. |
| pattern | The matching pattern. |
| pattern_n | Read at most this many bytes from pattern. |
pattern. Pattern syntax:
* match zero or more characters.[] match any character inside square brackets.{} match any comma separated string inside curly brackets.Extended syntax for typetags, not part of the OSC specification:
When matching addresses '#' is simply ignored.
| COSC_API cosc_int32 cosc_pattern_validate | ( | const char * | s, |
| cosc_int32 | s_n, | ||
| cosc_int32 * | invalid ) |
Scan matching pattern for invalid characters.
| s | The pattern. | |
| s_n | Read at most this many bytes from s. | |
| [out] | invalid | If non-NULL and the function returns 0 the index of the invalid character is stored here. |
s_n <= 0 or s is empty the value stored to invalid will be -1. invalid is >= s_n it means the pattern ended unexpectedly, probably due to an unclosed '[' or '{' marker. | COSC_API cosc_int32 cosc_read_blob | ( | const void * | buffer, |
| cosc_int32 | size, | ||
| void * | value, | ||
| cosc_int32 | value_n, | ||
| const void ** | data, | ||
| cosc_int32 * | data_size ) |
Read a blob.
| buffer | Read bytes from this buffer. | |
| size | Read at most this many bytes from buffer. | |
| [out] | value | If non-NULL and the function does not return a negative error code store the blob data here. |
| value_n | Store at most this many bytes to value. | |
| [out] | data | If non-NULL and the function does not return a negative error code a pointer to the first byte of the blob data is stored here, or NULL if the blob has zero bytes. |
| [out] | data_size | If non-NULL and the function does not return a negative error code the size of the blob data is stored here. |
Possible error codes:
size is too small.data_size exceeds COSC_SIZE_MAX.data_size is invalid. | COSC_API cosc_int32 cosc_read_bundle | ( | const void * | buffer, |
| cosc_int32 | size, | ||
| cosc_uint64 * | timetag, | ||
| cosc_int32 * | psize ) |
Read an OSC bundle head.
| buffer | Read bytes from this buffer. | |
| size | Read at most this many bytes from buffer. | |
| [out] | timetag | If non-NULL and the function does not return a negative error code the timetag is stored here. |
| [out] | psize | If non-NULL and a signed 32-bit integer at the start describing the byte size of the message is stored here, NULL if there is no packet size descriptor prefix. |
size is non-NULL and the size < 4 the value stored to size will be 0.Possible error codes:
buffer is non-NULL and size is too small.psize is invalid.buffer does not have a "#bundle" head. | COSC_API cosc_int32 cosc_read_char | ( | const void * | buffer, |
| cosc_int32 | size, | ||
| cosc_int32 * | value ) |
Read an ASCII character.
| buffer | Read bytes from this buffer. | |
| size | Read at most this many bytes from buffer. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Possible error codes:
size is too small. | COSC_API cosc_int32 cosc_read_float32 | ( | const void * | buffer, |
| cosc_int32 | size, | ||
| cosc_float32 * | value ) |
Read a 32-bit big endian floating point.
| buffer | Read bytes from this buffer. | |
| size | Read at most this many bytes from buffer. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Possible error codes:
size is too small. | COSC_API cosc_int32 cosc_read_float64 | ( | const void * | buffer, |
| cosc_int32 | size, | ||
| cosc_float64 * | value ) |
Read a 64-bit big endian floating point.
| buffer | Read bytes from this buffer. | |
| size | Read at most this many bytes from buffer. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Possible error codes:
size is too small. | COSC_API cosc_int32 cosc_read_int32 | ( | const void * | buffer, |
| cosc_int32 | size, | ||
| cosc_int32 * | value ) |
Read a 32-bit big endian signed integer.
| buffer | Read bytes from this buffer. | |
| size | Read at most this many bytes from buffer. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Possible error codes:
size is too small. | COSC_API cosc_int32 cosc_read_int64 | ( | const void * | buffer, |
| cosc_int32 | size, | ||
| cosc_int64 * | value ) |
Read a 64-bit big endian signed integer.
| buffer | Read bytes from this buffer. | |
| size | Read at most this many bytes from buffer. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Possible error codes:
size is too small. | 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.
| buffer | Read bytes from this buffer. | |
| size | Read at most this many bytes from buffer. | |
| message | The message or NULL to discard the message. | |
| psize | If non-NULL read a 32 bit packet size integer before the message and store it here, may be 0 if the function fails before reading it. NULL if you are not expecting any packet size integer at the start of the buffer. | |
| [out] | value_count | If non-NULL the number of read values is stored here. |
| exit_early | If non-zero and the types have an array specified the function will stop reading more array members and exit early even if there are more bytes left in buffer. |
exit_early has no effect if COSC_NOARRAY was defined when building.size is too small.size > COSC_SIZE_MAX.| COSC_API cosc_int32 cosc_read_midi | ( | const void * | buffer, |
| cosc_int32 | size, | ||
| unsigned char | value[4] ) |
Read an ASCII character.
| buffer | Read bytes from this buffer. | |
| size | Read at most this many bytes from buffer. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Possible error codes:
size is too small. | COSC_API cosc_int32 cosc_read_signature | ( | const void * | buffer, |
| cosc_int32 | size, | ||
| const char ** | address, | ||
| cosc_int32 * | address_n, | ||
| const char ** | typetag, | ||
| cosc_int32 * | typetag_n, | ||
| cosc_int32 * | psize ) |
Read an OSC message signature.
| buffer | Read bytes from this buffer. | |
| size | Read at most this many bytes from buffer. | |
| [out] | address | If non-NULL and the function does not return a negative error code the address pointer is stored here. |
| [out] | address_n | If non-NULL and the function does not return a negative error code the address length, excluding the zero terminator, is stored here. |
| [out] | typetag | If non-NULL and the function does not return a negative error code the typetag pointer is stored here. |
| [out] | typetag_n | If non-NULL and the function does not return a negative error code the typetag length, excluding the zero terminator, is stored here. |
| [out] | psize | If non-NULL and the function does not return a negative error code a signed 32-bit integer at the start describing the byte size of the message is stored here, NULL if there is no size descriptor prefix. |
address or typetag.Possible error codes:
size is too small.psize is invalid. | COSC_API cosc_int32 cosc_read_string | ( | const void * | buffer, |
| cosc_int32 | size, | ||
| char * | value, | ||
| cosc_int32 | value_n, | ||
| cosc_int32 * | length ) |
Read a string.
| buffer | Read bytes from this buffer. | |
| size | Read at most this many bytes from buffer. | |
| [out] | value | If non-NULL store the string here. |
| value_n | Store at most this many bytes to value. | |
| [out] | length | If non-NULL and the function does not return a negative error code the length of the string, excluding the zero terminator, is stored here. |
Possible error codes:
size is too small. | COSC_API cosc_int32 cosc_read_uint32 | ( | const void * | buffer, |
| cosc_int32 | size, | ||
| cosc_uint32 * | value ) |
Read a 32-bit big endian unsigned integer.
| buffer | Read bytes from this buffer. | |
| size | Read at most this many bytes from buffer. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Possible error codes:
size is too small. | COSC_API cosc_int32 cosc_read_uint64 | ( | const void * | buffer, |
| cosc_int32 | size, | ||
| cosc_uint64 * | value ) |
Read a 64-bit big endian unsigned integer.
| buffer | Read bytes from this buffer. | |
| size | Read at most this many bytes from buffer. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Possible error codes:
size is too small. | COSC_API cosc_int32 cosc_read_value | ( | const void * | buffer, |
| cosc_int32 | size, | ||
| char | type, | ||
| union cosc_value * | value ) |
Read an OSC value.
| buffer | Read bytes from this buffer. | |
| size | Read at most this many bytes from buffer. | |
| type | The type. | |
| [out] | value | If non-NULL and the functon does not return a negative error code store the read values here. |
size is too small.size > COSC_SIZE_MAX.type is invalid. | COSC_API cosc_int32 cosc_read_values | ( | const void * | buffer, |
| cosc_int32 | size, | ||
| const char * | types, | ||
| cosc_int32 | types_n, | ||
| union cosc_value * | values, | ||
| cosc_int32 | values_n, | ||
| cosc_int32 * | value_count, | ||
| cosc_int32 | exit_early ) |
Read OSC values.
| buffer | Read bytes from this buffer. | |
| size | Read at most this many bytes from buffer. | |
| types | The types, the starting comma may be omitted. | |
| types_n | Read at most this many bytes from types. | |
| [out] | values | If non-NULL store the read values here. |
| values_n | Store at most this many members to values. | |
| [out] | value_count | If non-NULL the number of read values is stored here. |
| exit_early | If non-zero and the types have an array specified the function will stop reading more array members and exit early even if there are more bytes left in buffer. |
values_n is less than the values specified by types the remaining values are discarded. exit_early has no effect if COSC_NOARRAY was defined when building.size is too small.size > COSC_SIZE_MAX.type is invalid. | COSC_API cosc_int32 cosc_reader_blob | ( | struct cosc_serial * | serial, |
| void * | value, | ||
| cosc_int32 | value_n, | ||
| const void ** | data, | ||
| cosc_int32 * | data_size ) |
Write a blob.
| serial | The serial. | |
| [out] | value | If non-NULL and the function does not return a negative error code store the blob data here. |
| value_n | Store at most this many bytes to value. | |
| [out] | data | If non-NULL and the function does not return a negative error code a pointer to the first byte of the blob data is stored here, or NULL if the blob has zero bytes. |
| [out] | data_size | If non-NULL and the function does not return a negative error code the size of the blob data is stored here. |
Error codes:
| COSC_API cosc_int32 cosc_reader_bytes | ( | struct cosc_serial * | serial, |
| void * | value, | ||
| cosc_int32 | value_n ) |
Read bytes to a started blob level.
| serial | The serial. | |
| [out] | value | If non-NULL store read bytes here or NULL to discard the bytes. |
| value_n | The number of bytes to read. |
Error codes:
| COSC_API cosc_int32 cosc_reader_char | ( | struct cosc_serial * | serial, |
| cosc_int32 * | value ) |
Write an ASCII character.
| serial | The serial. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Error codes:
| COSC_API cosc_int32 cosc_reader_end_blob | ( | struct cosc_serial * | serial | ) |
End a blob level.
| serial | The serial. |
Error codes:
| COSC_API cosc_int32 cosc_reader_end_bundle | ( | struct cosc_serial * | serial | ) |
End a bundle level.
| serial | The serial. |
Error codes:
| COSC_API cosc_int32 cosc_reader_end_message | ( | struct cosc_serial * | serial, |
| cosc_int32 | exit_early ) |
End a message level.
| serial | The serial. |
| exit_early | If non-zero and the types have an array specified the function will stop reading more array members and exit early even if there are more bytes left in buffer. |
Error codes:
| COSC_API cosc_int32 cosc_reader_float32 | ( | struct cosc_serial * | serial, |
| cosc_float32 * | value ) |
Write a 32-bit float.
| serial | The serial. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Error codes:
| COSC_API cosc_int32 cosc_reader_float64 | ( | struct cosc_serial * | serial, |
| cosc_float64 * | value ) |
Write a 64-bit float.
| serial | The serial. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Error codes:
| COSC_API cosc_int32 cosc_reader_int32 | ( | struct cosc_serial * | serial, |
| cosc_int32 * | value ) |
Write a signed 32-bit integer.
| serial | The serial. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Error codes:
| COSC_API cosc_int32 cosc_reader_int64 | ( | struct cosc_serial * | serial, |
| cosc_int64 * | value ) |
Write a signed 64-bit integer.
| serial | The serial. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Error codes:
| COSC_API cosc_int32 cosc_reader_message | ( | struct cosc_serial * | serial, |
| struct cosc_message * | message, | ||
| cosc_int32 * | value_count, | ||
| cosc_int32 | exit_early ) |
Read an OSC message.
| serial | The serial. | |
| message | The message or NULL to discard the message. | |
| [out] | value_count | If non-NULL the number of read values is stored here. |
| exit_early | If non-zero and the types have an array specified the function will stop reading more array members and exit early even if there are more bytes left in buffer. |
exit_early has no effect if COSC_NOARRAY was defined when building.| COSC_API cosc_int32 cosc_reader_midi | ( | struct cosc_serial * | serial, |
| unsigned char | value[4] ) |
Write a MIDI message.
| serial | The serial. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Error codes:
| COSC_API cosc_int32 cosc_reader_peek_bundle | ( | struct cosc_serial * | serial, |
| cosc_uint64 * | timetag, | ||
| cosc_int32 * | psize ) |
Check if the buffer has a bundle at the current read size.
| serial | The serial. | |
| [out] | timetag | If non-NULL and the function does not return a negative error code the timestamp is stored here. |
| psize | If non-NULL and the function does not return a negative error code stored the packet size here, will be 0 if there is no packet size. |
Error codes:
| COSC_API cosc_int32 cosc_reader_repeat | ( | struct cosc_serial * | serial | ) |
Repeat typetag from the beginning of an array start, not including the starting '[' character.
| serial | The serial. |
Error codes:
| COSC_API void cosc_reader_setup | ( | struct cosc_serial * | serial, |
| const void * | buffer, | ||
| cosc_int32 | buffer_size, | ||
| struct cosc_level * | levels, | ||
| cosc_int32 | level_max, | ||
| cosc_uint32 | flags ) |
Setup a serial for reading.
| [out] | serial | The serial. |
| buffer | A writable buffer, must not be NULL. | |
| buffer_size | The size of the buffer. | |
| levels | Provided levels, must point to an array of levels with at least one member. | |
| level_max | The number of provided levels, must be at least 1. | |
| flags | Serial flags, see COSC_SERIAL_* macros. |
| COSC_API cosc_int32 cosc_reader_skip | ( | struct cosc_serial * | serial | ) |
Skip a value, if the value has payload it will be zeroes.
| serial | The serial. |
Error codes:
| COSC_API cosc_int32 cosc_reader_start_blob | ( | struct cosc_serial * | serial, |
| cosc_int32 * | value_size ) |
Start a new blob level.
| serial | The serial. | |
| [out] | value_size | If non-NULL and the function does not return a negative error code the BLOB data size is stored here. |
Error codes:
| COSC_API cosc_int32 cosc_reader_start_bundle | ( | struct cosc_serial * | serial, |
| cosc_uint64 * | timetag ) |
Start a new bundle level.
| serial | The serial. | |
| [out] | timetag | If non-NULL and the function does not return a negative error code the timestamp is stored here. |
Error codes:
| COSC_API cosc_int32 cosc_reader_start_message | ( | struct cosc_serial * | serial, |
| const char ** | address, | ||
| cosc_int32 * | address_n, | ||
| const char ** | typetag, | ||
| cosc_int32 * | typetag_n ) |
Start a new message level.
| serial | The serial. | |
| [out] | address | If non-NULL and the function does not return a negative error code a pointer to the address is stored here. |
| [out] | address_n | If non-NULL and the function does not return a negative error code the length, excluding the zero terminator, of the address is stored here. |
| [out] | typetag | If non-NULL and the function does not return a negative error code a pointer to the typetag is stored here. |
| [out] | typetag_n | If non-NULL and the function does not return a negative error code the length, excluding the zero terminator, of the typetag is stored here. |
Error codes:
| COSC_API cosc_int32 cosc_reader_string | ( | struct cosc_serial * | serial, |
| char * | value, | ||
| cosc_int32 | value_n, | ||
| cosc_int32 * | length ) |
Write a string.
| serial | The serial. | |
| [out] | value | If non-NULL store the string here. |
| value_n | Store at most this many bytes to value. | |
| [out] | length | If non-NULL and the function does not return a negative error code the length of the string, excluding the zero terminator, is stored here. |
Error codes:
| COSC_API cosc_int32 cosc_reader_uint32 | ( | struct cosc_serial * | serial, |
| cosc_uint32 * | value ) |
Write an unsigned 32-bit integer.
| serial | The serial. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Error codes:
| COSC_API cosc_int32 cosc_reader_uint64 | ( | struct cosc_serial * | serial, |
| cosc_uint64 * | value ) |
Write an unsigned 64-bit integer.
| serial | The serial. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Error codes:
| COSC_API cosc_int32 cosc_reader_value | ( | struct cosc_serial * | serial, |
| cosc_int32 | type, | ||
| union cosc_value * | value ) |
Read a value.
| serial | The serial. | |
| type | The value typetag type. | |
| [out] | value | If non-NULL and the function does not return a negative error code the value is stored here. |
Error codes:
type is invalid. | COSC_API cosc_int32 cosc_serial_get_buffer_size | ( | const struct cosc_serial * | serial | ) |
The maximum number of bytes that can be written/read to/from the buffer.
| serial | The serial. |
| COSC_API cosc_int32 cosc_serial_get_msgtype | ( | const struct cosc_serial * | serial | ) |
Get the current typetag type of a message level.
| serial | The serial. |
| COSC_API cosc_int32 cosc_serial_get_size | ( | const struct cosc_serial * | serial | ) |
Get the number of written or read bytes.
| serial | The serial. |
| COSC_API void cosc_serial_reset | ( | struct cosc_serial * | serial | ) |
Reset serial.
| serial | The serial. |
| COSC_API cosc_int32 cosc_signature_match | ( | const void * | buffer, |
| cosc_int32 | size, | ||
| const char * | apattern, | ||
| cosc_int32 | apattern_n, | ||
| const char * | tpattern, | ||
| cosc_int32 | tpattern_n, | ||
| cosc_int32 | prefix ) |
Match an address and typetag.
| buffer | The buffer. |
| size | Read at most this many bytes from buffer. |
| apattern | The matching pattern for the address. |
| apattern_n | Read at most this many bytes from apattern. |
| tpattern | The matching pattern for the typetag. |
| tpattern_n | Read at most this many bytes from apattern. |
| prefix | Non-zero to expect a message with a 32-bit signed size integer prefix. |
| COSC_API cosc_uint64 cosc_time_to_timetag | ( | cosc_uint32 | seconds, |
| cosc_uint32 | nanos ) |
| COSC_API cosc_uint32 cosc_timetag_to_time | ( | cosc_uint64 | timetag, |
| cosc_uint32 * | nanos ) |
Convert a timetag to seconds and nanoseconds.
| timetag | The timetag. | |
| [out] | nanos | If non-NULL store the nanoseconds here. |
nanos will have a loss of precision. | COSC_API cosc_int32 cosc_typetag_char_validate | ( | cosc_int32 | c | ) |
Check if an typetag character is valid.
| c | The character. |
| COSC_API cosc_int32 cosc_typetag_payload | ( | char * | s, |
| cosc_int32 | s_n, | ||
| const char * | typetag, | ||
| cosc_int32 | typetag_n, | ||
| cosc_int32 * | array_members ) |
Scan typetag for types with payload, ignoring the comma prefix, array syntax and types T, F, N and I.
| [out] | s | If non-NULL store the payload types here. |
| s_n | Store at most this many bytes to s. | |
| typetag | The typetag. | |
| typetag_n | Read at most this many bytes from typetag. | |
| [out] | array_members | If non-NULL store the number of payload types that belong to an array, i.e is inside the array syntax. |
typetag. s, make sure it is wide enough to accept all types + 1. s_n indicating that some types may have been truncated to fit s. array_members will always be 0. | COSC_API cosc_int32 cosc_typetag_validate | ( | const char * | typetag, |
| cosc_int32 | typetag_n, | ||
| cosc_int32 * | invalid ) |
Scan typetag for invalid characters.
| typetag | The typetag. | |
| typetag_n | Read at most this many bytes from typetag. | |
| [out] | invalid | If non-NULL and the function returns 0 the index of the invalid character is stored here. |
s_n <= 0 or s is empty the value stored to invalid will be -1. invalid is >= s_n it means the typetag ended unexpectedly, probably due to an unclosed array '[' marker. | COSC_API cosc_int32 cosc_value_dump | ( | char * | s, |
| cosc_int32 | n, | ||
| char | type, | ||
| const union cosc_value * | value ) |
Dump an OSC value to string.
| [out] | s | If non-NULL store to this string. |
| n | Store at most this many bytes to s. | |
| type | The OSC typetag type. | |
| value | The value. |
n indicating that the string was truncated. | COSC_API cosc_int32 cosc_write_blob | ( | void * | buffer, |
| cosc_int32 | size, | ||
| const void * | value, | ||
| cosc_int32 | value_n ) |
Write a blob.
| [out] | buffer | If non-NULL store the OSC data here, if NULL then no bytes are stored. |
| size | Store at most this many bytes to buffer. | |
| value | The blob data, may be NULL to fill with zeroes. | |
| value_n | The size of the blob data. |
buffer is non-NULL, the required size if buffer is NULL or a negative error code if the operation fails.Possible error codes:
buffer is non-NULL and size is too small.| COSC_API cosc_int32 cosc_write_bundle | ( | void * | buffer, |
| cosc_int32 | size, | ||
| cosc_uint64 | timetag, | ||
| cosc_int32 | psize ) |
Write an OSC bundle head.
| [out] | buffer | If non-NULL store the OSC data here, if NULL then no bytes are stored. |
| size | Store at most this many bytes to buffer. | |
| timetag | The timetag of the bundle. | |
| psize | 0 for no packet size integer, < 0 to write a packet size integer based on the signature data or > 0 to set the packet size to a specific value. |
buffer is non-NULL, the required size if buffer is NULL or a negative error code if the operation fails. psize at the beginning of the buffer at a later time.Possible error codes:
buffer is non-NULL and size is too small.psize + the bundle data exceeds COSC_SIZE_MAX.size > 0 and is invalid or too small. | COSC_API cosc_int32 cosc_write_char | ( | void * | buffer, |
| cosc_int32 | size, | ||
| cosc_int32 | value ) |
Write an ASCII character.
| [out] | buffer | If non-NULL store the OSC data here, if NULL then no bytes are stored. |
| size | Store at most this many bytes to buffer. | |
| value | The value. |
buffer is non-NULL, the required size if buffer is NULL or a negative error code if the operation fails.Possible error codes:
buffer is non-NULL and size is too small. | COSC_API cosc_int32 cosc_write_float32 | ( | void * | buffer, |
| cosc_int32 | size, | ||
| cosc_float32 | value ) |
Write a 32-bit big endian floating point.
| [out] | buffer | If non-NULL store the OSC data here, if NULL then no bytes are stored. |
| size | Store at most this many bytes to buffer. | |
| value | The value. |
buffer is non-NULL, the required size if buffer is NULL or a negative error code if the operation fails.Possible error codes:
buffer is non-NULL and size is too small. | COSC_API cosc_int32 cosc_write_float64 | ( | void * | buffer, |
| cosc_int32 | size, | ||
| cosc_float64 | value ) |
Write a 64-bit big endian floating point.
| [out] | buffer | If non-NULL store the OSC data here, if NULL then no bytes are stored. |
| size | Store at most this many bytes to buffer. | |
| value | The value. |
buffer is non-NULL, the required size if buffer is NULL or a negative error code if the operation fails.Possible error codes:
buffer is non-NULL and size is too small. | COSC_API cosc_int32 cosc_write_int32 | ( | void * | buffer, |
| cosc_int32 | size, | ||
| cosc_int32 | value ) |
Write a 32-bit big endian signed integer.
| [out] | buffer | If non-NULL store the OSC data here, if NULL then no bytes are stored. |
| size | Store at most this many bytes to buffer. | |
| value | The value. |
buffer is non-NULL, the required size if buffer is NULL or a negative error code if the operation fails.Possible error codes:
buffer is non-NULL and size is too small. | COSC_API cosc_int32 cosc_write_int64 | ( | void * | buffer, |
| cosc_int32 | size, | ||
| cosc_int64 | value ) |
Write a 64-bit big endian signed integer.
| [out] | buffer | If non-NULL store the OSC data here, if NULL then no bytes are stored. |
| size | Store at most this many bytes to buffer. | |
| value | The value. |
buffer is non-NULL, the required size if buffer is NULL or a negative error code if the operation fails.Possible error codes:
buffer is non-NULL and size is too small. | 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.
| [out] | buffer | If non-NULL store the OSC data here, if NULL then no bytes are stored. |
| size | Store at most this many bytes to buffer. | |
| message | The message or NULL for an empty message. | |
| psize | 0 for no packet size integer, < 0 to write a packet size integer based on the signature data or > 0 to set the packet size to a specific value. | |
| [out] | value_count | If non-NULL the number of written values is stored here. |
buffer is non-NULL, the required size if buffer is NULL or a negative error code if the operation fails. buffer is non-NULL and size is too small.size > COSC_SIZE_MAX.size > 0 and is invalid or too small. | COSC_API cosc_int32 cosc_write_midi | ( | void * | buffer, |
| cosc_int32 | size, | ||
| const unsigned char | value[4] ) |
Write a MIDI message.
| [out] | buffer | If non-NULL store the OSC data here, if NULL then no bytes are stored. |
| size | Store at most this many bytes to buffer. | |
| value | The value or NULL to fill the message with zeroes. |
buffer is non-NULL, the required size if buffer is NULL or a negative error code if the operation fails. Possible error codes:
buffer is non-NULL and size is too small. | COSC_API cosc_int32 cosc_write_signature | ( | void * | buffer, |
| cosc_int32 | size, | ||
| const char * | address, | ||
| cosc_int32 | address_n, | ||
| const char * | typetag, | ||
| cosc_int32 | typetag_n, | ||
| cosc_int32 | psize ) |
Write an OSC message signature.
| [out] | buffer | If non-NULL store the OSC data here, if NULL then no bytes are stored. |
| size | Store at most this many bytes to buffer. | |
| address | The address. | |
| address_n | Read at most this many bytes from address. | |
| typetag | The typetag. | |
| typetag_n | Read at most this many bytes from typetag. | |
| psize | 0 for no packet size integer, < 0 to write a packet size integer based on the signature data or > 0 to set the packet size to a specific value. |
buffer is non-NULL, the required size if buffer is NULL or a negative error code if the operation fails. psize at the beginning of the buffer at a later time. address or typetag.Possible error codes:
buffer is non-NULL and size is too small.size > 0 and is invalid or too small. | COSC_API cosc_int32 cosc_write_string | ( | void * | buffer, |
| cosc_int32 | size, | ||
| const char * | value, | ||
| cosc_int32 | value_n, | ||
| cosc_int32 * | length ) |
Write a string.
| [out] | buffer | If non-NULL store the OSC data here, if NULL then no bytes are stored. |
| size | Store at most this many bytes to buffer. | |
| value | The string. | |
| value_n | Read at most this many bytes from s. | |
| [out] | length | If non-NULL and the function does not return a negative error code the length of the string, excluding the zero terminator, is stored here. |
buffer is non-NULL, the required size if buffer is NULL or a negative error code if the operation fails.Possible error codes:
buffer is non-NULL and size is too small.| COSC_API cosc_int32 cosc_write_uint32 | ( | void * | buffer, |
| cosc_int32 | size, | ||
| cosc_uint32 | value ) |
Write a 32-bit, big endian unsigned integer.
| [out] | buffer | If non-NULL store the OSC data here, if NULL then no bytes are stored. |
| size | Store at most this many bytes to buffer. | |
| value | The value. |
buffer is non-NULL, the required size if buffer is NULL or a negative error code if the operation fails.Possible error codes:
buffer is non-NULL and size is too small. | COSC_API cosc_int32 cosc_write_uint64 | ( | void * | buffer, |
| cosc_int32 | size, | ||
| cosc_uint64 | value ) |
Write a 64-bit, big endian unsigned integer.
| [out] | buffer | If non-NULL store the OSC data here, if NULL then no bytes are stored. |
| size | Store at most this many bytes to buffer. | |
| value | The value. |
buffer is non-NULL, the required size if buffer is NULL or a negative error code if the operation fails.Possible error codes:
buffer is non-NULL and size is too small. | COSC_API cosc_int32 cosc_write_value | ( | void * | buffer, |
| cosc_int32 | size, | ||
| char | type, | ||
| const union cosc_value * | value ) |
Write an OSC value.
| [out] | buffer | If non-NULL store the OSC data here, if NULL then no bytes are stored. |
| size | Store at most this many bytes to buffer. | |
| type | The type. | |
| value | The value or NULL for zeroed/empty. |
buffer is non-NULL, the required size if buffer is NULL or a negative error code if the operation fails.buffer is non-NULL and size is too small.size > COSC_SIZE_MAX.type is invalid. | COSC_API cosc_int32 cosc_write_values | ( | void * | buffer, |
| cosc_int32 | size, | ||
| const char * | types, | ||
| cosc_int32 | types_n, | ||
| const union cosc_value * | values, | ||
| cosc_int32 | values_n, | ||
| cosc_int32 * | value_count ) |
Write OSC values.
| [out] | buffer | If non-NULL store the OSC data here, if NULL then no bytes are stored. |
| size | Store at most this many bytes to buffer. | |
| types | The types, the starting comma may be omitted. | |
| types_n | Read at most this many bytes from types. | |
| values | The values. | |
| values_n | Read at most this many members from values. | |
| [out] | value_count | If non-NULL the number of written values is stored here. |
buffer is non-NULL, the required size if buffer is NULL or a negative error code if the operation fails. values_n is less than the values specified by typetag the remaining values are written as zero/empty.buffer is non-NULL and size is too small.size > COSC_SIZE_MAX.types is invalid. | COSC_API cosc_int32 cosc_writer_blob | ( | struct cosc_serial * | serial, |
| const void * | value, | ||
| cosc_int32 | value_n ) |
Write a blob.
| serial | The serial. |
| value | The blob data. |
| value_n | The byte size of the blob data. |
Error codes:
| COSC_API cosc_int32 cosc_writer_bytes | ( | struct cosc_serial * | serial, |
| const void * | value, | ||
| cosc_int32 | value_n ) |
Write bytes to a started blob level.
| serial | The serial. |
| value | The bytes or NULL to zero the bytes. |
| value_n | The number of bytes to write. |
Error codes:
| COSC_API cosc_int32 cosc_writer_char | ( | struct cosc_serial * | serial, |
| cosc_int32 | value ) |
Write an ASCII character.
| serial | The serial. |
| value | The value. |
Error codes:
| COSC_API cosc_int32 cosc_writer_end_blob | ( | struct cosc_serial * | serial | ) |
End a blob level.
| serial | The serial. |
Error codes:
| COSC_API cosc_int32 cosc_writer_end_bundle | ( | struct cosc_serial * | serial | ) |
End a bundle level.
| serial | The serial. |
Error codes:
| COSC_API cosc_int32 cosc_writer_end_message | ( | struct cosc_serial * | serial | ) |
End a message level.
| serial | The serial. |
Error codes:
| COSC_API cosc_int32 cosc_writer_float32 | ( | struct cosc_serial * | serial, |
| cosc_float32 | value ) |
Write a 32-bit float.
| serial | The serial. |
| value | The value. |
Error codes:
| COSC_API cosc_int32 cosc_writer_float64 | ( | struct cosc_serial * | serial, |
| cosc_float64 | value ) |
Write a 64-bit float.
| serial | The serial. |
| value | The value. |
Error codes:
| COSC_API cosc_int32 cosc_writer_int32 | ( | struct cosc_serial * | serial, |
| cosc_int32 | value ) |
Write a signed 32-bit integer.
| serial | The serial. |
| value | The value. |
Error codes:
| COSC_API cosc_int32 cosc_writer_int64 | ( | struct cosc_serial * | serial, |
| cosc_int64 | value ) |
Write a signed 64-bit integer.
| serial | The serial. |
| value | The value. |
Error codes:
| COSC_API cosc_int32 cosc_writer_message | ( | struct cosc_serial * | serial, |
| const struct cosc_message * | message, | ||
| cosc_int32 * | value_count ) |
Write an OSC message.
| serial | The serial. | |
| message | The message or NULL for an empty message. | |
| [out] | value_count | If non-NULL the number of written values is stored here. |
buffer is non-NULL, the required size if buffer is NULL or a negative error code if the operation fails. buffer is non-NULL and size is too small.size > COSC_SIZE_MAX.size > 0 and is invalid or too small. | COSC_API cosc_int32 cosc_writer_midi | ( | struct cosc_serial * | serial, |
| const unsigned char | value[4] ) |
Write a MIDI message.
| serial | The serial. |
| value | The value or NULL for all zeroes. |
Error codes:
| COSC_API cosc_int32 cosc_writer_repeat | ( | struct cosc_serial * | serial | ) |
Repeat typetag from the beginning of an array start, where the array starts with a '['.
| serial | The serial. |
Error codes:
| COSC_API void cosc_writer_setup | ( | struct cosc_serial * | serial, |
| void * | buffer, | ||
| cosc_int32 | buffer_size, | ||
| struct cosc_level * | levels, | ||
| cosc_int32 | level_max, | ||
| cosc_uint32 | flags ) |
Setup a serial for writing.
| [out] | serial | The serial. |
| buffer | A writable buffer, must not be NULL. | |
| buffer_size | The size of the buffer. | |
| levels | Provided levels, must point to an array of levels with at least one member. | |
| level_max | The number of provided levels, must be at least 1. | |
| flags | Serial flags, see COSC_SERIAL_* macros. |
| COSC_API cosc_int32 cosc_writer_skip | ( | struct cosc_serial * | serial | ) |
Skip a value, if the value has payload it will be zeroes.
| serial | The serial. |
Error codes:
| COSC_API cosc_int32 cosc_writer_start_blob | ( | struct cosc_serial * | serial | ) |
Start a new blob level.
| serial | The serial. |
Error codes:
| COSC_API cosc_int32 cosc_writer_start_bundle | ( | struct cosc_serial * | serial, |
| cosc_uint64 | timetag ) |
Start a new bundle level.
| serial | The serial. |
| timetag | A timetag for the bundle. |
Error codes:
| COSC_API cosc_int32 cosc_writer_start_message | ( | struct cosc_serial * | serial, |
| const char * | address, | ||
| cosc_int32 | address_n, | ||
| const char * | typetag, | ||
| cosc_int32 | typetag_n ) |
Start a new message level.
| serial | The serial. |
| address | The address. |
| address_n | Read at most this many bytes from address. |
| typetag | The typetag. |
| typetag_n | Read at most this many bytes from typetag. |
Error codes:
| COSC_API cosc_int32 cosc_writer_string | ( | struct cosc_serial * | serial, |
| const char * | value, | ||
| cosc_int32 | value_n, | ||
| cosc_int32 * | length ) |
Write a string.
| serial | The serial. | |
| value | The value. | |
| value_n | Read at most this many bytes from value. | |
| [out] | length | If non-NULL and the function does not return a negative error code the length, excluding the zero terminator, of the string is stored here. |
Error codes:
| COSC_API cosc_int32 cosc_writer_uint32 | ( | struct cosc_serial * | serial, |
| cosc_uint32 | value ) |
Write an unsigned 32-bit integer.
| serial | The serial. |
| value | The value. |
Error codes:
| COSC_API cosc_int32 cosc_writer_uint64 | ( | struct cosc_serial * | serial, |
| cosc_uint64 | value ) |
Write an unsigned 64-bit integer.
| serial | The serial. |
| value | The value. |
Error codes:
| COSC_API cosc_int32 cosc_writer_value | ( | struct cosc_serial * | serial, |
| cosc_int32 | type, | ||
| const union cosc_value * | value ) |
Write a value.
| serial | The serial. |
| type | The value typetag type. |
| value | The value or NULL for zero/empty. |
Error codes:
type is invalid.