Deluge Firmware
1.3.0
Build date: 2026.08.22
Toggle main menu visibility
Loading...
Searching...
No Matches
interpolate.h
1
#pragma once
2
#include "definitions_cxx.hpp"
3
#include "deluge/dsp/stereo_sample.h"
4
#include <array>
5
#include <cstdint>
6
7
extern
const
int16_t windowedSincKernel[][17][16];
8
9
namespace
deluge::dsp {
10
struct
[[gnu::hot]] Interpolator {
11
12
Interpolator() =
default
;
13
StereoSample
interpolate(
size_t
channels, int32_t whichKernel, uint32_t oscPos);
14
StereoSample
interpolateLinear(
size_t
channels, uint32_t oscPos);
15
16
[[gnu::always_inline]]
constexpr
void
pushL(int16_t value) {
17
#pragma unroll
18
for
(int32_t i = kInterpolationMaxNumSamples - 1; i >= 1; i--) {
19
buffer_l[i] = buffer_l[i - 1];
20
}
21
buffer_l[0] = value;
22
}
23
24
[[gnu::always_inline]]
constexpr
void
pushR(int16_t value) {
25
#pragma unroll
26
for
(int32_t i = kInterpolationMaxNumSamples - 1; i >= 1; i--) {
27
buffer_r[i] = buffer_r[i - 1];
28
}
29
buffer_r[0] = value;
30
}
31
32
[[gnu::always_inline]]
constexpr
void
jumpForward(
size_t
num_samples) {
33
#pragma unroll
34
for
(int32_t i = kInterpolationMaxNumSamples - 1; i >= num_samples; i--) {
35
buffer_l[i] = buffer_l[i - num_samples];
36
buffer_r[i] = buffer_r[i - num_samples];
37
}
38
}
39
40
// These are the state buffers (quadword alignment for NEON). Value-initialised: interpolate() reads the full
41
// kInterpolationMaxNumSamples-tap window via SIMD, so any tap not yet pushed must be a defined 0 rather than
42
// whatever the allocation left behind (the live-input pitch-shifter feeds these incrementally on warm-up).
43
alignas
(
sizeof
(int32_t) * 4) std::array<int16_t, kInterpolationMaxNumSamples> buffer_l{};
44
alignas
(
sizeof
(int32_t) * 4) std::array<int16_t, kInterpolationMaxNumSamples> buffer_r{};
45
};
46
}
// namespace deluge::dsp
StereoSample
Definition
stereo_sample.h:25