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

Saving a whole file in one call with op::write_file(...). More...

#include <cstdint>
#include <operator_sdk/abi/mode_api.h>

Namespaces

namespace  op
 Root namespace for the Operator SDK.

Functions

int32_t op::write_file (const char *path, const uint8_t *buf, uint32_t size)
 Save a buffer as one of the mode's own files.

Detailed Description

Saving a whole file in one call with op::write_file(...).

Opt-in, header-only. Include on demand:

#include <operator_sdk/storage.h>
const uint8_t bytes[] = {0x01, 0x02, 0x03};
int32_t written = op::write_file("clip.bin", bytes, sizeof(bytes));

op::write_file opens the file, writes the whole buffer, and closes it again. The path is a relative name under the mode's own storage area. A large recording that arrives in pieces is better written through storage_file_open_write, storage_file_write and storage_file_close, holding the handle across process() calls.