O2 2.0
A communication protocol for interactive music and media applications.
Public Attributes | List of all members
O2arg Union Reference

union of all O2 parameter types More...

#include <o2.h>

Public Attributes

int32_t i32
 32 bit signed integer.
 
int32_t i
 an alias for i32
 
int64_t i64
 64 bit signed integer.
 
int64_t h
 an alias for i64
 
float f
 32 bit IEEE-754 float.
 
float f32
 an alias for f
 
double d
 64 bit IEEE-754 double.
 
double f64
 an alias for d
 
char s [4]
 Standard C, NULL terminated string.
 
char S [4]
 Standard C, NULL terminated, string. Used in systems which distinguish strings and symbols.
 
int c
 Standard C, 8 bit, char, stored as int.
 
uint32_t m
 
O2time t
 TimeTag value.
 
O2blob b
 a blob (unstructured bytes)
 
int32_t B
 a boolean value, either 0 or 1
 
struct {
   int32_t   len
 IMPORTANT: divide by 4 or 8 to get length in elements. More...
 
   int32_t   typ
 type of vector elements
 
   union {
      int32_t *   vi
 vector of 32-bit signed integers
 
      int64_t *   vh
 vector of 64-bit signed integers
 
      double *   vd
 vector of IEEE-754 doubles
 
      float *   vf
 vector of IEEE-754 floats
 
   } 
 
v
 

Detailed Description

union of all O2 parameter types

An O2arg_ptr is a pointer to an O2 message argument. If argument parsing is requested (by setting the parse parameter in o2_method_new), then the handler receives an array of O2arg_ptrs. If argument parsing is not requested, you have the option of parsing the message one parameter at a time by calling o2_get_next, which returns an O2arg_ptr.

The O2arg_ptr can then be dereferenced to obtain a value of the expected type. For example, you could write

double d = o2_get_next(O2_DOUBLE)->d;
@ O2_DOUBLE
64 bit IEEE-754 double.
Definition: o2.h:729
O2arg_ptr o2_get_next(O2type to_type)
get the next message parameter
Definition: message.cpp:1018
double d
64 bit IEEE-754 double.
Definition: o2.h:771

to extract a parameter of type double. (This assumes that the message is properly formed and the type string indicates that this parameter is a double, or that type coercion was enabled by the coerce flag in o2_method_new.)

Member Data Documentation

◆ len

int32_t O2arg::len

IMPORTANT: divide by 4 or 8 to get length in elements.

length of vector in bytes

◆ m

uint32_t O2arg::m

A 4 byte MIDI packet. MSB to LSB are port id, status, data1, data2


The documentation for this union was generated from the following file: