diff options
-rw-r--r-- | alc/mixer/defs.h | 37 | ||||
-rw-r--r-- | alc/voice.h | 40 |
2 files changed, 39 insertions, 38 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); diff --git a/alc/voice.h b/alc/voice.h index bb3d5e02..8a7d12d1 100644 --- a/alc/voice.h +++ b/alc/voice.h @@ -33,44 +33,6 @@ enum class DirectMode : unsigned char { RemixMismatch }; -enum class Resampler { - Point, - Linear, - Cubic, - FastBSinc12, - BSinc12, - FastBSinc24, - BSinc24, - - Max = BSinc24 -}; -extern Resampler ResamplerDefault; - - -/* 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); - enum { AF_None = 0, @@ -262,4 +224,6 @@ struct Voice { DEF_NEWDEL(Voice) }; +extern Resampler ResamplerDefault; + #endif /* VOICE_H */ |