Processes a single input sample and generates a phasor sample.
- Parameters
-
| input | Input sample (used for modulation when modulators are connected) |
- Returns
- Generated phasor sample (ramp from 0 to amplitude)
This method advances the generator's phase and computes the next sample of the phasor ramp, applying any modulation from connected nodes.
Implements MayaFlux::Nodes::Node.
Definition at line 85 of file Phasor.cpp.
86{
87 double output = 0.0;
88
90
96 } else {
99 }
100
102 }
103
105
111 } else {
114 }
115 }
116
118
123 }
124
126
129
133 }
137 }
138
139 return output;
140}
float m_frequency
Base frequency of the generator.
double m_amplitude
Base amplitude of the generator.
double m_phase
Current phase of the generator.
std::shared_ptr< Node > m_frequency_modulator
Node that modulates the frequency.
bool m_phase_wrapped
Flag indicating whether the phase has wrapped in the current sample.
std::shared_ptr< Node > m_amplitude_modulator
Node that modulates the amplitude.
void update_phase_increment(double frequency)
Updates the phase increment based on a new frequency.
double m_phase_inc
Phase increment per sample.
void notify_tick(double value) override
Notifies all registered callbacks about a new sample.
float m_offset
DC offset added to the output.
double m_last_output
The most recent sample value generated by this oscillator.
bool m_fire_events_during_snapshot
Internal flag controlling whether notify_tick fires during state snapshots Default: false (events don...
void atomic_add_flag(std::atomic< Utils::NodeState > &state, Utils::NodeState flag)
Atomically adds a flag to a node state.
void try_reset_processed_state(std::shared_ptr< Node > node)
Attempts to reset the processed state of a node.
void atomic_inc_modulator_count(std::atomic< uint32_t > &count, int amount)
Atomically increments the modulator count by a specified amount.
void atomic_dec_modulator_count(std::atomic< uint32_t > &count, int amount)
Atomically decrements the modulator count by a specified amount.
@ PROCESSED
Node has been processed this cycle.
References MayaFlux::Nodes::atomic_add_flag(), MayaFlux::Nodes::atomic_dec_modulator_count(), MayaFlux::Nodes::atomic_inc_modulator_count(), MayaFlux::Nodes::Generator::Generator::m_amplitude, m_amplitude_modulator, MayaFlux::Nodes::Node::m_fire_events_during_snapshot, MayaFlux::Nodes::Generator::Generator::m_frequency, m_frequency_modulator, MayaFlux::Nodes::Node::m_last_output, m_offset, MayaFlux::Nodes::Generator::Generator::m_phase, m_phase_inc, m_phase_wrapped, m_state_saved, notify_tick(), MayaFlux::Utils::PROCESSED, MayaFlux::Nodes::try_reset_processed_state(), and update_phase_increment().
Referenced by process_batch().