Recording Callbacks

The current record implementation supports both direct recording and callback-driven asynchronous recording.

Direct Recording

Direct recording returns an audio value immediately.

x = record
y = record(0, 1000, 1)

Current argument meaning:

For ordinary record(), the engine currently accepts up to three explicit arguments:

Callback Form

The async form uses a callback name:

h = record(0, -1, 1, 100).cb1

In the current engine:

The callback name after the dot is required in callback mode.

Callback Payload

The current callback payload contains:

In AUX callback code, this payload is exposed through the input argument. The checked-in example cb1.aux uses:

That means the callback is invoked in phases:

Example

This example is already present in the repo and shows a plotting callback:

function [out,h,ax]=cb1(in)
if in.?index==0
    out = []
    h=figure
    ax = axes(h)
    ax.xlim=[0 10]
else
    out ++= in.?data
    plot(ax, out)
    ax.xlim=[0 10]
    repaint(h)
end

This pattern is useful because the callback can both:

Handle State During Recording

The runtime recording handle currently carries members such as:

These fields are updated while recording progresses, and auxlab2 also attaches callback outputs back onto the handle state when possible.

Notes

Current source basis: