aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/hrtf.c
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/hrtf.c')
-rw-r--r--Alc/hrtf.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/Alc/hrtf.c b/Alc/hrtf.c
index beb67e76..eeb4be41 100644
--- a/Alc/hrtf.c
+++ b/Alc/hrtf.c
@@ -603,43 +603,58 @@ done:
vector_HrtfEntry EnumerateHrtf(const_al_string devname)
{
vector_HrtfEntry list = VECTOR_INIT_STATIC();
- const char *fnamelist = "%s.mhr";
const char *defaulthrtf = "";
+ const char *pathlist = "";
+ bool usedefaults = true;
- ConfigValueStr(al_string_get_cstr(devname), NULL, "hrtf_tables", &fnamelist);
- while(fnamelist && *fnamelist)
+ if(ConfigValueStr(al_string_get_cstr(devname), NULL, "hrtf-paths", &pathlist))
{
- while(isspace(*fnamelist) || *fnamelist == ',')
- fnamelist++;
- if(*fnamelist != '\0')
+ while(pathlist && *pathlist)
{
const char *next, *end;
- next = strchr(fnamelist, ',');
- if(!next)
- end = fnamelist + strlen(fnamelist);
- else
+ while(isspace(*pathlist) || *pathlist == ',')
+ pathlist++;
+ if(*pathlist == '\0')
+ continue;
+
+ next = strchr(pathlist, ',');
+ if(next)
end = next++;
+ else
+ {
+ end = pathlist + strlen(pathlist);
+ usedefaults = false;
+ }
- while(end != fnamelist && isspace(*(end-1)))
+ while(end != pathlist && isspace(*(end-1)))
--end;
- if(end != fnamelist)
+ if(end != pathlist)
{
- al_string fname = AL_STRING_INIT_STATIC();
+ al_string pname = AL_STRING_INIT_STATIC();
vector_al_string flist;
- al_string_append_range(&fname, fnamelist, end);
+ al_string_append_range(&pname, pathlist, end);
- flist = SearchDataFiles(al_string_get_cstr(fname), "openal/hrtf");
+ flist = SearchDataFiles(".mhr", al_string_get_cstr(pname));
VECTOR_FOR_EACH_PARAMS(al_string, flist, AddFileEntry, &list);
VECTOR_DEINIT(flist);
- al_string_deinit(&fname);
+ al_string_deinit(&pname);
}
- fnamelist = next;
+ pathlist = next;
}
}
+ else if(ConfigValueExists(al_string_get_cstr(devname), NULL, "hrtf_tables"))
+ ERR("The hrtf_tables option is deprecated, please use hrtf-paths instead.\n");
+
+ if(usedefaults)
+ {
+ vector_al_string flist = SearchDataFiles(".mhr", "openal/hrtf");
+ VECTOR_FOR_EACH_PARAMS(al_string, flist, AddFileEntry, &list);
+ VECTOR_DEINIT(flist);
+ }
if(VECTOR_SIZE(list) > 1 && ConfigValueStr(al_string_get_cstr(devname), NULL, "default-hrtf", &defaulthrtf))
{