Properly skip loading of already-loaded HRTF data sets
Previously, if an HRTF file was loaded it would not only skip loading it, but it would also skip adding it to the output enumeration list. Now it properly skips loading it when it's already loaded, but still adds it to the enumeration list if it's not already in it.
This commit is contained in:
+24
-4
@@ -512,13 +512,22 @@ static void AddFileEntry(vector_HrtfEntry *list, al_string *filename)
|
||||
if(!name) name = al_string_get_cstr(*filename);
|
||||
else ++name;
|
||||
|
||||
#define MATCH_FNAME(i) (al_string_cmp_cstr(*filename, (i)->hrtf->filename) == 0)
|
||||
VECTOR_FIND_IF(iter, const HrtfEntry, *list, MATCH_FNAME);
|
||||
if(iter != VECTOR_END(*list))
|
||||
{
|
||||
TRACE("Skipping duplicate file entry %s\n", al_string_get_cstr(*filename));
|
||||
goto done;
|
||||
}
|
||||
#undef MATCH_FNAME
|
||||
|
||||
entry.hrtf = LoadedHrtfs;
|
||||
while(entry.hrtf)
|
||||
{
|
||||
if(al_string_cmp_cstr(*filename, entry.hrtf->filename) == 0)
|
||||
{
|
||||
TRACE("Skipping duplicate file entry %s\n", al_string_get_cstr(*filename));
|
||||
goto done;
|
||||
TRACE("Skipping load of already-loaded file %s\n", al_string_get_cstr(*filename));
|
||||
goto skip_load;
|
||||
}
|
||||
entry.hrtf = entry.hrtf->next;
|
||||
}
|
||||
@@ -562,6 +571,7 @@ static void AddFileEntry(vector_HrtfEntry *list, al_string *filename)
|
||||
DevFmtChannelsString(DevFmtStereo), hrtf->sampleRate);
|
||||
entry.hrtf = hrtf;
|
||||
|
||||
skip_load:
|
||||
/* TODO: Get a human-readable name from the HRTF data (possibly coming in a
|
||||
* format update). */
|
||||
ext = strrchr(name, '.');
|
||||
@@ -784,13 +794,22 @@ static void AddBuiltInEntry(vector_HrtfEntry *list, const ALubyte *data, size_t
|
||||
const HrtfEntry *iter;
|
||||
int i;
|
||||
|
||||
#define MATCH_FNAME(i) (al_string_cmp_cstr(*filename, (i)->hrtf->filename) == 0)
|
||||
VECTOR_FIND_IF(iter, const HrtfEntry, *list, MATCH_FNAME);
|
||||
if(iter != VECTOR_END(*list))
|
||||
{
|
||||
TRACE("Skipping duplicate file entry %s\n", al_string_get_cstr(*filename));
|
||||
goto done;
|
||||
}
|
||||
#undef MATCH_FNAME
|
||||
|
||||
entry.hrtf = LoadedHrtfs;
|
||||
while(entry.hrtf)
|
||||
{
|
||||
if(al_string_cmp_cstr(*filename, entry.hrtf->filename) == 0)
|
||||
{
|
||||
TRACE("Skipping duplicate file entry %s\n", al_string_get_cstr(*filename));
|
||||
goto done;
|
||||
TRACE("Skipping load of already-loaded file %s\n", al_string_get_cstr(*filename));
|
||||
goto skip_load;
|
||||
}
|
||||
entry.hrtf = entry.hrtf->next;
|
||||
}
|
||||
@@ -825,6 +844,7 @@ static void AddBuiltInEntry(vector_HrtfEntry *list, const ALubyte *data, size_t
|
||||
DevFmtChannelsString(DevFmtStereo), hrtf->sampleRate);
|
||||
entry.hrtf = hrtf;
|
||||
|
||||
skip_load:
|
||||
i = 0;
|
||||
do {
|
||||
al_string_copy(&entry.name, *filename);
|
||||
|
||||
Reference in New Issue
Block a user