aboutsummaryrefslogtreecommitdiffstats
path: root/alc/mixer/defs.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-12-03 23:09:23 -0800
committerChris Robinson <[email protected]>2020-12-04 11:15:50 -0800
commitb1c2671e9dfa68c03bec124f2ead59246caf7672 (patch)
treedf2eedc53cdc229d2c569e144a6aa107c18756e4 /alc/mixer/defs.h
parent75f469fa711cda76a6f5a69773fb467babf3436d (diff)
Move the resampler declarations to a more appropriate header
Diffstat (limited to 'alc/mixer/defs.h')
-rw-r--r--alc/mixer/defs.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/alc/mixer/defs.h b/alc/mixer/defs.h
index f8bdf428..299830a8 100644
--- a/alc/mixer/defs.h
+++ b/alc/mixer/defs.h
@@ -26,6 +26,43 @@ constexpr int MixerFracMask{MixerFracOne - 1};
constexpr int MaxResamplerPadding{48};
+enum class Resampler {
+ Point,
+ Linear,
+ Cubic,
+ FastBSinc12,
+ BSinc12,
+ FastBSinc24,
+ BSinc24,
+
+ Max = BSinc24
+};
+
+/* Interpolator state. Kind of a misnomer since the interpolator itself is
+ * stateless. This just keeps it from having to recompute scale-related
+ * mappings for every sample.
+ */
+struct BsincState {
+ float sf; /* Scale interpolation factor. */
+ uint m; /* Coefficient count. */
+ uint l; /* Left coefficient offset. */
+ /* Filter coefficients, followed by the phase, scale, and scale-phase
+ * delta coefficients. Starting at phase index 0, each subsequent phase
+ * index follows contiguously.
+ */
+ const float *filter;
+};
+
+union InterpState {
+ BsincState bsinc;
+};
+
+using ResamplerFunc = const float*(*)(const InterpState *state, const float *RESTRICT src,
+ uint frac, uint increment, const al::span<float> dst);
+
+ResamplerFunc PrepareResampler(Resampler resampler, uint increment, InterpState *state);
+
+
template<typename TypeTag, typename InstTag>
const float *Resample_(const InterpState *state, const float *RESTRICT src, uint frac,
uint increment, const al::span<float> dst);