28 std::vector<double> out(num_samples);
29 for (
unsigned int i = 0; i < num_samples; ++i) {
55 const void* current =
m_owner.load(std::memory_order_acquire);
57 if (current ==
nullptr) {
58 m_owner.compare_exchange_strong(current, owner, std::memory_order_acq_rel);
59 }
else if (current != owner) {
63 m_data.assign(data.begin(), data.end());
70 const void* expected = owner;
71 m_owner.compare_exchange_strong(expected,
nullptr, std::memory_order_acq_rel);
double value
Current sample value.
Base context class for node callbacks.
std::vector< NodeHook > m_callbacks
Collection of standard callback functions.
bool m_state_saved
tracks if the node's state has been saved by a snapshot operation
bool m_networked_node
Flag indicating if the node is part of a NodeNetwork This flag is used to disable event firing when t...
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...
std::vector< std::pair< NodeHook, NodeCondition > > m_conditional_callbacks
Collection of conditional callback functions with their predicates.
void release_owner(const void *owner)
Release ownership so another feeder can write.
double m_saved_hold_value
double process_sample(double input=0.0) override
Processes a single data sample.
std::vector< double > process_batch(unsigned int num_samples) override
Processes multiple samples at once.
void restore_state() override
Restores the node's state from the last save Recursively cascades through all connected modulator nod...
void save_state() override
Saves the node's current state for later restoration Recursively cascades through all connected modul...
void update_context(double value) override
Updates the context object with the current node state.
std::vector< double > m_data
size_t remaining() const noexcept
Number of unread samples remaining.
std::vector< double > m_saved_data
std::atomic< const void * > m_owner
void notify_tick(double value) override
Notifies all registered callbacks with the current context.
NodeContext & get_last_context() override
Retrieves the last created context object.
StreamReaderContext m_context
double m_saved_last_output
bool set_data(std::span< const double > data, const void *owner=nullptr)
Replace the internal data and reset read head to 0.
void rewind() noexcept
Reset read head to 0 without changing data.
Contains the node-based computational processing system components.