aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMain.h2
-rw-r--r--OpenAL32/Include/alSource.h6
-rw-r--r--OpenAL32/alSource.c34
3 files changed, 31 insertions, 11 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 092da0da..d9549cbf 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -528,7 +528,9 @@ const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans);
#define HRIR_MASK (HRIR_LENGTH-1)
void InitHrtf(void);
ALCboolean IsHrtfCompatible(ALCdevice *device);
+ALfloat CalcHrtfDelta(ALfloat oldGain, ALfloat newGain, const ALfloat olddir[3], const ALfloat newdir[3]);
void GetLerpedHrtfCoeffs(ALfloat elevation, ALfloat azimuth, ALfloat gain, ALfloat (*coeffs)[2], ALuint *delays);
+ALint GetMovingHrtfCoeffs(ALfloat elevation, ALfloat azimuth, ALfloat gain, ALfloat delta, ALint counter, ALfloat (*coeffs)[2], ALuint *delays, ALfloat (*coeffStep)[2], ALint *delayStep);
void al_print(const char *fname, unsigned int line, const char *fmt, ...)
PRINTF_STYLE(3,4);
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index df2b7cd4..0f0eca7e 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -86,6 +86,8 @@ typedef struct ALsource
ALuint SampleSize;
/* HRTF info */
+ ALboolean HrtfMoving;
+ ALuint HrtfCounter;
ALfloat HrtfHistory[MAXCHANNELS][SRC_HISTORY_LENGTH];
ALfloat HrtfValues[MAXCHANNELS][HRIR_LENGTH][2];
ALuint HrtfOffset;
@@ -96,8 +98,12 @@ typedef struct ALsource
ALint Step;
+ ALfloat HrtfGain;
+ ALfloat HrtfDir[3];
ALfloat HrtfCoeffs[MAXCHANNELS][HRIR_LENGTH][2];
ALuint HrtfDelay[MAXCHANNELS][2];
+ ALfloat HrtfCoeffStep[HRIR_LENGTH][2];
+ ALint HrtfDelayStep[2];
/* A mixing matrix. First subscript is the channel number of the input
* data (regardless of channel configuration) and the second is the
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index a94a8f4a..cf7c8842 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -1314,7 +1314,7 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources)
ALCcontext *Context;
ALsource *Source;
ALbufferlistitem *BufferList;
- ALsizei i, j;
+ ALsizei i, j, k;
Context = GetLockedContext();
if(!Context) return;
@@ -1384,18 +1384,10 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources)
continue;
}
- if(Source->state != AL_PAUSED)
+ if(Source->state != AL_PLAYING)
{
- Source->state = AL_PLAYING;
- Source->position = 0;
- Source->position_fraction = 0;
- Source->BuffersPlayed = 0;
-
- Source->Buffer = Source->queue->buffer;
-
for(j = 0;j < MAXCHANNELS;j++)
{
- ALuint k;
for(k = 0;k < SRC_HISTORY_LENGTH;k++)
Source->HrtfHistory[j][k] = 0.0f;
for(k = 0;k < HRIR_LENGTH;k++)
@@ -1404,7 +1396,16 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources)
Source->HrtfValues[j][k][1] = 0.0f;
}
}
- Source->HrtfOffset = 0;
+ }
+
+ if(Source->state != AL_PAUSED)
+ {
+ Source->state = AL_PLAYING;
+ Source->position = 0;
+ Source->position_fraction = 0;
+ Source->BuffersPlayed = 0;
+
+ Source->Buffer = Source->queue->buffer;
}
else
Source->state = AL_PLAYING;
@@ -1465,7 +1466,11 @@ AL_API ALvoid AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources)
{
Source = (ALsource*)ALTHUNK_LOOKUPENTRY(sources[i]);
if(Source->state == AL_PLAYING)
+ {
Source->state = AL_PAUSED;
+ Source->HrtfMoving = AL_FALSE;
+ Source->HrtfCounter = 0;
+ }
}
done:
@@ -1514,6 +1519,8 @@ AL_API ALvoid AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources)
{
Source->state = AL_STOPPED;
Source->BuffersPlayed = Source->BuffersInQueue;
+ Source->HrtfMoving = AL_FALSE;
+ Source->HrtfCounter = 0;
}
Source->lOffset = 0;
}
@@ -1568,6 +1575,8 @@ AL_API ALvoid AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources)
Source->BuffersPlayed = 0;
if(Source->queue)
Source->Buffer = Source->queue->buffer;
+ Source->HrtfMoving = AL_FALSE;
+ Source->HrtfCounter = 0;
}
Source->lOffset = 0;
}
@@ -1835,6 +1844,9 @@ static ALvoid InitSourceParams(ALsource *Source)
Source->NeedsUpdate = AL_TRUE;
Source->Buffer = NULL;
+
+ Source->HrtfMoving = AL_FALSE;
+ Source->HrtfCounter = 0;
}