Operator SDK
Build MIDI processing and UI modes for the Operator device
Loading...
Searching...
No Matches
math.h File Reference

Value-mapping helpers (opt-in, header-only). More...

#include <cstdint>

Namespaces

namespace  op::sdk::math
 Value-range mapping helpers.
namespace  op
 Root namespace for the Operator SDK.
namespace  op::sdk
 Core SDK helpers for modes (timing, text, MIDI, and math).

Functions

int32_t op::sdk::math::map_linear (int32_t v, int32_t in_lo, int32_t in_hi, int32_t out_lo, int32_t out_hi)
 Linearly map v from [in_lo, in_hi] to [out_lo, out_hi].
float op::sdk::math::map_exp (float v, float in_lo, float in_hi, float out_lo, float out_hi)
 Exponential-curve map (input perceived linearly, output bent toward out_lo).
float op::sdk::math::map_log (float v, float in_lo, float in_hi, float out_lo, float out_hi)
 Logarithmic-curve map (input perceived linearly, output bent toward out_hi).

Detailed Description

Value-mapping helpers (opt-in, header-only).

Header-only, opt-in, so usage is on demand. These map a value from one numeric range into another. map_linear is integer-only. map_exp and map_log return float and bend the curve, so they suit UI or other non-hot-path code.