Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::FmOperatorEngineT< SampleType, MaxOperators > Class Template Reference

Bounded melodic FM/PM operator engine. More...

#include <fm_operator_engine.hpp>

Classes

struct  Envelope

Public Types

using Routing = FmOperatorRoutingT<SampleType, MaxOperators>
using FrequencyMode = FmOperatorFrequencyMode
using AliasPolicy = FmOperatorAliasPolicy
using TrigProfile = FastTrigProfile

Public Member Functions

 FmOperatorEngineT ()
void prepare (double sample_rate) noexcept
void reset () noexcept
void note_on (SampleType velocity=SampleType{1}) noexcept
void note_off () noexcept
void set_operator_count (std::size_t count) noexcept
std::size_t operator_count () const noexcept
void set_base_frequency_hz (SampleType hz) noexcept
SampleType base_frequency_hz () const noexcept
void set_operator_frequency_mode (std::size_t op, FrequencyMode mode) noexcept
FrequencyMode operator_frequency_mode (std::size_t op) const noexcept
void set_operator_ratio (std::size_t op, SampleType ratio) noexcept
SampleType operator_ratio (std::size_t op) const noexcept
void set_operator_fixed_frequency_hz (std::size_t op, SampleType hz) noexcept
SampleType operator_fixed_frequency_hz (std::size_t op) const noexcept
void set_operator_level (std::size_t op, SampleType linear_level) noexcept
SampleType operator_level (std::size_t op) const noexcept
void set_operator_feedback_radians (std::size_t op, SampleType radians) noexcept
SampleType operator_feedback_radians (std::size_t op) const noexcept
void set_operator_key_scaling (std::size_t op, SampleType db_per_octave, SampleType reference_hz=SampleType{440}) noexcept
void set_operator_envelope (std::size_t op, Envelope envelope) noexcept
const Envelope & operator_envelope (std::size_t op) const noexcept
void set_routing (const Routing &routing) noexcept
Routing & routing () noexcept
const Routing & routing () const noexcept
void set_alias_policy (AliasPolicy policy) noexcept
AliasPolicy alias_policy () const noexcept
bool set_trig_profile (TrigProfile profile) noexcept
 Selects the sine implementation used by this engine instance.
TrigProfile trig_profile () const noexcept
bool is_active () const noexcept
int latency_samples () const noexcept
int tail_samples () const noexcept
SampleType process () noexcept
void process (SampleType *output, std::size_t sample_count) noexcept

Static Public Member Functions

static constexpr std::size_t max_operator_count () noexcept
static constexpr bool supports_realtime_trig_profiles () noexcept

Static Public Attributes

static constexpr SampleType kMinRatio = SampleType{1} / SampleType{64}
static constexpr SampleType kMaxRatio = SampleType{64}
static constexpr SampleType kMinFrequencyHz = SampleType{0.01}
static constexpr SampleType kMaxFrequencyHz = SampleType{96000}
static constexpr SampleType kMaxFeedbackRadians
static constexpr SampleType kMaxKeyScalingDbPerOctave = SampleType{24}
static constexpr SampleType kMaxKeyScalingMagnitudeDb = SampleType{60}
static constexpr double kMinSampleRate = 1000.0
static constexpr double kMaxSampleRate = 768000.0

Detailed Description

template<typename SampleType = float, std::size_t MaxOperators = 8>
class pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >

Bounded melodic FM/PM operator engine.

Up to MaxOperators sine operators share the same fixed-capacity routing representation. Every route reads the source's previous sample, matching Pulp's drum FM6/FM8 law and permitting arbitrary cycles without a topology sort. Ratio mode follows base_frequency_hz; fixed-Hz mode does not. Each operator has a DAHDSR envelope, a linear level, key scaling in dB/octave, and bounded self-feedback in radians.

RT contract: construction, prepare(), and all setters own fixed storage and allocate nothing. note_on(), note_off(), process(), and reset() allocate nothing, take no locks, perform no I/O, and have work bounded by MaxOperators * MaxOperators. Setters are control/setup operations.

Time contract: the engine has zero processing latency. After note_off(), tail_samples() is the exact longest configured linear release in samples. Reset produces exact silence and restores the same phase/envelope state as a fresh prepared engine.

Member Typedef Documentation

◆ AliasPolicy

template<typename SampleType = float, std::size_t MaxOperators = 8>
using pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::AliasPolicy = FmOperatorAliasPolicy

◆ FrequencyMode

template<typename SampleType = float, std::size_t MaxOperators = 8>
using pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::FrequencyMode = FmOperatorFrequencyMode

◆ Routing

template<typename SampleType = float, std::size_t MaxOperators = 8>
using pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::Routing = FmOperatorRoutingT<SampleType, MaxOperators>

◆ TrigProfile

template<typename SampleType = float, std::size_t MaxOperators = 8>
using pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::TrigProfile = FastTrigProfile

Constructor & Destructor Documentation

◆ FmOperatorEngineT()

template<typename SampleType = float, std::size_t MaxOperators = 8>
pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::FmOperatorEngineT ( )
inline

Member Function Documentation

◆ alias_policy()

template<typename SampleType = float, std::size_t MaxOperators = 8>
AliasPolicy pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::alias_policy ( ) const
inlinenoexcept

◆ base_frequency_hz()

template<typename SampleType = float, std::size_t MaxOperators = 8>
SampleType pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::base_frequency_hz ( ) const
inlinenoexcept

◆ is_active()

template<typename SampleType = float, std::size_t MaxOperators = 8>
bool pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::is_active ( ) const
inlinenoexcept

◆ latency_samples()

template<typename SampleType = float, std::size_t MaxOperators = 8>
int pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::latency_samples ( ) const
inlinenoexcept

◆ max_operator_count()

template<typename SampleType = float, std::size_t MaxOperators = 8>
constexpr std::size_t pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::max_operator_count ( )
inlinestaticconstexprnoexcept

◆ note_off()

template<typename SampleType = float, std::size_t MaxOperators = 8>
void pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::note_off ( )
inlinenoexcept

◆ note_on()

template<typename SampleType = float, std::size_t MaxOperators = 8>
void pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::note_on ( SampleType velocity = SampleType{1})
inlinenoexcept

◆ operator_count()

template<typename SampleType = float, std::size_t MaxOperators = 8>
std::size_t pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::operator_count ( ) const
inlinenoexcept

◆ operator_envelope()

template<typename SampleType = float, std::size_t MaxOperators = 8>
const Envelope & pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::operator_envelope ( std::size_t op) const
inlinenoexcept

◆ operator_feedback_radians()

template<typename SampleType = float, std::size_t MaxOperators = 8>
SampleType pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::operator_feedback_radians ( std::size_t op) const
inlinenoexcept

◆ operator_fixed_frequency_hz()

template<typename SampleType = float, std::size_t MaxOperators = 8>
SampleType pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::operator_fixed_frequency_hz ( std::size_t op) const
inlinenoexcept

◆ operator_frequency_mode()

template<typename SampleType = float, std::size_t MaxOperators = 8>
FrequencyMode pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::operator_frequency_mode ( std::size_t op) const
inlinenoexcept

◆ operator_level()

template<typename SampleType = float, std::size_t MaxOperators = 8>
SampleType pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::operator_level ( std::size_t op) const
inlinenoexcept

◆ operator_ratio()

template<typename SampleType = float, std::size_t MaxOperators = 8>
SampleType pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::operator_ratio ( std::size_t op) const
inlinenoexcept

◆ prepare()

template<typename SampleType = float, std::size_t MaxOperators = 8>
void pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::prepare ( double sample_rate)
inlinenoexcept

◆ process() [1/2]

template<typename SampleType = float, std::size_t MaxOperators = 8>
SampleType pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::process ( )
inlinenoexcept

◆ process() [2/2]

template<typename SampleType = float, std::size_t MaxOperators = 8>
void pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::process ( SampleType * output,
std::size_t sample_count )
inlinenoexcept

◆ reset()

template<typename SampleType = float, std::size_t MaxOperators = 8>
void pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::reset ( )
inlinenoexcept

◆ routing() [1/2]

template<typename SampleType = float, std::size_t MaxOperators = 8>
const Routing & pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::routing ( ) const
inlinenoexcept

◆ routing() [2/2]

template<typename SampleType = float, std::size_t MaxOperators = 8>
Routing & pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::routing ( )
inlinenoexcept

◆ set_alias_policy()

template<typename SampleType = float, std::size_t MaxOperators = 8>
void pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::set_alias_policy ( AliasPolicy policy)
inlinenoexcept

◆ set_base_frequency_hz()

template<typename SampleType = float, std::size_t MaxOperators = 8>
void pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::set_base_frequency_hz ( SampleType hz)
inlinenoexcept

◆ set_operator_count()

template<typename SampleType = float, std::size_t MaxOperators = 8>
void pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::set_operator_count ( std::size_t count)
inlinenoexcept

◆ set_operator_envelope()

template<typename SampleType = float, std::size_t MaxOperators = 8>
void pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::set_operator_envelope ( std::size_t op,
Envelope envelope )
inlinenoexcept

◆ set_operator_feedback_radians()

template<typename SampleType = float, std::size_t MaxOperators = 8>
void pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::set_operator_feedback_radians ( std::size_t op,
SampleType radians )
inlinenoexcept

◆ set_operator_fixed_frequency_hz()

template<typename SampleType = float, std::size_t MaxOperators = 8>
void pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::set_operator_fixed_frequency_hz ( std::size_t op,
SampleType hz )
inlinenoexcept

◆ set_operator_frequency_mode()

template<typename SampleType = float, std::size_t MaxOperators = 8>
void pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::set_operator_frequency_mode ( std::size_t op,
FrequencyMode mode )
inlinenoexcept

◆ set_operator_key_scaling()

template<typename SampleType = float, std::size_t MaxOperators = 8>
void pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::set_operator_key_scaling ( std::size_t op,
SampleType db_per_octave,
SampleType reference_hz = SampleType{440} )
inlinenoexcept

◆ set_operator_level()

template<typename SampleType = float, std::size_t MaxOperators = 8>
void pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::set_operator_level ( std::size_t op,
SampleType linear_level )
inlinenoexcept

◆ set_operator_ratio()

template<typename SampleType = float, std::size_t MaxOperators = 8>
void pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::set_operator_ratio ( std::size_t op,
SampleType ratio )
inlinenoexcept

◆ set_routing()

template<typename SampleType = float, std::size_t MaxOperators = 8>
void pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::set_routing ( const Routing & routing)
inlinenoexcept

◆ set_trig_profile()

template<typename SampleType = float, std::size_t MaxOperators = 8>
bool pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::set_trig_profile ( TrigProfile profile)
inlinenoexcept

Selects the sine implementation used by this engine instance.

Reference math remains the default. The real-time profiles are available only for float engines because their adapted coefficients and measured error budgets are float-specific. Selection is a setup/control operation and is dispatched outside the operator loop. Recursive FM can amplify even small numerical differences, so non-reference profiles are explicit sound/performance alternatives rather than transparent replacements.

◆ supports_realtime_trig_profiles()

template<typename SampleType = float, std::size_t MaxOperators = 8>
constexpr bool pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::supports_realtime_trig_profiles ( )
inlinestaticconstexprnoexcept

◆ tail_samples()

template<typename SampleType = float, std::size_t MaxOperators = 8>
int pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::tail_samples ( ) const
inlinenoexcept

◆ trig_profile()

template<typename SampleType = float, std::size_t MaxOperators = 8>
TrigProfile pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::trig_profile ( ) const
inlinenoexcept

Member Data Documentation

◆ kMaxFeedbackRadians

template<typename SampleType = float, std::size_t MaxOperators = 8>
SampleType pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::kMaxFeedbackRadians
staticconstexpr
Initial value:
=
SampleType{8} * std::numbers::pi_v<SampleType>

◆ kMaxFrequencyHz

template<typename SampleType = float, std::size_t MaxOperators = 8>
SampleType pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::kMaxFrequencyHz = SampleType{96000}
staticconstexpr

◆ kMaxKeyScalingDbPerOctave

template<typename SampleType = float, std::size_t MaxOperators = 8>
SampleType pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::kMaxKeyScalingDbPerOctave = SampleType{24}
staticconstexpr

◆ kMaxKeyScalingMagnitudeDb

template<typename SampleType = float, std::size_t MaxOperators = 8>
SampleType pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::kMaxKeyScalingMagnitudeDb = SampleType{60}
staticconstexpr

◆ kMaxRatio

template<typename SampleType = float, std::size_t MaxOperators = 8>
SampleType pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::kMaxRatio = SampleType{64}
staticconstexpr

◆ kMaxSampleRate

template<typename SampleType = float, std::size_t MaxOperators = 8>
double pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::kMaxSampleRate = 768000.0
staticconstexpr

◆ kMinFrequencyHz

template<typename SampleType = float, std::size_t MaxOperators = 8>
SampleType pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::kMinFrequencyHz = SampleType{0.01}
staticconstexpr

◆ kMinRatio

template<typename SampleType = float, std::size_t MaxOperators = 8>
SampleType pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::kMinRatio = SampleType{1} / SampleType{64}
staticconstexpr

◆ kMinSampleRate

template<typename SampleType = float, std::size_t MaxOperators = 8>
double pulp::signal::FmOperatorEngineT< SampleType, MaxOperators >::kMinSampleRate = 1000.0
staticconstexpr

The documentation for this class was generated from the following file: