One voice's position in a zone and its band-limited read.
More...
#include <SampleReader.h>
|
| void | allocate () |
| | Allocates the scatter accumulators (setup thread).
|
| |
| void | start (const SampleZoneData< T > &z, double ratio) noexcept |
| | Starts reading a zone from its start offset. A reader that starts above the recording's rate (ratio > 1) scatters for the rest of the note, otherwise it gathers.
|
| |
| void | release () noexcept |
| | The key is released: a Sustain loop plays on past its end.
|
| |
| bool | scatters () const noexcept |
| | True when this reader scatters (it started above the recording's rate).
|
| |
| double | minRate () const noexcept |
| | Lowest rate next() accepts for this reader.
|
| |
| const SampleZoneData< T > * | zone () const noexcept |
| | The zone being read (null before start()).
|
| |
| Frame | next (double ratio, int outChannels, T *weights, double &a0, double &a1) noexcept |
| | One output frame at ratio recording samples per output sample.
|
| |
|
| static constexpr int | kHalfTaps = 32 |
| | Zero crossings on each side of the kernel at unit rate: 64 taps.
|
| |
| static constexpr int | kTablePerUnit = 2048 |
| | Table points per zero crossing (linear interpolation between them).
|
| |
| static constexpr double | kMaxRate = 8.0 |
| | Highest playback rate; the kernel then spans 8 x 64 taps.
|
| |
| static constexpr double | kMinScatterRate = 1.0 / kMaxRate |
| | Lowest rate of the scatter form, whose kernel widens as the rate falls.
|
| |
| static constexpr double | kMinGatherRate = 1.0 / 8192.0 |
| |
| static constexpr int | kMaxHalfTaps = static_cast<int>(kHalfTaps * kMaxRate) |
| |
| static constexpr double | kCutoff = 0.9 |
| |
| static constexpr double | kBeta = 10.06 |
| |
| static constexpr int | kPhases = 2048 |
| | Phases of the unit-rate polyphase table (rows interpolated linearly).
|
| |
| static constexpr int | kTaps = 2 * kHalfTaps |
| |
| static constexpr int | kWeightsLength = 2 * kMaxHalfTaps + 2 |
| | Scratch weights a caller provides to next().
|
| |
| static constexpr int | kAccLength = 4 * kMaxHalfTaps + 256 |
| |
template<FloatType T>
class dspark::detail::SampleReader< T >
One voice's position in a zone and its band-limited read.
Definition at line 284 of file SampleReader.h.
◆ Frame
What one call produced.
| Enumerator |
|---|
| Ended | The zone ended before this sample: nothing produced.
|
| Produced | A frame was produced.
|
| Last | A frame was produced and it was the last one.
|
Definition at line 313 of file SampleReader.h.
◆ allocate()
Allocates the scatter accumulators (setup thread).
Definition at line 376 of file SampleReader.h.
◆ kernelTable()
Kernel h(t) for t >= 0 in zero crossings, sampled kTablePerUnit per unit.
Definition at line 321 of file SampleReader.h.
◆ minRate()
◆ next()
One output frame at ratio recording samples per output sample.
- Parameters
-
| ratio | Playback rate, within [minRate(), kMaxRate]. |
| outChannels | Output channels: 1 mixes the zone's channels to one, 2 or more read its first two. |
| weights | Scratch of kWeightsLength values. |
| a0 | The frame's first (or only) channel. |
| a1 | The frame's second channel; not meaningful for one output channel or a mono zone, where a0 is used. |
Definition at line 430 of file SampleReader.h.
◆ polyphaseTable()
The unit-rate kernel as rows: row q holds the 64 tap weights for a fractional position q / kPhases, taps k = -31 .. 32 at distance k - frac. A voice at or below the recording's rate blends two adjacent rows, which is the same kernel as the scalar table read tap by tap, laid out so the blend and the dot products run over contiguous memory.
Definition at line 357 of file SampleReader.h.
◆ release()
The key is released: a Sustain loop plays on past its end.
Definition at line 405 of file SampleReader.h.
◆ scatters()
True when this reader scatters (it started above the recording's rate).
Definition at line 411 of file SampleReader.h.
◆ start()
Starts reading a zone from its start offset. A reader that starts above the recording's rate (ratio > 1) scatters for the rest of the note, otherwise it gathers.
Definition at line 386 of file SampleReader.h.
◆ zone()
◆ kAccLength
Scatter accumulator per channel: room for the widest kernel plus a stretch of output before it slides back.
Definition at line 310 of file SampleReader.h.
◆ kBeta
◆ kCutoff
Cutoff at 0.45 of the sample rate (normalised to Nyquist): passband to 0.40, stopband from 0.50, the width a 64-tap Kaiser needs for 100 dB.
Definition at line 301 of file SampleReader.h.
◆ kHalfTaps
Zero crossings on each side of the kernel at unit rate: 64 taps.
Definition at line 288 of file SampleReader.h.
◆ kMaxHalfTaps
◆ kMaxRate
Highest playback rate; the kernel then spans 8 x 64 taps.
Definition at line 292 of file SampleReader.h.
◆ kMinGatherRate
Lowest rate of the gather form, whose kernel keeps its width: only a guard against a stopped read, 13 octaves down.
Definition at line 297 of file SampleReader.h.
◆ kMinScatterRate
Lowest rate of the scatter form, whose kernel widens as the rate falls.
Definition at line 294 of file SampleReader.h.
◆ kPhases
Phases of the unit-rate polyphase table (rows interpolated linearly).
Definition at line 304 of file SampleReader.h.
◆ kTablePerUnit
Table points per zero crossing (linear interpolation between them).
Definition at line 290 of file SampleReader.h.
◆ kTaps
◆ kWeightsLength
The documentation for this class was generated from the following file: