Operator SDK
Build MIDI processing and UI modes for the Operator device
Loading...
Searching...
No Matches
op::params Namespace Reference

Declarative parameter DSL for modes: param specs and widget builders. More...

Classes

struct  Numeric
 An integer parameter with a min, max, step, and optional decimals. More...
struct  Bool
 A two-state on/off toggle. More...
struct  Enum
 A single choice from a fixed list of named options. More...
struct  List
 A multi-select set of named options stored as a bitmask. More...
struct  Note
 A single MIDI note (0..127) shown with a note-name label. More...
struct  Range
 A low/high pair of integers (a span the user dials at both ends). More...
struct  NoteRange
 A low/high pair of MIDI notes shown with note-name labels. More...
struct  FilePicker
 A picker that lets the user choose a file from storage. More...
struct  FilePickerValue
 The value returned by param<>() for a FilePicker parameter. More...
struct  Section
 A named grouping header for the params that follow it. More...
struct  Action
 A button that runs one of the mode's functions when selected. More...

Typedefs

using Op = ::op::modes::op_params::Op
 Comparison used by a parameter's visible_when gate.

Functions

template<typename T>
constexpr VisibleWhen gate (const T &watcher, Op op, int8_t value)
 Gate a parameter's visibility on another parameter's current value.
constexpr VisibleWhen hidden ()
 Mark a state-only param as always hidden.
template<typename... Children>
constexpr detail::SectionGroup< Children... > make_section (std::string_view name, Children... children)
 Build a Section together with its children in one expression.

Detailed Description

Declarative parameter DSL for modes: param specs and widget builders.

Typedef Documentation

◆ Op

Comparison used by a parameter's visible_when gate.

This is the operator field of a visible_when gate (see gate). Write it as Op::Eq, Op::Neq, Op::Gt, Op::Gte, Op::Lt, or Op::Lte at the call site. See op::modes::op_params::Op for what each one means.

Function Documentation

◆ gate()

template<typename T>
VisibleWhen op::params::gate ( const T & watcher,
Op op,
int8_t value )
constexpr

Gate a parameter's visibility on another parameter's current value.

Call-form shorthand for a conditional .visible_when. Use it whenever a param should only appear in certain states, for example hiding an LFO's depth and rate until its source enum is set, or hiding "Maximum" while a "Constant" toggle is on. The call form and the designated-initializer aggregate are exactly equivalent, so pick whichever reads better at the call site:

.visible_when = gate(Constant, Op::Eq, false)                     // call
.visible_when = {.watch = Constant, .op = Op::Eq, .value = false} // aggregate

Both keep the param visible only while Constant == false.

Parameters
watcherThe other param object to watch (bare reference, no &).
opHow to compare the watcher's value (see Op).
valueThe value to compare the watcher against.
Returns
A VisibleWhen to assign to a param's .visible_when field.

◆ hidden()

VisibleWhen op::params::hidden ( )
constexpr

Mark a state-only param as always hidden.

A param carrying .visible_when = hidden() is persisted across reboots and never drawn on the param page, which suits a value the mode keeps for itself and only needs stored.

Returns
A gate that keeps the param off the param page.

◆ make_section()

template<typename... Children>
detail::SectionGroup< Children... > op::params::make_section ( std::string_view name,
Children... children )
constexpr

Build a Section together with its children in one expression.

The structural form: pass the section name and its child params inline and they are parented to the new Section automatically.

OP_MODE_PARAMS(make_section("LFO", Bool{.name="On"},
                            Numeric{.name="Rate", ...}))

Children here must stay ungated (leave their .visible_when at the default). Inline children have no name a gate watcher could reference, so declare gated params flat-form at file scope and use .parent instead.

Parameters
nameThe section's display name.
childrenThe params to place inside the section.
Returns
A group value to pass straight into OP_MODE_PARAMS().