Oakfield API Documentation 1.0.0
Numerical core APIs
Loading...
Searching...
No Matches
fourier.h File Reference

Bandlimited Fourier waveform stimulus (saw / square / triangle; BLIT, PolyBLEP, miniBLEP). More...

#include "oakfield/operator_split.h"
#include <stdbool.h>
#include <stddef.h>
Include dependency graph for operators/stimulus/fourier.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SimFourierWaveformConfig
 Configuration for Fourier waveform stimulus. More...
 

Typedefs

typedef enum SimFourierWaveformShape SimFourierWaveformShape
 Waveform shapes produced by the Fourier stimulus.
 
typedef enum SimFourierWaveformMethod SimFourierWaveformMethod
 Bandlimiting methods used by Fourier waveform synthesis.
 
typedef struct SimFourierWaveformConfig SimFourierWaveformConfig
 Configuration for Fourier waveform stimulus.
 

Enumerations

enum  SimFourierWaveformShape { SIM_FOURIER_WAVEFORM_SAW = 0 , SIM_FOURIER_WAVEFORM_SQUARE , SIM_FOURIER_WAVEFORM_TRIANGLE }
 Waveform shapes produced by the Fourier stimulus. More...
 
enum  SimFourierWaveformMethod { SIM_FOURIER_METHOD_BLIT = 0 , SIM_FOURIER_METHOD_POLYBLEP , SIM_FOURIER_METHOD_MINIBLEP }
 Bandlimiting methods used by Fourier waveform synthesis. More...
 

Functions

SimResult sim_add_stimulus_fourier_operator (struct SimContext *context, const SimFourierWaveformConfig *config, size_t *out_index)
 Register a bandlimited Fourier waveform stimulus operator.
 
SimResult sim_stimulus_fourier_config (struct SimContext *context, size_t operator_index, SimFourierWaveformConfig *out_config)
 Copy the current Fourier waveform configuration from a registered operator.
 
SimResult sim_stimulus_fourier_update (struct SimContext *context, size_t operator_index, const SimFourierWaveformConfig *config)
 Replace or renormalize a registered Fourier waveform configuration.
 

Detailed Description

Bandlimited Fourier waveform stimulus (saw / square / triangle; BLIT, PolyBLEP, miniBLEP).

Typedef Documentation

◆ SimFourierWaveformConfig

Configuration for Fourier waveform stimulus.

All frequencies are in Hz. Phase is normalized to [0,1).

Enumeration Type Documentation

◆ SimFourierWaveformMethod

Bandlimiting methods used by Fourier waveform synthesis.

Enumerator
SIM_FOURIER_METHOD_BLIT 

Bandlimited impulse train method.

SIM_FOURIER_METHOD_POLYBLEP 

Polynomial bandlimited step method.

SIM_FOURIER_METHOD_MINIBLEP 

Windowed-sinc miniBLEP method.

◆ SimFourierWaveformShape

Waveform shapes produced by the Fourier stimulus.

Enumerator
SIM_FOURIER_WAVEFORM_SAW 

Sawtooth waveform.

SIM_FOURIER_WAVEFORM_SQUARE 

Square waveform.

SIM_FOURIER_WAVEFORM_TRIANGLE 

Triangle waveform.

Function Documentation

◆ sim_add_stimulus_fourier_operator()

SimResult sim_add_stimulus_fourier_operator ( struct SimContext context,
const SimFourierWaveformConfig config,
size_t *  out_index 
)

Register a bandlimited Fourier waveform stimulus operator.

The implementation copies and normalizes config, initializes the requested waveform state, and registers the operator on the target field.

Parameters
contextSimulation context that will own the operator.
configOptional waveform configuration; NULL selects normalized defaults.
[out]out_indexOptional destination for the registered operator index.
Returns
SIM_RESULT_OK on success, or an error code from validation, allocation, or split-operator registration.

◆ sim_stimulus_fourier_config()

SimResult sim_stimulus_fourier_config ( struct SimContext context,
size_t  operator_index,
SimFourierWaveformConfig out_config 
)

Copy the current Fourier waveform configuration from a registered operator.

Parameters
contextSimulation context containing the operator.
operator_indexIndex returned by sim_add_stimulus_fourier_operator().
[out]out_configReceives the operator's normalized configuration.
Returns
SIM_RESULT_OK on success, SIM_RESULT_INVALID_ARGUMENT for NULL pointers, SIM_RESULT_NOT_FOUND for a missing operator, or SIM_RESULT_INVALID_STATE when the operator has no stimulus state.

◆ sim_stimulus_fourier_update()

SimResult sim_stimulus_fourier_update ( struct SimContext context,
size_t  operator_index,
const SimFourierWaveformConfig config 
)

Replace or renormalize a registered Fourier waveform configuration.

Passing NULL for config keeps the existing configuration and reapplies normalization. A successful update refreshes waveform state and invalidates the scheduler plan.

Parameters
contextSimulation context containing the operator.
operator_indexIndex of the Fourier waveform operator to update.
configOptional replacement configuration.
Returns
SIM_RESULT_OK on success, or an error code if lookup or state validation fails.