Real Time Open Sound Control librtosc
Loading...
Searching...
No Matches
default-value.h File Reference

Functions for retrieving default values from metadata (and runtime) More...

#include <cstdint>
#include <rtosc/rtosc.h>

Go to the source code of this file.

Functions

const char * rtosc::get_default_value (const char *port_name, const struct Ports &ports, void *runtime, const struct Port *port_hint=nullptr, int32_t idx=-1, int recursive=1)
 Return a port's default value.
 
int rtosc::get_default_value (const char *port_name, const char *port_args, const struct Ports &ports, void *runtime, const struct Port *port_hint, int32_t idx, std::size_t n, rtosc_arg_val_t *res, char *strbuf, size_t strbufsize)
 Return a port's default value.
 

Detailed Description

Functions for retrieving default values from metadata (and runtime)

Test
default-value.cpp

Function Documentation

◆ get_default_value() [1/2]

int rtosc::get_default_value ( const char * port_name,
const char * port_args,
const struct Ports & ports,
void * runtime,
const struct Port * port_hint,
int32_t idx,
std::size_t n,
rtosc_arg_val_t * res,
char * strbuf,
size_t strbufsize )

Return a port's default value.

Returns the default value of a given port, if any exists, as an array of rtosc_arg_vals . The values in the resulting array are being canonicalized, i.e. mapped values are being converted to integers; see canonicalize_arg_vals() .

Parameters
port_namethe port's OSC path.
port_argsthe port's arguments, e.g. 'i:c:S'
portsthe ports where portname is to be searched
runtimeobject holding ports . Optional. Helps finding default values dependent on others, such as presets.
port_hintThe port itself corresponding to portname (including the args). If not specified, will be found using portname .
idxIf the port is an array (using the '#' notation), this specifies the index required for the default value
nSize of the output parameter @res . This size can not be known, so you should provide a large enough array.
resThe output parameter for the argument values.
strbufString buffer for storing pretty printed strings and blobs.
strbufsizeSize of strbuf
Returns
The actual number of aruments written to res (can be smaller than n) or -1 if there is no valid default annotation

◆ get_default_value() [2/2]

const char * rtosc::get_default_value ( const char * port_name,
const struct Ports & ports,
void * runtime,
const struct Port * port_hint = nullptr,
int32_t idx = -1,
int recursive = 1 )

Return a port's default value.

Returns the default value of a given port, if any exists, as a string. For the parameters, see the overloaded function.

Note
The recursive parameter should never be specified.
Returns
The default value(s), pretty-printed, or NULL if there is no valid default annotation