aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-08-27 10:16:36 -0700
committerChris Robinson <[email protected]>2017-08-27 10:16:36 -0700
commita4d357de06b3860f49f2f6f70899d825b920947b (patch)
tree3532665177753d3f6d6cb8a5c6a9b702a48d403a /OpenAL32
parent773d4664ff8f31837374164b64b992b86fcc80f7 (diff)
Add a higher quality bsinc resampler using 24 sample points
This improves the transition width, allowing more of the higher frequencies remain audible. It would be preferrable to have an upper limit of 32 points instead of 48, to reduce the overall table size and the CPU cost for down- sampling.
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alu.h15
-rw-r--r--OpenAL32/alState.c2
2 files changed, 12 insertions, 5 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index e5fd8b09..b322995b 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -24,16 +24,17 @@
#define MAX_PITCH (255)
/* Maximum number of buffer samples before the current pos needed for resampling. */
-#define MAX_PRE_SAMPLES 12
+#define MAX_PRE_SAMPLES 24
/* Maximum number of buffer samples after the current pos needed for resampling. */
-#define MAX_POST_SAMPLES 12
+#define MAX_POST_SAMPLES 24
#ifdef __cplusplus
extern "C" {
#endif
+struct BSincTable;
struct ALsource;
struct ALbufferlistitem;
struct ALvoice;
@@ -54,8 +55,9 @@ enum Resampler {
LinearResampler,
FIR4Resampler,
BSinc12Resampler,
+ BSinc24Resampler,
- ResamplerMax = BSinc12Resampler
+ ResamplerMax = BSinc24Resampler
};
extern enum Resampler ResamplerDefault;
@@ -91,13 +93,16 @@ typedef union InterpState {
Sinc4State sinc4;
} InterpState;
-ALboolean BsincPrepare(const ALuint increment, BsincState *state);
-
typedef const ALfloat* (*ResamplerFunc)(const InterpState *state,
const ALfloat *restrict src, ALsizei frac, ALint increment,
ALfloat *restrict dst, ALsizei dstlen
);
+ALboolean BsincPrepare(const ALuint increment, BsincState *state, const struct BSincTable *table);
+
+extern const struct BSincTable bsinc12;
+extern const struct BSincTable bsinc24;
+
typedef union aluVector {
alignas(16) ALfloat v[4];
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c
index 19b0996c..f71f0eac 100644
--- a/OpenAL32/alState.c
+++ b/OpenAL32/alState.c
@@ -52,6 +52,7 @@ static const ALchar alPointResampler[] = "Nearest";
static const ALchar alLinearResampler[] = "Linear";
static const ALchar alSinc4Resampler[] = "4-Point Sinc";
static const ALchar alBSinc12Resampler[] = "Band-limited Sinc (12/24)";
+static const ALchar alBSinc24Resampler[] = "Band-limited Sinc (24/48)";
AL_API ALvoid AL_APIENTRY alEnable(ALenum capability)
{
@@ -751,6 +752,7 @@ AL_API const ALchar* AL_APIENTRY alGetStringiSOFT(ALenum pname, ALsizei index)
const char *ResamplerNames[] = {
alPointResampler, alLinearResampler,
alSinc4Resampler, alBSinc12Resampler,
+ alBSinc24Resampler,
};
const ALchar *value = NULL;
ALCcontext *context;