Value image of a FreezeHold's held state: everything needed to reproduce the held output bit-for-bit on a hold prepared with the same geometry. More...
#include <freeze_hold.hpp>
Public Member Functions | |
| bool | prepare (int fft, int ch, int hop) |
| Allocate storage for a geometry. Not audio-thread safe. | |
| bool | valid () const noexcept |
| Shape and value check: geometry in bounds, storage sized for it, a consistent fade record, every value finite, magnitudes non-negative, phases wrapped, and a non-zero PRNG state (zero is a fixed point of xorshift). | |
| bool | write_bytes (std::vector< std::uint8_t > &out) const |
| Serialize to the versioned byte image. | |
Static Public Member Functions | |
| static bool | valid_geometry (int fft, int ch, int hop) noexcept |
| static std::size_t | serialized_size (int fft, int ch) noexcept |
| Byte size of the serialized image for a geometry, or 0 when the geometry is outside the supported bounds. | |
| static bool | read_bytes (const std::uint8_t *data, std::size_t size, FreezeHoldSnapshotT &out) |
| Parse a byte image. | |
Public Attributes | |
| int | fft_size = 0 |
| int | channels = 0 |
| int | analysis_hop = 0 |
| int | capture_frames = 0 |
| Frames averaged into the hold (informational). | |
| int | crossfade_frames = 1 |
| Crossfade length and position when the snapshot was taken. | |
| int | fade_step = 0 |
| bool | engaged = false |
| bool | releasing = false |
| double | sample_rate = 0.0 |
| Sample rate of the capture, or 0 when the hold was not told one. | |
| std::uint64_t | rng_state = 0 |
| std::vector< SampleType > | magnitudes |
| std::vector< double > | phases |
| std::vector< double > | inst_freq |
Static Public Attributes | |
| static constexpr std::uint32_t | kFormatVersion = 1 |
| static constexpr int | kMinFftSize = 256 |
| static constexpr int | kMaxFftSize = 16384 |
| static constexpr int | kMaxChannels = 16 |
| static constexpr std::size_t | kHeaderBytes = 56 |
| static constexpr std::uint32_t | kFlagEngaged = 1u |
| static constexpr std::uint32_t | kFlagReleasing = 2u |
Value image of a FreezeHold's held state: everything needed to reproduce the held output bit-for-bit on a hold prepared with the same geometry.
Storage is allocated by prepare() (control thread). Byte serialization allocates and is not audio-thread safe; snapshot() and stage_restore() only copy into prepared storage.
Byte image (little-endian, format version 1), 56-byte header: "PFHS" magic, u32 version, u32 fft_size, u32 channels, u32 analysis_hop, u32 capture_frames, u32 crossfade_frames, u32 fade_step, u32 flags (bit 0 engaged, bit 1 releasing), u32 reserved (0), f64 sample_rate (0 = unknown), u64 rng_state then f32 magnitudes[channels * bins], f64 phases[channels * bins], f64 inst_freq[bins], where bins = fft_size / 2 + 1. Phases are wrapped to [-pi, pi]; instantaneous frequencies are radians per sample. The largest supported image (16384-point, 16 channels) is under 2 MB.
|
inline |
Allocate storage for a geometry. Not audio-thread safe.
|
inlinestatic |
Parse a byte image.
Rejects a wrong magic or version, an out-of-bounds geometry, a size that does not match the geometry exactly, unknown flag or reserved bits, and any invalid value. Allocates; not audio-thread safe. out is only modified on success.
|
inlinestaticnoexcept |
Byte size of the serialized image for a geometry, or 0 when the geometry is outside the supported bounds.
|
inlinenoexcept |
Shape and value check: geometry in bounds, storage sized for it, a consistent fade record, every value finite, magnitudes non-negative, phases wrapped, and a non-zero PRNG state (zero is a fixed point of xorshift).
|
inlinestaticnoexcept |
|
inline |
Serialize to the versioned byte image.
Allocates; not audio-thread safe. Returns false (and leaves out empty) for an invalid image.
| int pulp::signal::FreezeHoldSnapshotT< SampleType >::analysis_hop = 0 |
| int pulp::signal::FreezeHoldSnapshotT< SampleType >::capture_frames = 0 |
Frames averaged into the hold (informational).
| int pulp::signal::FreezeHoldSnapshotT< SampleType >::channels = 0 |
| int pulp::signal::FreezeHoldSnapshotT< SampleType >::crossfade_frames = 1 |
Crossfade length and position when the snapshot was taken.
| bool pulp::signal::FreezeHoldSnapshotT< SampleType >::engaged = false |
| int pulp::signal::FreezeHoldSnapshotT< SampleType >::fade_step = 0 |
| int pulp::signal::FreezeHoldSnapshotT< SampleType >::fft_size = 0 |
| std::vector<double> pulp::signal::FreezeHoldSnapshotT< SampleType >::inst_freq |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
| std::vector<SampleType> pulp::signal::FreezeHoldSnapshotT< SampleType >::magnitudes |
| std::vector<double> pulp::signal::FreezeHoldSnapshotT< SampleType >::phases |
| bool pulp::signal::FreezeHoldSnapshotT< SampleType >::releasing = false |
| std::uint64_t pulp::signal::FreezeHoldSnapshotT< SampleType >::rng_state = 0 |
| double pulp::signal::FreezeHoldSnapshotT< SampleType >::sample_rate = 0.0 |
Sample rate of the capture, or 0 when the hold was not told one.
A restore refuses a known rate that differs from the receiver's.