|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
Digital signal processor that applies boolean logic operations to data streams. More...
#include <LogicProcessor.hpp>
Inheritance diagram for MayaFlux::Buffers::LogicProcessor:
Collaboration diagram for MayaFlux::Buffers::LogicProcessor:Public Types | |
| using | ModulationFunction = std::function< double(double, double)> |
| Function type for custom digital signal transformations. | |
| enum class | ModulationType : uint8_t { REPLACE , MULTIPLY , ADD , INVERT_ON_TRUE , HOLD_ON_FALSE , ZERO_ON_FALSE , CROSSFADE , THRESHOLD_REMAP , SAMPLE_AND_HOLD , CUSTOM } |
| Defines how logic values modulate buffer content. More... | |
Public Member Functions | |
| void | add_key (const std::shared_ptr< AudioBuffer > &buffer) |
| Reads another buffer as an extra input slot of a parallel node. | |
| bool | apply (const std::shared_ptr< Buffer > &buffer, ModulationFunction modulation_func=nullptr) |
| Applies stored logic data to the given buffer. | |
| void | clear_keys () |
| Removes every key. | |
| void | clear_neighbourhood () |
| Turns the automaton off. | |
| std::shared_ptr< LogicProcessor > | clone () const |
| An independent processor over a clone of the node. | |
| template<typename... Args> requires std::constructible_from<Nodes::Generator::Logic, Args...> | |
| void | force_use_internal (Args &&... args) |
| Forces the processor to use a new internal logic node. | |
| bool | generate (size_t num_samples, const std::vector< double > &input_data) |
| Generates discrete logic data from input without modifying any buffer. | |
| double | get_high_value () const |
| Gets the high value for THRESHOLD_REMAP mode. | |
| std::shared_ptr< Nodes::Generator::Logic > | get_logic () const |
| Gets the logic node used for processing. | |
| const std::vector< double > & | get_logic_data () const |
| Gets the stored logic data. | |
| double | get_low_value () const |
| Gets the low value for THRESHOLD_REMAP mode. | |
| const ModulationFunction & | get_modulation_function () const |
| Get current modulation function. | |
| ModulationType | get_modulation_type () const |
| Get current modulation type. | |
| bool | get_reset_between_buffers () const |
| Gets whether logic state is reset between buffer calls. | |
| bool | has_generated_data () const |
| Checks if logic data has been generated. | |
| bool | is_using_internal () const |
| Checks if the processor is using the internal logic node. | |
| template<typename... Args> requires std::constructible_from<Nodes::Generator::Logic, Args...> | |
| LogicProcessor (Args &&... args) | |
| Constructs a LogicProcessor with internal Logic node. | |
| LogicProcessor (const std::shared_ptr< Nodes::Generator::Logic > &logic, bool reset_between_buffers=false) | |
| Constructs a LogicProcessor with external Logic node. | |
| void | on_attach (const std::shared_ptr< Buffer > &buffer) override |
| Called when the processor is attached to a buffer. | |
| void | on_detach (const std::shared_ptr< Buffer > &) override |
| Called when the processor is detached from a buffer. | |
| void | processing_function (const std::shared_ptr< Buffer > &buffer) override |
| Processes a buffer through the logic node. | |
| void | set_bit_planes (uint32_t bits) |
| Processes every sample as a word of bit streams, one node per bit. | |
| void | set_modulation_function (ModulationFunction func) |
| Set custom modulation function. | |
| void | set_modulation_type (ModulationType type) |
| Set how logic values modulate buffer content. | |
| void | set_neighbourhood (size_t radius, size_t generations=1, bool wrap=true, bool memory=false) |
| Treats the samples of a block as cells of an automaton. | |
| void | set_reset_between_buffers (bool reset) |
| Sets whether to reset logic state between buffer calls. | |
| void | set_threshold_remap_values (double high_val, double low_val) |
| Sets high and low values for THRESHOLD_REMAP mode. | |
| void | update_logic_node (const std::shared_ptr< Nodes::Generator::Logic > &logic) |
| Updates the logic node used for processing. | |
Public Member Functions inherited from MayaFlux::Buffers::BufferProcessor | |
| virtual ProcessingToken | get_processing_token () const |
| Gets the current processing token for this buffer. | |
| virtual bool | is_compatible_with (const std::shared_ptr< Buffer > &) const |
| Checks if this processor can handle the specified buffer type. | |
| void | process (const std::shared_ptr< Buffer > &buffer) |
| Applies a computational transformation to the data in the provided buffer. | |
| virtual void | set_processing_token (ProcessingToken token) |
| Gets the preferred processing backend for this processor. | |
| virtual | ~BufferProcessor ()=default |
| Virtual destructor for proper cleanup of derived classes. | |
Private Member Functions | |
| void | generate_keyed (size_t num_samples, const std::vector< double > &input_data) |
| void | generate_planes (size_t num_samples, const std::vector< double > &input_data) |
| void | generate_spatial (size_t num_samples, const std::vector< double > &input_data) |
| void | generate_temporal (size_t num_samples, const std::vector< double > &input_data) |
| void | lock_keys () |
Private Attributes | |
| std::vector< uint8_t > | m_cells |
| Automaton cells. | |
| size_t | m_generations {} |
| Automaton steps per block, 0 when off. | |
| bool | m_has_generated_data |
| Whether logic data has been generated. | |
| double | m_high_value |
| High value for THRESHOLD_REMAP. | |
| std::vector< uint32_t > | m_key_words |
| Words of the keys at the current sample. | |
| std::vector< std::weak_ptr< AudioBuffer > > | m_keys |
| Buffers read as extra input slots. | |
| double | m_last_held_value |
| Last held value for HOLD_ON_FALSE and SAMPLE_AND_HOLD. | |
| double | m_last_logic_value |
| Previous logic value for change detection. | |
| std::vector< std::shared_ptr< AudioBuffer > > | m_live_keys |
| Keys locked for the current block. | |
| std::shared_ptr< Nodes::Generator::Logic > | m_logic |
| Logic node for processing. | |
| std::vector< double > | m_logic_data |
| Stored logic processing results. | |
| double | m_low_value |
| Low value for THRESHOLD_REMAP. | |
| bool | m_memory {} |
| Whether blocks perturb the previous automaton result. | |
| ModulationFunction | m_modulation_function |
| Custom transformation function. | |
| ModulationType | m_modulation_type |
| How logic values modulate buffer content. | |
| std::vector< uint8_t > | m_next_cells |
| Automaton cells of the next generation. | |
| std::shared_ptr< Nodes::Generator::Logic > | m_pending_logic |
| Pending logic node update. | |
| uint32_t | m_plane_bits {} |
| Word width when processing bit planes, 0 when off. | |
| std::vector< std::shared_ptr< Nodes::Generator::Logic > > | m_plane_nodes |
| One clone of the node per bit plane. | |
| std::shared_ptr< Nodes::Generator::Logic > | m_plane_template |
| The node the plane clones were taken from. | |
| std::vector< uint8_t > | m_previous_cells |
| Last automaton result, kept when memory is on. | |
| size_t | m_radius {} |
| Neighbourhood radius of the automaton. | |
| bool | m_reset_between_buffers |
| Whether to reset logic between buffers. | |
| std::vector< double > | m_slots |
| Input slots handed to the node. | |
| bool | m_use_internal |
| Whether to use internal logic node. | |
| bool | m_wrap { true } |
| Whether the automaton's block ends meet. | |
Additional Inherited Members | |
Protected Attributes inherited from MayaFlux::Buffers::BufferProcessor | |
| ProcessingToken | m_processing_token { ProcessingToken::AUDIO_BACKEND } |
Digital signal processor that applies boolean logic operations to data streams.
LogicProcessor bridges Nodes::Generator::Logic nodes with the buffer processing system, enabling sophisticated digital signal manipulation through various modulation strategies.
The processor's job is simple:
All logic computation (threshold detection, edge detection, state machines, etc.) is handled by the Logic node itself. The processor only manages iteration and application of results.
Use cases include:
Definition at line 34 of file LogicProcessor.hpp.