MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Boolean.hpp File Reference

Pure decision functions of bits and an array of numbers. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  MayaFlux
 Main namespace for the Maya Flux audio engine.
 
namespace  MayaFlux::Kinesis
 
namespace  MayaFlux::Kinesis::Discrete
 

Functions

bool MayaFlux::Kinesis::Discrete::bernoulli_gate (double input, std::span< double > coefs) noexcept
 Probabilistic gate: each pulse passes with the given probability.
 
std::vector< double > MayaFlux::Kinesis::Discrete::bernoulli_gate_state (double probability, uint32_t seed=0, double threshold=0.5)
 Builds the array bernoulli_gate reads and writes.
 
bool MayaFlux::Kinesis::Discrete::clocked_register (const std::vector< double > &inputs, std::span< double > coefs) noexcept
 Shift register: slot 1 is sampled into it on every rise of slot 0.
 
std::vector< double > MayaFlux::Kinesis::Discrete::clocked_register_state (size_t length, size_t tap, double threshold=0.5)
 Builds the array clocked_register reads and writes.
 
bool MayaFlux::Kinesis::Discrete::comparator (const std::vector< double > &inputs, std::span< double > coefs) noexcept
 Signal against signal: true once slot 0 exceeds slot 1 by the margin.
 
std::vector< double > MayaFlux::Kinesis::Discrete::comparator_state (double margin=0.0)
 Builds the array comparator reads and writes.
 
bool MayaFlux::Kinesis::Discrete::count_at_least (std::span< const bool > history, std::span< const double > coefs) noexcept
 True when at least k of the last n bits are set.
 
bool MayaFlux::Kinesis::Discrete::edge_divider (double input, std::span< double > coefs) noexcept
 Gate divider: the input passes only during every n-th pulse.
 
std::vector< double > MayaFlux::Kinesis::Discrete::edge_divider_state (size_t n, size_t offset=0, double threshold=0.5)
 Builds the array edge_divider reads and writes.
 
bool MayaFlux::Kinesis::Discrete::galois_lfsr (double input, std::span< double > coefs) noexcept
 Linear feedback shift register clocked by the rises of the input.
 
std::vector< double > MayaFlux::Kinesis::Discrete::galois_lfsr_state (uint32_t taps, uint32_t seed=1, double threshold=0.5)
 Builds the array galois_lfsr reads and writes.
 
bool MayaFlux::Kinesis::Discrete::hysteresis_gate (double input, std::span< double > coefs) noexcept
 Schmitt trigger: engages above high, releases below low, holds between.
 
std::vector< double > MayaFlux::Kinesis::Discrete::hysteresis_gate_state (double low, double high)
 Builds the array hysteresis_gate reads and writes.
 
bool MayaFlux::Kinesis::Discrete::input_truth_table (const std::vector< double > &inputs, std::span< const double > coefs) noexcept
 Any boolean function of the input slots, as a table.
 
std::vector< double > MayaFlux::Kinesis::Discrete::input_truth_table_state (size_t arity, uint64_t rule, double threshold=0.5)
 Builds the array input_truth_table reads.
 
std::vector< double > MayaFlux::Kinesis::Discrete::maximally_even_sequence (size_t pulses, size_t steps, size_t rotation=0)
 The maximally even placement of pulses among steps, as a 0 or 1 table.
 
bool MayaFlux::Kinesis::Discrete::one_shot (double input, double time, std::span< double > coefs) noexcept
 Monostable: every rise of the input opens the output for a fixed time.
 
std::vector< double > MayaFlux::Kinesis::Discrete::one_shot_state (double duration, double threshold=0.5)
 Builds the array one_shot reads and writes.
 
bool MayaFlux::Kinesis::Discrete::refractory_gate (double input, double time, std::span< double > coefs) noexcept
 Fires while the input is high, then ignores it for a period.
 
std::vector< double > MayaFlux::Kinesis::Discrete::refractory_gate_state (double period, double threshold=0.5)
 Builds the array refractory_gate reads and writes.
 
bool MayaFlux::Kinesis::Discrete::rising_toggle (double input, std::span< double > coefs) noexcept
 Flip-flop: the output inverts on every rise of the input.
 
std::vector< double > MayaFlux::Kinesis::Discrete::rising_toggle_state (double threshold=0.5)
 Builds the array rising_toggle reads and writes.
 
bool MayaFlux::Kinesis::Discrete::set_reset_latch (const std::vector< double > &inputs, std::span< double > coefs) noexcept
 Memory cell: slot 0 sets it, slot 1 resets it, reset wins.
 
std::vector< double > MayaFlux::Kinesis::Discrete::set_reset_latch_state (double threshold=0.5)
 Builds the array set_reset_latch reads and writes.
 
bool MayaFlux::Kinesis::Discrete::signals_at_least (const std::vector< double > &inputs, std::span< const double > coefs) noexcept
 True when at least k of the input slots are high.
 
std::vector< double > MayaFlux::Kinesis::Discrete::signals_at_least_state (size_t k, double threshold=0.5)
 Builds the array signals_at_least reads.
 
bool MayaFlux::Kinesis::Discrete::state_machine (double input, std::span< double > coefs) noexcept
 Mealy machine: the state and the input bit pick the next state and the output.
 
std::vector< double > MayaFlux::Kinesis::Discrete::state_machine_state (std::span< const double > table, double threshold=0.5, size_t initial=0)
 Builds the array state_machine reads and writes.
 
bool MayaFlux::Kinesis::Discrete::step_pattern (double input, std::span< double > coefs) noexcept
 A table of bits advanced by the rises of the input.
 
bool MayaFlux::Kinesis::Discrete::truth_table (std::span< const bool > history, std::span< const double > coefs) noexcept
 Any boolean function of the last bits, as a table.
 
std::vector< double > MayaFlux::Kinesis::Discrete::truth_table_state (size_t arity, uint64_t rule)
 Builds the array truth_table reads.
 
bool MayaFlux::Kinesis::Discrete::window_comparator (const std::vector< double > &inputs, std::span< const double > coefs) noexcept
 True while slot 0 lies strictly between slot 1 and slot 2.
 
uint32_t MayaFlux::Kinesis::Discrete::xorshift32 (uint32_t state) noexcept
 One step of the 32-bit xorshift generator.
 

Detailed Description

Pure decision functions of bits and an array of numbers.

The boolean counterpart of Kernels.hpp. Every kernel returns a bit and keeps whatever it remembers in the array it is given, so the behaviour is the numbers: the array can be retuned live, saved and restored with the node, and cloned. A signal is a bit when it exceeds the kernel's threshold, and a kernel driven by an edge counts a signal that starts high as a rise.

Four shapes, each the function type of the matching Logic constructor:

  • history kernels: bool(span<const bool> history, span<const double>), history[0] the newest bit
  • input kernels: bool(double input, span<double>)
  • time kernels: bool(double input, double time, span<double>)
  • parallel kernels: bool(const vector<double>& inputs, span<double>), one value per input slot as documented by each kernel

Logic(Kinesis::Discrete::truth_table, 3, truth_table_state(3, rule)) is a complete node. Every kernel returns false for an array too short to hold its layout.

Definition in file Boolean.hpp.