Vital
|
A specialized MemoryTemplate for two-channel (stereo) audio. More...
#include <memory.h>
Public Member Functions | |
StereoMemory (int size) | |
Constructs a stereo memory with the given size. | |
StereoMemory (StereoMemory &other) | |
Copy constructor. | |
force_inline poly_float | get (poly_float past) const |
Retrieves a poly_float of samples from the stereo memory using cubic interpolation. | |
![]() | |
MemoryTemplate (int size) | |
Constructs the memory with a given size (rounded up to a power of two). | |
MemoryTemplate (const MemoryTemplate &other) | |
Copy constructor. | |
virtual | ~MemoryTemplate () |
Destructor. | |
void | push (poly_float sample) |
Pushes a poly_float of samples (one sample per channel) into the memory. | |
void | clearMemory (int num, poly_mask clear_mask) |
Clears a specified number of samples in the memory for channels indicated by a mask. | |
void | clearAll () |
Clears all samples in the memory for all channels. | |
void | readSamples (mono_float *output, int num_samples, int offset, int channel) const |
Reads samples from the memory into an output buffer. | |
unsigned int | getOffset () const |
Gets the current offset (write position) in the buffer. | |
void | setOffset (int offset) |
Sets the current offset (write position) in the buffer. | |
int | getSize () const |
Gets the size of the memory buffer. | |
int | getMaxPeriod () const |
Gets the maximum allowed period for reading samples. | |
Additional Inherited Members | |
![]() | |
static constexpr mono_float | kMinPeriod |
Minimum allowed period of time delay. | |
static constexpr int | kExtraInterpolationValues |
Extra values to support cubic interpolation. | |
![]() | |
std::unique_ptr< mono_float[]> | memories_ [kChannels] |
Unique pointers to each channel's buffer. | |
mono_float * | buffers_ [kChannels] |
Raw pointers to each channel buffer. | |
unsigned int | size_ |
The size of the memory buffer. | |
unsigned int | bitmask_ |
Bitmask for efficient modulo operations. | |
unsigned int | offset_ |
Current write offset in the buffer. | |
A specialized MemoryTemplate for two-channel (stereo) audio.
StereoMemory stores two channels of audio samples and can retrieve past samples for both channels simultaneously using cubic interpolation.
|
inline |
Constructs a stereo memory with the given size.
size | The initial size of the memory buffer. |
|
inline |
Copy constructor.
other | Another StereoMemory to copy from. |
|
inline |
Retrieves a poly_float of samples from the stereo memory using cubic interpolation.
past | A poly_float of "time ago" values (for one channel pair). |