VCV Rack API v2
|
#include <cstddef>
#include <cstdlib>
#include <cstdio>
#include <cstdint>
#include <cinttypes>
#include <cstdarg>
#include <climits>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <stdexcept>
#include <arch.hpp>
#include <logger.hpp>
Go to the source code of this file.
Classes | |
struct | rack::DeferWrapper< F > |
Defers running code until the scope is destructed. More... | |
struct | rack::Exception |
An exception explicitly thrown by Rack or a Rack plugin. More... | |
Namespaces | |
namespace | rack |
Root namespace for the Rack API. | |
Macros | |
#define | DEPRECATED __attribute__((deprecated)) |
Attribute for deprecated functions and symbols. | |
#define | PRIVATE |
Attribute for private functions not intended to be called by plugins. | |
#define | CONCAT_LITERAL(x, y) |
Concatenates two literals or two macros Example: | |
#define | CONCAT(x, y) |
#define | TOSTRING_LITERAL(x) |
Surrounds raw text with quotes Example: | |
#define | TOSTRING(x) |
#define | LENGTHOF(arr) |
Produces the length of a static array in number of elements. | |
#define | ENUMS(name, count) |
Reserve space for count enums starting with name . | |
#define | BINARY(sym) |
References binary files compiled into the program. | |
#define | BINARY_START(sym) |
#define | BINARY_END(sym) |
#define | BINARY_SIZE(sym) |
#define | DEFER(code) |
Functions | |
int8_t | operator""_i8 (unsigned long long x) |
Helpful user-defined literals for specifying exact integer and float types. | |
int16_t | operator""_i16 (unsigned long long x) |
int32_t | operator""_i32 (unsigned long long x) |
int64_t | operator""_i64 (unsigned long long x) |
uint8_t | operator""_u8 (unsigned long long x) |
uint16_t | operator""_u16 (unsigned long long x) |
uint32_t | operator""_u32 (unsigned long long x) |
uint64_t | operator""_u64 (unsigned long long x) |
float | operator""_f32 (long double x) |
float | operator""_f32 (unsigned long long x) |
double | operator""_f64 (long double x) |
double | operator""_f64 (unsigned long long x) |
template<typename To , typename From > | |
To | rack::bitCast (From from) |
Casts a primitive, preserving its bits instead of converting. | |
template<typename T > | |
T * | rack::construct () |
C#-style property constructor Example: | |
template<typename T , typename F , typename V , typename... Args> | |
T * | rack::construct (F f, V v, Args... args) |
template<typename F > | |
DeferWrapper< F > | rack::deferWrapper (F f) |
template<typename C > | |
const C::mapped_type & | rack::get (const C &c, const typename C::key_type &key, const typename C::mapped_type &def=typename C::mapped_type()) |
Given a std::map c , returns the value of the given key, or returns def if the key doesn't exist. | |
template<typename C > | |
const C::value_type & | rack::get (const C &c, typename C::size_type i, const typename C::value_type &def=typename C::value_type()) |
Given a std::vector c , returns the value of the given index i , or returns def if the index is out of bounds. | |
Variables | |
const std::string | rack::APP_NAME |
const std::string | rack::APP_EDITION |
const std::string | rack::APP_EDITION_NAME |
const std::string | rack::APP_VERSION_MAJOR |
const std::string | rack::APP_VERSION |
const std::string | rack::APP_OS |
const std::string | rack::APP_OS_NAME |
const std::string | rack::APP_CPU |
const std::string | rack::APP_CPU_NAME |
const std::string | rack::API_URL |
#define DEPRECATED __attribute__((deprecated)) |
Attribute for deprecated functions and symbols.
E.g.
DEPRECATED void foo();
#define PRIVATE |
Attribute for private functions not intended to be called by plugins.
When #including rack.hpp, attempting to call PRIVATE functions will result in a compile-time error.
#define CONCAT_LITERAL | ( | x, | |
y ) |
Concatenates two literals or two macros Example:
#define COUNT 42 CONCAT(myVariable, COUNT)
expands to
myVariable42
#define CONCAT | ( | x, | |
y ) |
#define TOSTRING_LITERAL | ( | x | ) |
Surrounds raw text with quotes Example:
#define NAME "world" printf("Hello " TOSTRING(NAME))
expands to
printf("Hello " "world")
and of course the C++ lexer/parser then concatenates the string literals.
#define TOSTRING | ( | x | ) |
#define LENGTHOF | ( | arr | ) |
Produces the length of a static array in number of elements.
#define ENUMS | ( | name, | |
count ) |
Reserve space for count
enums starting with name
.
Example:
enum Foo { ENUMS(BAR, 14), BAZ };
BAR + 0
to BAR + 13
is reserved. BAZ
has a value of 14.
#define BINARY | ( | sym | ) |
References binary files compiled into the program.
For example, to include a file "Test.dat" directly into your program binary, add
BINARIES += Test.dat
to your Makefile and declare
BINARY(Test_dat);
at the root of a .c or .cpp source file. Note that special characters are replaced with "_". Then use
BINARY_START(Test_dat) BINARY_END(Test_dat)
to reference the data beginning and end as a void* array, and
BINARY_SIZE(Test_dat)
to get its size in bytes.
#define BINARY_START | ( | sym | ) |
#define BINARY_END | ( | sym | ) |
#define BINARY_SIZE | ( | sym | ) |
#define DEFER | ( | code | ) |
|
inline |
Helpful user-defined literals for specifying exact integer and float types.
Usage examples: 42_i8 -4242_u16 0x4a2b_i32 0b11010111000000_u64 42_f32 4.2e-4_f64
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |