Skip to content

File wfm_plan.h

FileList > inc > wfm > wfm_plan.h

Go to the source code of this file

  • #include <complex.h>
  • #include <stddef.h>
  • #include <stdint.h>

Public Types

Type Name
typedef struct wfm_plan wfm_plan_t

Public Functions

Type Name
uint64_t wfm_plan_anchor_seed (const wfm_plan_t * p)
The noise seed that reproduces a full compose.
size_t wfm_plan_at (const wfm_plan_t * p, double snr, uint64_t seed, float _Complex * out)
Scalar fast-path for the hot Monte-Carlo/SNR loop (no JSON parse).
void wfm_plan_destroy (wfm_plan_t * p)
Destroy a Plan and free its caches. NULL is a no-op.
size_t wfm_plan_len (const wfm_plan_t * p)
Cached length in samples (the jm binding's out_len_fn).
size_t wfm_plan_n_sources (const wfm_plan_t * p)
Number of cached signal sources (excludes the noise floor).
wfm_plan_t * wfm_plan_prepare (const char * spec_json)
Prepare a Plan from a composer spec JSON (Composer.to_json()).
size_t wfm_plan_render (const wfm_plan_t * p, const char * overrides_json, float _Complex * out)
General render: apply a JSON override spec, return a cf32 array.

Public Types Documentation

typedef wfm_plan_t

typedef struct wfm_plan wfm_plan_t;

Opaque prepared-plan state.


Public Functions Documentation

function wfm_plan_anchor_seed

The noise seed that reproduces a full compose.

uint64_t wfm_plan_anchor_seed (
    const wfm_plan_t * p
) 

Passing this as wfm_plan_at's seed (with the scene's base SNR) yields the byte-identical output of wfm_compose. Varying the seed draws independent Monte-Carlo noise realizations over the same signal.


function wfm_plan_at

Scalar fast-path for the hot Monte-Carlo/SNR loop (no JSON parse).

size_t wfm_plan_at (
    const wfm_plan_t * p,
    double snr,
    uint64_t seed,
    float _Complex * out
) 

out = Σ gain_k·cache_k + gain(snr)·noise(seed); writes wfm_plan_len(p) samples. Equivalent to render with only {"snr":snr,"seed":seed}.

Returns:

Samples written (== wfm_plan_len(p)).


function wfm_plan_destroy

Destroy a Plan and free its caches. NULL is a no-op.

void wfm_plan_destroy (
    wfm_plan_t * p
) 


function wfm_plan_len

Cached length in samples (the jm binding's out_len_fn).

size_t wfm_plan_len (
    const wfm_plan_t * p
) 


function wfm_plan_n_sources

Number of cached signal sources (excludes the noise floor).

size_t wfm_plan_n_sources (
    const wfm_plan_t * p
) 


function wfm_plan_prepare

Prepare a Plan from a composer spec JSON (Composer.to_json()).

wfm_plan_t * wfm_plan_prepare (
    const char * spec_json
) 

Parses + resolves the scene, validates the v1 scope, then renders and caches each signal source at gain 1. Returns NULL on parse failure or an out-of-scope spec (multi-segment, continuous/repeat, ranged, a non-trailing or multiple noise source, or a lone bundled noisy source).

Parameters:

  • spec_json A NUL-terminated composer spec JSON string.

Returns:

Heap Plan (caller wfm_plan_destroy()s it), or NULL.


function wfm_plan_render

General render: apply a JSON override spec, return a cf32 array.

size_t wfm_plan_render (
    const wfm_plan_t * p,
    const char * overrides_json,
    float _Complex * out
) 

overrides_json is a small JSON object, all keys optional: {"gains":[dB…], "phases":[rad…], "enable":[bool…], "snr":dB, "seed":u} (gains/phases/enable are per-source, length = wfm_plan_n_sources()). An empty object (or NULL) renders the baseline — bit-identical to Composer(scene).compose(). Writes wfm_plan_len(p) samples to out.

Returns:

Samples written (== wfm_plan_len(p)).



The documentation for this class was generated from the following file native/inc/wfm/wfm_plan.h