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

Root namespace for the Operator SDK. More...

Namespaces

namespace  draw
 Screen drawing primitives for mode UIs: rectangles, text, and bitmaps.
namespace  params
 Declarative parameter DSL for modes: param specs and widget builders.
namespace  sdk
 Core SDK helpers for modes (timing, text, MIDI, and math).
namespace  sim
 The mock device a mode is tested against on a host machine.

Typedefs

using LogLevel = ::LogLevel
 Scoped alias for the log severity enum, so mode code writes op::LogLevel::Warn alongside the other op:: scoped enums.

Enumerations

enum class  Gesture : uint8_t
 Physical gesture kind for an input event. More...
enum class  GestureType : uint8_t
 Input-map resolved gesture type for an input event. More...

Functions

void log (LogLevel level, const char *message)
 Log a message to the device Log Monitor.
void log (LogLevel level, const char *label, int32_t value)
 Log a labeled integer.
void log (LogLevel level, const char *label, int32_t value, uint8_t decimals)
 Log a labeled fixed-point number.
int32_t write_file (const char *path, const uint8_t *buf, uint32_t size)
 Save a buffer as one of the mode's own files.

Variables

const OperatorApi * api
 Mode's handle to the device.

Detailed Description

Root namespace for the Operator SDK.

Typedef Documentation

◆ LogLevel

Scoped alias for the log severity enum, so mode code writes op::LogLevel::Warn alongside the other op:: scoped enums.

It names the same type as the extern "C" LogLevel above (identical uint8_t layout).

Enumeration Type Documentation

◆ Gesture

enum class op::Gesture : uint8_t
strong

Physical gesture kind for an input event.

For Rotate, mode_ui_gesture's value is the signed step count (positive clockwise, negative counter-clockwise, magnitude includes acceleration). For the presses value is 0. The order is ABI byte-stable.

◆ GestureType

enum class op::GestureType : uint8_t
strong

Input-map resolved gesture type for an input event.

A mode reads gesture_type for input-map-aware behavior, or reads encoder_id and gesture for raw, map-independent behavior. The two long-press types are firmware-reserved: the firmware intercepts them before dispatch, so a mode never observes them on any field. Which physical long-press maps to which reserved type follows the active Input Map. The order is ABI byte-stable.

Function Documentation

◆ log() [1/3]

void op::log ( LogLevel level,
const char * label,
int32_t value )
inline

Log a labeled integer.

log(LogLevel::Info, "count", 42) shows count: 42 on the Log Monitor.

◆ log() [2/3]

void op::log ( LogLevel level,
const char * label,
int32_t value,
uint8_t decimals )
inline

Log a labeled fixed-point number.

value carries decimals fractional digits, the same fixed-point convention as a Numeric param's decimal_places, so log(LogLevel::Info, "rate", 1250, 2) shows rate: 12.50.

◆ log() [3/3]

void op::log ( LogLevel level,
const char * message )
inline

Log a message to the device Log Monitor.

No-ops safely before a mode is fully loaded (while op::api is null).

◆ write_file()

int32_t op::write_file ( const char * path,
const uint8_t * buf,
uint32_t size )
inline

Save a buffer as one of the mode's own files.

Creates path, or replaces what is already there, writes size bytes and closes the file. Returns the bytes written on success. A negative return is -1 on an error, kStorageBusy while storage is busy, or kStorageNoSpace when there is no room left, and -1 before the mode is fully loaded (while op::api is null).

Parameters
pathRelative file name under the mode's storage area.
bufSource bytes.
sizeNumber of bytes to write.
Returns
Bytes written, or a negative storage result.

Variable Documentation

◆ api

const OperatorApi * op::api
extern

Mode's handle to the device.

Everything a mode can do goes through this pointer: sending MIDI, reading timing and parameters, drawing to the display, and reading storage. OP_MODE_REGISTER binds it from the pointer the firmware hands mode_init, before your init runs, and it stays valid for the life of the mode. It is null before the mode is loaded and again once mode_destroy has returned, so helpers that might run outside that window check it first.

Never define op::api yourself. Its definition is emitted into each mode's translation unit by OP_MODE_PARAMS or OP_MODE_NO_PARAMS. You just call through it, for example op::api->send_midi(...).