diff options
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALc.c | 7 | ||||
-rw-r--r-- | Alc/hrtf.c | 15 | ||||
-rw-r--r-- | Alc/hrtf.h | 6 |
3 files changed, 15 insertions, 13 deletions
@@ -1924,7 +1924,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) if(hrtf_userreq == Hrtf_Enable || (hrtf_userreq != Hrtf_Disable && hrtf_appreq == Hrtf_Enable)) { - if(FindHrtfFormat(&device->FmtChans, &device->Frequency)) + if(FindHrtfFormat(device->DeviceName, &device->FmtChans, &device->Frequency)) device->Flags |= DEVICE_CHANNELS_REQUEST | DEVICE_FREQUENCY_REQUEST; else { @@ -1937,7 +1937,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) { enum DevFmtChannels chans = device->FmtChans; ALCuint freq = device->Frequency; - if(!FindHrtfFormat(&chans, &freq) || chans != device->FmtChans || freq != device->Frequency) + if(!FindHrtfFormat(device->DeviceName, &chans, &freq) || + chans != device->FmtChans || freq != device->Frequency) { ERR("Requested format not HRTF compatible: %s, %uhz\n", DevFmtChannelsString(device->FmtChans), device->Frequency); @@ -2057,7 +2058,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) else { device->Hrtf_Status = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; - device->Hrtf = GetHrtf(device->FmtChans, device->Frequency); + device->Hrtf = GetHrtf(device->DeviceName, device->FmtChans, device->Frequency); } if(device->Hrtf) { @@ -726,11 +726,11 @@ static struct Hrtf *LoadHrtf01(FILE *f, ALuint deviceRate) } -static struct Hrtf *LoadHrtf(ALuint deviceRate) +static struct Hrtf *LoadHrtf(const_al_string devname, ALuint deviceRate) { const char *fnamelist = "default-%r.mhr"; - ConfigValueStr(NULL, NULL, "hrtf_tables", &fnamelist); + ConfigValueStr(al_string_get_cstr(devname), NULL, "hrtf_tables", &fnamelist); while(*fnamelist != '\0') { struct Hrtf *Hrtf = NULL; @@ -823,7 +823,7 @@ static struct Hrtf *LoadHrtf(ALuint deviceRate) return NULL; } -const struct Hrtf *GetHrtf(enum DevFmtChannels chans, ALCuint srate) +const struct Hrtf *GetHrtf(const_al_string devname, enum DevFmtChannels chans, ALCuint srate) { if(chans == DevFmtStereo) { @@ -835,15 +835,14 @@ const struct Hrtf *GetHrtf(enum DevFmtChannels chans, ALCuint srate) Hrtf = Hrtf->next; } - Hrtf = LoadHrtf(srate); - if(Hrtf != NULL) - return Hrtf; + Hrtf = LoadHrtf(devname, srate); + if(Hrtf != NULL) return Hrtf; } ERR("Incompatible format: %s %uhz\n", DevFmtChannelsString(chans), srate); return NULL; } -ALCboolean FindHrtfFormat(enum DevFmtChannels *chans, ALCuint *srate) +ALCboolean FindHrtfFormat(const_al_string devname, enum DevFmtChannels *chans, ALCuint *srate) { const struct Hrtf *hrtf = LoadedHrtfs; while(hrtf != NULL) @@ -855,7 +854,7 @@ ALCboolean FindHrtfFormat(enum DevFmtChannels *chans, ALCuint *srate) if(hrtf == NULL) { - hrtf = LoadHrtf(*srate); + hrtf = LoadHrtf(devname, *srate); if(hrtf == NULL) return ALC_FALSE; } @@ -4,6 +4,8 @@ #include "AL/al.h" #include "AL/alc.h" +#include "alstring.h" + enum DevFmtChannels; struct Hrtf; @@ -15,8 +17,8 @@ struct Hrtf; #define HRTFDELAY_FRACONE (1<<HRTFDELAY_BITS) #define HRTFDELAY_MASK (HRTFDELAY_FRACONE-1) -const struct Hrtf *GetHrtf(enum DevFmtChannels chans, ALCuint srate); -ALCboolean FindHrtfFormat(enum DevFmtChannels *chans, ALCuint *srate); +const struct Hrtf *GetHrtf(const_al_string devname, enum DevFmtChannels chans, ALCuint srate); +ALCboolean FindHrtfFormat(const_al_string devname, enum DevFmtChannels *chans, ALCuint *srate); void FreeHrtfs(void); |