summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-06-20 16:43:14 -0700
committerChris Robinson <[email protected]>2014-06-20 16:43:14 -0700
commitbe903d67b87a38616d4b7a901c3bf93441b1cb91 (patch)
tree6db2e9234f790b541637d07007ee17b81b59d094
parentfb25a70f9533a8ada104f1d84b1ed9d1eb69ccc0 (diff)
Don't pass the device to HRTF methods
-rw-r--r--Alc/ALc.c8
-rw-r--r--Alc/hrtf.c17
-rw-r--r--Alc/hrtf.h4
3 files changed, 14 insertions, 15 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 80cddf54..1b3e3ba8 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1790,9 +1790,9 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
}
if((device->Flags&DEVICE_HRTF_REQUEST))
{
- enum DevFmtChannels chans;
- ALCuint freq;
- if(FindHrtfFormat(device, &chans, &freq))
+ enum DevFmtChannels chans = device->FmtChans;
+ ALCuint freq = device->Frequency;
+ if(FindHrtfFormat(&chans, &freq))
{
if(device->Type != Loopback)
{
@@ -1843,7 +1843,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
device->Hrtf = NULL;
if((device->Flags&DEVICE_HRTF_REQUEST))
{
- device->Hrtf = GetHrtf(device);
+ device->Hrtf = GetHrtf(device->FmtChans, device->Frequency);
if(!device->Hrtf)
device->Flags &= ~DEVICE_HRTF_REQUEST;
}
diff --git a/Alc/hrtf.c b/Alc/hrtf.c
index a0f8833b..e32ae80a 100644
--- a/Alc/hrtf.c
+++ b/Alc/hrtf.c
@@ -745,40 +745,39 @@ static struct Hrtf *LoadHrtf(ALuint deviceRate)
return NULL;
}
-const struct Hrtf *GetHrtf(ALCdevice *device)
+const struct Hrtf *GetHrtf(enum DevFmtChannels chans, ALCuint srate)
{
- if(device->FmtChans == DevFmtStereo)
+ if(chans == DevFmtStereo)
{
struct Hrtf *Hrtf = LoadedHrtfs;
while(Hrtf != NULL)
{
- if(device->Frequency == Hrtf->sampleRate)
+ if(srate == Hrtf->sampleRate)
return Hrtf;
Hrtf = Hrtf->next;
}
- Hrtf = LoadHrtf(device->Frequency);
+ Hrtf = LoadHrtf(srate);
if(Hrtf != NULL)
return Hrtf;
}
- ERR("Incompatible format: %s %uhz\n",
- DevFmtChannelsString(device->FmtChans), device->Frequency);
+ ERR("Incompatible format: %s %uhz\n", DevFmtChannelsString(chans), srate);
return NULL;
}
-ALCboolean FindHrtfFormat(const ALCdevice *device, enum DevFmtChannels *chans, ALCuint *srate)
+ALCboolean FindHrtfFormat(enum DevFmtChannels *chans, ALCuint *srate)
{
const struct Hrtf *hrtf = LoadedHrtfs;
while(hrtf != NULL)
{
- if(device->Frequency == hrtf->sampleRate)
+ if(*srate == hrtf->sampleRate)
break;
hrtf = hrtf->next;
}
if(hrtf == NULL)
{
- hrtf = LoadHrtf(device->Frequency);
+ hrtf = LoadHrtf(*srate);
if(hrtf == NULL) return ALC_FALSE;
}
diff --git a/Alc/hrtf.h b/Alc/hrtf.h
index d9022d02..488c81d9 100644
--- a/Alc/hrtf.h
+++ b/Alc/hrtf.h
@@ -15,8 +15,8 @@ struct Hrtf;
#define HRTFDELAY_FRACONE (1<<HRTFDELAY_BITS)
#define HRTFDELAY_MASK (HRTFDELAY_FRACONE-1)
-const struct Hrtf *GetHrtf(ALCdevice *device);
-ALCboolean FindHrtfFormat(const ALCdevice *device, enum DevFmtChannels *chans, ALCuint *srate);
+const struct Hrtf *GetHrtf(enum DevFmtChannels chans, ALCuint srate);
+ALCboolean FindHrtfFormat(enum DevFmtChannels *chans, ALCuint *srate);
void FreeHrtfs(void);