MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Memory::HistoryBufferAccess Struct Reference

History buffer semantics (newest sample first) More...

#include <RingBuffer.hpp>

+ Collaboration diagram for MayaFlux::Memory::HistoryBufferAccess:

Static Public Attributes

static constexpr bool push_front = true
 
static constexpr bool pop_front = false
 
static constexpr const char * name = "HistoryBuffer (newest-first)"
 

Detailed Description

History buffer semantics (newest sample first)

Maintains temporal ordering where index 0 represents the most recent sample and higher indices represent progressively older samples. This is the natural indexing for difference equations and recursive relations: y[n], y[n-1], y[n-2], ...

Operations:

  • push(): Add to front (becomes index 0)
  • operator[]: Direct indexing where [0] = newest, [k] = k samples ago
  • linearized_view(): Returns mutable span [newest → oldest]

Mathematical Context:

  • Difference equations: y[n] = a·y[n-1] + b·y[n-2]
  • FIR filters: y[n] = Σ h[k]·x[n-k]
  • IIR filters: y[n] = Σ b[k]·x[n-k] - Σ a[k]·y[n-k]
  • Recurrence relations: any recursive numerical method
HistoryBuffer<double> history(100);
// Difference equation: y[n] = 0.5·y[n-1] + x[n]
history.push(input_sample); // New sample at [0]
double current = history[0]; // Current input
double previous = history[1]; // One sample ago
double output = 0.5 * previous + current;
// Access via linearized view for convolution
auto view = history.linearized_view(); // [newest → oldest]
for (size_t k = 0; k < view.size(); ++k) {
output += view[k] * coefficients[k];
}
History buffer for difference equations and recursive relations.

Definition at line 305 of file RingBuffer.hpp.


The documentation for this struct was generated from the following file: