aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-12-08 22:09:21 -0800
committerChris Robinson <[email protected]>2019-12-08 22:09:21 -0800
commite43c2bba61e2bb78d3d4bb7cbbb510c3e363dfcd (patch)
treed7bd72fabf2f0232d60595f8d794b7b4a289050f /alc
parent0afb5a2ab9f20f1e473039d0948ea1735c4fa81b (diff)
Don't re-sort the enumerated HRTF list
Diffstat (limited to 'alc')
-rw-r--r--alc/hrtf.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/alc/hrtf.cpp b/alc/hrtf.cpp
index 6405c1e8..702355bd 100644
--- a/alc/hrtf.cpp
+++ b/alc/hrtf.cpp
@@ -1113,12 +1113,11 @@ bool checkName(const std::string &name)
void AddFileEntry(const std::string &filename)
{
- /* Check if this file has already been loaded globally. */
- auto enum_iter = std::lower_bound(EnumeratedHrtfs.cbegin(), EnumeratedHrtfs.cend(), filename,
- [](const HrtfEntry &entry, const std::string &fname) -> bool
- { return entry.mFilename < fname; }
- );
- if(enum_iter != EnumeratedHrtfs.cend() && enum_iter->mFilename == filename)
+ /* Check if this file has already been enumerated. */
+ auto enum_iter = std::find_if(EnumeratedHrtfs.cbegin(), EnumeratedHrtfs.cend(),
+ [&filename](const HrtfEntry &entry) -> bool
+ { return entry.mFilename == filename; });
+ if(enum_iter != EnumeratedHrtfs.cend())
{
TRACE("Skipping duplicate file entry %s\n", filename.c_str());
return;
@@ -1142,7 +1141,8 @@ void AddFileEntry(const std::string &filename)
newname += " #";
newname += std::to_string(++count);
}
- const HrtfEntry &entry = *EnumeratedHrtfs.insert(enum_iter, HrtfEntry{newname, filename});
+ EnumeratedHrtfs.emplace_back(HrtfEntry{newname, filename});
+ const HrtfEntry &entry = EnumeratedHrtfs.back();
TRACE("Adding file entry \"%s\"\n", entry.mFilename.c_str());
}
@@ -1154,11 +1154,10 @@ void AddBuiltInEntry(const std::string &dispname, ALuint residx)
{
const std::string filename{'!'+std::to_string(residx)+'_'+dispname};
- auto enum_iter = std::lower_bound(EnumeratedHrtfs.cbegin(), EnumeratedHrtfs.cend(), filename,
- [](const HrtfEntry &entry, const std::string &fname) -> bool
- { return entry.mFilename < fname; }
- );
- if(enum_iter != EnumeratedHrtfs.cend() && enum_iter->mFilename == filename)
+ auto enum_iter = std::find_if(EnumeratedHrtfs.cbegin(), EnumeratedHrtfs.cend(),
+ [&filename](const HrtfEntry &entry) -> bool
+ { return entry.mFilename == filename; });
+ if(enum_iter != EnumeratedHrtfs.cend())
{
TRACE("Skipping duplicate file entry %s\n", filename.c_str());
return;
@@ -1175,7 +1174,8 @@ void AddBuiltInEntry(const std::string &dispname, ALuint residx)
newname += " #";
newname += std::to_string(++count);
}
- const HrtfEntry &entry = *EnumeratedHrtfs.insert(enum_iter, HrtfEntry{newname, filename});
+ EnumeratedHrtfs.emplace_back(HrtfEntry{newname, filename});
+ const HrtfEntry &entry = EnumeratedHrtfs.back();
TRACE("Adding built-in entry \"%s\"\n", entry.mFilename.c_str());
}