Real Time Open Sound Control librtosc: /build/rtosc/src/rtosc-0.3.1/include/rtosc/default-value.h File Reference

Real Time Open Sound Control librtosc

Loading...
Searching...
No Matches
Functions
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_name | the port's OSC path.
  port_args | the port's arguments, e.g. '::i:c:S'
  ports | the ports where portname is to be searched
  runtime | object holding ports . Optional. Helps finding default values dependent on others, such as presets.
  port_hint | The port itself corresponding to portname (including the args). If not specified, will be found using `portname` .
  idx | If the port is an array (using the '#' notation), this specifies the index required for the default value
  n | Size of the output parameter @res . This size can not be known, so you should provide a large enough array.
  res | The output parameter for the argument values.
  strbuf | String buffer for storing pretty printed strings and blobs.
  strbufsize | Size 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