From 3761336e6cf49a7cd5075424b3c8c4a1f5e5b226 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 19 Feb 2017 22:47:59 -0800 Subject: Apply distance compensation when writing to the output --- OpenAL32/Include/alMain.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenAL32/Include') diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 947a16ba..bb8a57ce 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -603,6 +603,15 @@ typedef struct HrtfEntry { TYPEDEF_VECTOR(HrtfEntry, vector_HrtfEntry) +/* Maximum delay in samples for speaker distance compensation. */ +#define MAX_DELAY_LENGTH 128 + +typedef struct DistanceComp { + ALfloat Gain; + ALsizei Length; /* Valid range is [0...MAX_DELAY_LENGTH). */ + alignas(16) ALfloat Buffer[MAX_DELAY_LENGTH]; +} DistanceComp; + /* Size for temporary storage of buffer data, in ALfloats. Larger values need * more memory, while smaller values may need more iterations. The value needs * to be a sensible size, however, as it constrains the max stepping value used @@ -723,6 +732,9 @@ struct ALCdevice_struct ALsizei NumChannels; } RealOut; + /* Delay buffers used to compensate for speaker distances. */ + DistanceComp ChannelDelay[MAX_OUTPUT_CHANNELS]; + /* Running count of the mixer invocations, in 31.1 fixed point. This * actually increments *twice* when mixing, first at the start and then at * the end, so the bottom bit indicates if the device is currently mixing -- cgit v1.2.3