diff options
author | Chris Robinson <[email protected]> | 2016-02-23 10:54:42 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-02-23 10:56:06 -0800 |
commit | 68a2ae4024909a6ef785d702ffb90480aac6f0cc (patch) | |
tree | a4fd4746c159751a5b0cf2c23e53829ff19b9a05 /Alc/hrtf.c | |
parent | e7ed3e2f72232dcf00c1f7b14f40d9c6e00c3633 (diff) |
Replace the hrtf_tables option with hrtf-paths
Diffstat (limited to 'Alc/hrtf.c')
-rw-r--r-- | Alc/hrtf.c | 49 |
1 files changed, 32 insertions, 17 deletions
@@ -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)) { |