83 template <
typename... Args>
86 : m_logic(
std::make_shared<Nodes::Generator::Logic>(
std::forward<Args>(args)...))
87 , m_reset_between_buffers(false)
88 , m_use_internal(true)
90 , m_has_generated_data(false)
93 , m_last_held_value(0.0)
94 , m_last_logic_value(0.0)
108 const std::shared_ptr<Nodes::Generator::Logic>& logic,
109 bool reset_between_buffers =
false);
123 void processing_function(std::shared_ptr<Buffer> buffer)
override;
129 void on_attach(std::shared_ptr<Buffer> buffer)
override;
135 inline void on_detach(std::shared_ptr<Buffer>)
override { }
147 bool generate(
size_t num_samples,
const std::vector<double>& input_data);
161 bool apply(
const std::shared_ptr<Buffer>& buffer,
162 ModulationFunction modulation_func =
nullptr);
168 [[nodiscard]]
const std::vector<double>&
get_logic_data()
const {
return m_logic_data; }
216 void set_modulation_function(ModulationFunction func);
231 m_high_value = high_val;
232 m_low_value = low_val;
275 template <
typename... Args>
279 m_pending_logic = std::make_shared<Nodes::Generator::Logic>(std::forward<Args>(args)...);
292 m_pending_logic = logic;
299 [[nodiscard]]
inline std::shared_ptr<Nodes::Generator::Logic>
get_logic()
const {
return m_logic; }
302 std::shared_ptr<Nodes::Generator::Logic>
m_logic;
Central computational transformation interface for continuous buffer processing.
void force_use_internal(Args &&... args)
Forces the processor to use a new internal logic node.
ModulationFunction m_modulation_function
Custom transformation function.
LogicProcessor(Args &&... args)
Constructs a LogicProcessor with internal Logic node.
const std::vector< double > & get_logic_data() const
Gets the stored logic data.
ModulationType
Defines how logic values modulate buffer content.
ModulationType get_modulation_type() const
Get current modulation type.
std::vector< double > m_logic_data
Stored logic processing results.
const ModulationFunction & get_modulation_function() const
Get current modulation function.
double get_high_value() const
Gets the high value for THRESHOLD_REMAP mode.
bool m_has_generated_data
Whether logic data has been generated.
void set_modulation_type(ModulationType type)
Set how logic values modulate buffer content.
double m_last_held_value
Last held value for HOLD_ON_FALSE and SAMPLE_AND_HOLD.
std::shared_ptr< Nodes::Generator::Logic > get_logic() const
Gets the logic node used for processing.
double m_high_value
High value for THRESHOLD_REMAP.
bool get_reset_between_buffers() const
Gets whether logic state is reset between buffer calls.
std::function< double(double, double)> ModulationFunction
Function type for custom digital signal transformations.
bool is_using_internal() const
Checks if the processor is using the internal logic node.
double m_low_value
Low value for THRESHOLD_REMAP.
std::shared_ptr< Nodes::Generator::Logic > m_logic
Logic node for processing.
bool has_generated_data() const
Checks if logic data has been generated.
double m_last_logic_value
Previous logic value for change detection.
ModulationType m_modulation_type
How logic values modulate buffer content.
void set_threshold_remap_values(double high_val, double low_val)
Sets high and low values for THRESHOLD_REMAP mode.
void set_reset_between_buffers(bool reset)
Sets whether to reset logic state between buffer calls.
std::shared_ptr< Nodes::Generator::Logic > m_pending_logic
Pending logic node update.
double get_low_value() const
Gets the low value for THRESHOLD_REMAP mode.
void on_detach(std::shared_ptr< Buffer >) override
Called when the processor is detached from a buffer.
bool m_use_internal
Whether to use internal logic node.
bool m_reset_between_buffers
Whether to reset logic between buffers.
void update_logic_node(const std::shared_ptr< Nodes::Generator::Logic > &logic)
Updates the logic node used for processing.
Digital signal processor that applies boolean logic operations to data streams.
Digital signal processor implementing boolean logic operations.