85 template <
typename... Args>
88 : m_logic(
std::make_shared<Nodes::Generator::Logic>(
std::forward<Args>(args)...))
89 , m_reset_between_buffers(false)
90 , m_use_internal(true)
92 , m_has_generated_data(false)
95 , m_last_held_value(0.0)
96 , m_last_logic_value(0.0)
110 const std::shared_ptr<Nodes::Generator::Logic>& logic,
111 bool reset_between_buffers =
false);
125 void processing_function(
const std::shared_ptr<Buffer>&
buffer)
override;
131 void on_attach(
const std::shared_ptr<Buffer>&
buffer)
override;
137 inline void on_detach(
const std::shared_ptr<Buffer>&)
override { }
149 bool generate(
size_t num_samples,
const std::vector<double>& input_data);
163 bool apply(
const std::shared_ptr<Buffer>&
buffer,
164 ModulationFunction modulation_func =
nullptr);
170 [[nodiscard]]
const std::vector<double>&
get_logic_data()
const {
return m_logic_data; }
186 [[nodiscard]] std::shared_ptr<LogicProcessor> clone()
const;
199 void add_key(
const std::shared_ptr<AudioBuffer>&
buffer);
219 void set_bit_planes(uint32_t bits);
236 void set_neighbourhood(
size_t radius,
size_t generations = 1,
bool wrap =
true,
bool memory =
false);
241 void clear_neighbourhood();
283 void set_modulation_function(ModulationFunction func);
298 m_high_value = high_val;
299 m_low_value = low_val;
342 template <
typename... Args>
346 m_pending_logic = std::make_shared<Nodes::Generator::Logic>(std::forward<Args>(args)...);
359 m_pending_logic = logic;
366 [[nodiscard]]
inline std::shared_ptr<Nodes::Generator::Logic>
get_logic()
const {
return m_logic; }
369 std::shared_ptr<Nodes::Generator::Logic>
m_logic;
385 std::vector<std::weak_ptr<AudioBuffer>>
m_keys;
386 uint32_t m_plane_bits {};
388 size_t m_generations {};
389 bool m_wrap {
true };
400 void generate_temporal(
size_t num_samples,
const std::vector<double>& input_data);
401 void generate_keyed(
size_t num_samples,
const std::vector<double>& input_data);
402 void generate_planes(
size_t num_samples,
const std::vector<double>& input_data);
403 void generate_spatial(
size_t num_samples,
const std::vector<double>& input_data);
std::shared_ptr< NetworkGeometryBuffer > buffer
vk::PhysicalDeviceType type
Central computational transformation interface for continuous buffer processing.
void force_use_internal(Args &&... args)
Forces the processor to use a new internal logic node.
std::vector< double > m_slots
Input slots handed to the node.
ModulationFunction m_modulation_function
Custom transformation function.
std::vector< std::shared_ptr< Nodes::Generator::Logic > > m_plane_nodes
One clone of the node per bit plane.
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.
std::vector< uint8_t > m_next_cells
Automaton cells of the next generation.
bool m_has_generated_data
Whether logic data has been generated.
void set_modulation_type(ModulationType type)
Set how logic values modulate buffer content.
std::vector< uint32_t > m_key_words
Words of the keys at the current sample.
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.
std::vector< uint8_t > m_previous_cells
Last automaton result, kept when memory is on.
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.
std::vector< uint8_t > m_cells
Automaton cells.
double m_low_value
Low value for THRESHOLD_REMAP.
std::shared_ptr< Nodes::Generator::Logic > m_logic
Logic node for processing.
std::shared_ptr< Nodes::Generator::Logic > m_plane_template
The node the plane clones were taken from.
bool has_generated_data() const
Checks if logic data has been generated.
double m_last_logic_value
Previous logic value for change detection.
void on_detach(const std::shared_ptr< Buffer > &) override
Called when the processor is detached from a buffer.
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.
std::vector< std::weak_ptr< AudioBuffer > > m_keys
Buffers read as extra input slots.
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.
std::vector< std::shared_ptr< AudioBuffer > > m_live_keys
Keys locked for the current block.
double get_low_value() const
Gets the low value for THRESHOLD_REMAP mode.
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.