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

Field mixing/coupling operators (linear, multiply, crossfade, AM/FM/PM, etc.). More...

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

Go to the source code of this file.

Classes

struct  SimMixerOperatorConfig
 Configuration parameters for the mixer operator. More...
 

Typedefs

typedef enum SimMixerMode SimMixerMode
 Mixing strategies supported by the mixer operator family.
 
typedef enum SimMixerFeedbackEpsilonMode SimMixerFeedbackEpsilonMode
 Interpretation of feedback_epsilon in feedback mixer mode.
 
typedef enum SimMixerFeedbackSplitMode SimMixerFeedbackSplitMode
 Operator splitting strategy for feedback mixer integration.
 
typedef struct SimMixerOperatorConfig SimMixerOperatorConfig
 Configuration parameters for the mixer operator.
 

Enumerations

enum  SimMixerMode {
  SIM_MIXER_MODE_LINEAR = 0 , SIM_MIXER_MODE_MULTIPLY , SIM_MIXER_MODE_CROSSFADE , SIM_MIXER_MODE_SUM ,
  SIM_MIXER_MODE_POWER , SIM_MIXER_MODE_AM , SIM_MIXER_MODE_FM , SIM_MIXER_MODE_PM ,
  SIM_MIXER_MODE_RING_MOD , SIM_MIXER_MODE_MAX , SIM_MIXER_MODE_MIN , SIM_MIXER_MODE_AVERAGE ,
  SIM_MIXER_MODE_DIFFERENCE , SIM_MIXER_MODE_ABSOLUTE_DIFFERENCE , SIM_MIXER_MODE_FEEDBACK
}
 Mixing strategies supported by the mixer operator family. More...
 
enum  SimMixerFeedbackEpsilonMode { SIM_MIXER_FEEDBACK_EPS_INPUT = 0 , SIM_MIXER_FEEDBACK_EPS_FEEDBACK }
 Interpretation of feedback_epsilon in feedback mixer mode. More...
 
enum  SimMixerFeedbackSplitMode { SIM_MIXER_FEEDBACK_SPLIT_NONE = 0 , SIM_MIXER_FEEDBACK_SPLIT_LIE , SIM_MIXER_FEEDBACK_SPLIT_STRANG }
 Operator splitting strategy for feedback mixer integration. More...
 

Functions

const char * mixer_mode_name (SimMixerMode mode)
 Return the schema name for a mixer mode.
 
const char * mixer_feedback_epsilon_mode_name (SimMixerFeedbackEpsilonMode mode)
 Return the schema name for a feedback epsilon interpretation mode.
 
const char * mixer_feedback_split_name (SimMixerFeedbackSplitMode mode)
 Return the schema name for a feedback split mode.
 
bool mixer_mode_from_name (const char *name, SimMixerMode *out_mode)
 Convert a schema/descriptor string value into a mixer mode enum.
 
bool mixer_feedback_epsilon_mode_from_name (const char *name, SimMixerFeedbackEpsilonMode *out_mode)
 Parse a feedback epsilon mode name.
 
bool mixer_feedback_split_from_name (const char *name, SimMixerFeedbackSplitMode *out_mode)
 Parse a feedback split mode name.
 
SimResult sim_add_mixer_operator (struct SimContext *context, const SimMixerOperatorConfig *config, size_t *out_index)
 Register a mixer operator combining two fields.
 
SimResult sim_mixer_config (struct SimContext *context, size_t operator_index, SimMixerOperatorConfig *out_config)
 Retrieve the configuration stored in a mixer operator.
 
SimResult sim_mixer_update (struct SimContext *context, size_t operator_index, const SimMixerOperatorConfig *config)
 Update an existing mixer operator's configuration.
 

Detailed Description

Field mixing/coupling operators (linear, multiply, crossfade, AM/FM/PM, etc.).

Supports real and complex fields; for complex, operations are applied component-wise unless the mode explicitly defines a complex interaction (e.g., ring modulation).

Enumeration Type Documentation

◆ SimMixerFeedbackEpsilonMode

Interpretation of feedback_epsilon in feedback mixer mode.

Enumerator
SIM_MIXER_FEEDBACK_EPS_INPUT 

Epsilon scales the input injection term.

SIM_MIXER_FEEDBACK_EPS_FEEDBACK 

Epsilon scales the feedback (previous output) term.

◆ SimMixerFeedbackSplitMode

Operator splitting strategy for feedback mixer integration.

Enumerator
SIM_MIXER_FEEDBACK_SPLIT_NONE 

No split integration for feedback.

SIM_MIXER_FEEDBACK_SPLIT_LIE 

Lie splitting for feedback updates.

SIM_MIXER_FEEDBACK_SPLIT_STRANG 

Strang splitting for feedback updates.

◆ SimMixerMode

Mixing strategies supported by the mixer operator family.

Enumerator
SIM_MIXER_MODE_LINEAR 

Weighted linear blend.

SIM_MIXER_MODE_MULTIPLY 

Pointwise multiplication.

SIM_MIXER_MODE_CROSSFADE 

Crossfade between lhs and rhs.

SIM_MIXER_MODE_SUM 

Sum inputs after gain and bias.

SIM_MIXER_MODE_POWER 

Raise lhs by rhs-derived exponent.

SIM_MIXER_MODE_AM 

Amplitude modulation.

SIM_MIXER_MODE_FM 

Frequency-modulation-style phase coupling.

SIM_MIXER_MODE_PM 

Phase modulation.

SIM_MIXER_MODE_RING_MOD 

Ring modulation product.

SIM_MIXER_MODE_MAX 

Pointwise maximum.

SIM_MIXER_MODE_MIN 

Pointwise minimum.

SIM_MIXER_MODE_AVERAGE 

Pointwise average.

SIM_MIXER_MODE_DIFFERENCE 

Signed lhs-rhs difference.

SIM_MIXER_MODE_ABSOLUTE_DIFFERENCE 

Absolute lhs-rhs difference.

SIM_MIXER_MODE_FEEDBACK 

Feedback coupling mode.

Function Documentation

◆ mixer_feedback_epsilon_mode_from_name()

bool mixer_feedback_epsilon_mode_from_name ( const char *  name,
SimMixerFeedbackEpsilonMode out_mode 
)

Parse a feedback epsilon mode name.

Parameters
nameSchema value string.
[out]out_modeFilled with the corresponding enum on success.
Returns
true when name maps to a known feedback epsilon mode.

◆ mixer_feedback_epsilon_mode_name()

const char * mixer_feedback_epsilon_mode_name ( SimMixerFeedbackEpsilonMode  mode)

Return the schema name for a feedback epsilon interpretation mode.

Parameters
modeFeedback epsilon mode value.
Returns
Stable lowercase mode name.

◆ mixer_feedback_split_from_name()

bool mixer_feedback_split_from_name ( const char *  name,
SimMixerFeedbackSplitMode out_mode 
)

Parse a feedback split mode name.

Parameters
nameSchema value string.
[out]out_modeFilled with the corresponding enum on success.
Returns
true when name maps to a known feedback split mode.

◆ mixer_feedback_split_name()

const char * mixer_feedback_split_name ( SimMixerFeedbackSplitMode  mode)

Return the schema name for a feedback split mode.

Parameters
modeFeedback split mode value.
Returns
Stable lowercase mode name.

◆ mixer_mode_from_name()

bool mixer_mode_from_name ( const char *  name,
SimMixerMode out_mode 
)

Convert a schema/descriptor string value into a mixer mode enum.

Parameters
nameSchema value string such as "linear" or "multiply".
[out]out_modeFilled with the corresponding enum on success.
Returns
true when the string maps to a known mixer mode.

◆ mixer_mode_name()

const char * mixer_mode_name ( SimMixerMode  mode)

Return the schema name for a mixer mode.

Parameters
modeMixer mode value.
Returns
Stable lowercase mode name.

◆ sim_add_mixer_operator()

SimResult sim_add_mixer_operator ( struct SimContext context,
const SimMixerOperatorConfig config,
size_t *  out_index 
)

Register a mixer operator combining two fields.

Parameters
contextSimulation context that will own the operator.
configOptional mixer 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 argument validation, mode validation, field compatibility checks, allocation, or registration.

◆ sim_mixer_config()

SimResult sim_mixer_config ( struct SimContext context,
size_t  operator_index,
SimMixerOperatorConfig out_config 
)

Retrieve the configuration stored in a mixer operator.

Parameters
contextSimulation context containing the operator.
operator_indexIndex returned by sim_add_mixer_operator().
[out]out_configReceives the 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 mixer state.

◆ sim_mixer_update()

SimResult sim_mixer_update ( struct SimContext context,
size_t  operator_index,
const SimMixerOperatorConfig config 
)

Update an existing mixer operator's configuration.

Passing NULL for config keeps the current configuration and reapplies normalization. A successful update refreshes runtime/symbolic state and invalidates the scheduler plan.

Parameters
contextSimulation context containing the operator.
operator_indexIndex of the mixer operator to update.
configOptional replacement configuration.
Returns
SIM_RESULT_OK on success, or an error code from lookup, mode validation, field compatibility checks, or state validation.