diff options
author | Chris Robinson <[email protected]> | 2023-05-12 18:02:12 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-05-12 18:02:12 -0700 |
commit | e7ea579ca5f3c0da6cfe80ec9a7295bca60198aa (patch) | |
tree | 43e7e7d3ac1cbdbfd3705986238853eec72c272e /core | |
parent | 72f02418e505a192c0cc7b27cd7b3aa28a7a03ec (diff) |
Avoid using al::vector unnecessarily
Diffstat (limited to 'core')
-rw-r--r-- | core/bformatdec.h | 4 | ||||
-rw-r--r-- | core/hrtf.cpp | 52 | ||||
-rw-r--r-- | core/hrtf.h | 4 | ||||
-rw-r--r-- | core/logging.cpp | 4 |
4 files changed, 32 insertions, 32 deletions
diff --git a/core/bformatdec.h b/core/bformatdec.h index 7a27a5a4..42024bd9 100644 --- a/core/bformatdec.h +++ b/core/bformatdec.h @@ -4,6 +4,7 @@ #include <array> #include <cstddef> #include <memory> +#include <vector> #include "almalloc.h" #include "alspan.h" @@ -11,7 +12,6 @@ #include "bufferline.h" #include "devformat.h" #include "filters/splitter.h" -#include "vector.h" struct FrontStablizer; @@ -43,7 +43,7 @@ class BFormatDec { * only be used in a standard layout struct, and a std::unique_ptr member * (mStablizer) causes GCC and Clang to warn it's not. */ - al::vector<ChannelDecoder> mChannelDec; + std::vector<ChannelDecoder> mChannelDec; public: BFormatDec(const size_t inchans, const al::span<const ChannelDec> coeffs, diff --git a/core/hrtf.cpp b/core/hrtf.cpp index 607e3d3d..7d11ee19 100644 --- a/core/hrtf.cpp +++ b/core/hrtf.cpp @@ -20,6 +20,7 @@ #include <optional> #include <type_traits> #include <utility> +#include <vector> #include "albit.h" #include "alfstream.h" @@ -34,7 +35,6 @@ #include "mixer/hrtfdefs.h" #include "opthelpers.h" #include "polyphase_resampler.h" -#include "vector.h" namespace { @@ -98,10 +98,10 @@ constexpr char magicMarker03[8]{'M','i','n','P','H','R','0','3'}; constexpr auto PassthruCoeff = static_cast<float>(1.0/al::numbers::sqrt2); std::mutex LoadedHrtfLock; -al::vector<LoadedHrtf> LoadedHrtfs; +std::vector<LoadedHrtf> LoadedHrtfs; std::mutex EnumeratedHrtfLock; -al::vector<HrtfEntry> EnumeratedHrtfs; +std::vector<HrtfEntry> EnumeratedHrtfs; class databuf final : public std::streambuf { @@ -295,7 +295,7 @@ void DirectHrtfState::build(const HrtfStore *Hrtf, const uint irSize, const bool } uint min_delay{HrtfHistoryLength*HrirDelayFracOne}, max_delay{0}; - al::vector<ImpulseResponse> impres; impres.reserve(AmbiPoints.size()); + std::vector<ImpulseResponse> impres; impres.reserve(AmbiPoints.size()); auto calc_res = [Hrtf,&max_delay,&min_delay](const AngularPoint &pt) -> ImpulseResponse { auto &field = Hrtf->mFields[0]; @@ -331,7 +331,7 @@ void DirectHrtfState::build(const HrtfStore *Hrtf, const uint irSize, const bool TRACE("Min delay: %.2f, max delay: %.2f, FIR length: %u\n", min_delay/double{HrirDelayFracOne}, max_delay/double{HrirDelayFracOne}, irSize); - auto tmpres = al::vector<std::array<double2,HrirLength>>(mChannels.size()); + auto tmpres = std::vector<std::array<double2,HrirLength>>(mChannels.size()); max_delay = 0; for(size_t c{0u};c < AmbiPoints.size();++c) { @@ -529,7 +529,7 @@ std::unique_ptr<HrtfStore> LoadHrtf00(std::istream &data, const char *filename) return nullptr; } - auto elevs = al::vector<HrtfStore::Elevation>(evCount); + auto elevs = std::vector<HrtfStore::Elevation>(evCount); for(auto &elev : elevs) elev.irOffset = readle<uint16_t>(data); if(!data || data.eof()) @@ -571,8 +571,8 @@ std::unique_ptr<HrtfStore> LoadHrtf00(std::istream &data, const char *filename) return nullptr; } - auto coeffs = al::vector<HrirArray>(irCount, HrirArray{}); - auto delays = al::vector<ubyte2>(irCount); + auto coeffs = std::vector<HrirArray>(irCount, HrirArray{}); + auto delays = std::vector<ubyte2>(irCount); for(auto &hrir : coeffs) { for(auto &val : al::span<float2>{hrir.data(), irSize}) @@ -626,7 +626,7 @@ std::unique_ptr<HrtfStore> LoadHrtf01(std::istream &data, const char *filename) return nullptr; } - auto elevs = al::vector<HrtfStore::Elevation>(evCount); + auto elevs = std::vector<HrtfStore::Elevation>(evCount); for(auto &elev : elevs) elev.azCount = readle<uint8_t>(data); if(!data || data.eof()) @@ -649,8 +649,8 @@ std::unique_ptr<HrtfStore> LoadHrtf01(std::istream &data, const char *filename) elevs[i].irOffset = static_cast<ushort>(elevs[i-1].irOffset + elevs[i-1].azCount); const ushort irCount{static_cast<ushort>(elevs.back().irOffset + elevs.back().azCount)}; - auto coeffs = al::vector<HrirArray>(irCount, HrirArray{}); - auto delays = al::vector<ubyte2>(irCount); + auto coeffs = std::vector<HrirArray>(irCount, HrirArray{}); + auto delays = std::vector<ubyte2>(irCount); for(auto &hrir : coeffs) { for(auto &val : al::span<float2>{hrir.data(), irSize}) @@ -722,8 +722,8 @@ std::unique_ptr<HrtfStore> LoadHrtf02(std::istream &data, const char *filename) return nullptr; } - auto fields = al::vector<HrtfStore::Field>(fdCount); - auto elevs = al::vector<HrtfStore::Elevation>{}; + auto fields = std::vector<HrtfStore::Field>(fdCount); + auto elevs = std::vector<HrtfStore::Elevation>{}; for(size_t f{0};f < fdCount;f++) { const ushort distance{readle<uint16_t>(data)}; @@ -787,8 +787,8 @@ std::unique_ptr<HrtfStore> LoadHrtf02(std::istream &data, const char *filename) }); const auto irTotal = static_cast<ushort>(elevs.back().azCount + elevs.back().irOffset); - auto coeffs = al::vector<HrirArray>(irTotal, HrirArray{}); - auto delays = al::vector<ubyte2>(irTotal); + auto coeffs = std::vector<HrirArray>(irTotal, HrirArray{}); + auto delays = std::vector<ubyte2>(irTotal); if(channelType == ChanType_LeftOnly) { if(sampleType == SampleType_S16) @@ -881,10 +881,10 @@ std::unique_ptr<HrtfStore> LoadHrtf02(std::istream &data, const char *filename) if(fdCount > 1) { - auto fields_ = al::vector<HrtfStore::Field>(fields.size()); - auto elevs_ = al::vector<HrtfStore::Elevation>(elevs.size()); - auto coeffs_ = al::vector<HrirArray>(coeffs.size()); - auto delays_ = al::vector<ubyte2>(delays.size()); + auto fields_ = std::vector<HrtfStore::Field>(fields.size()); + auto elevs_ = std::vector<HrtfStore::Elevation>(elevs.size()); + auto coeffs_ = std::vector<HrirArray>(coeffs.size()); + auto delays_ = std::vector<ubyte2>(delays.size()); /* Simple reverse for the per-field elements. */ std::reverse_copy(fields.cbegin(), fields.cend(), fields_.begin()); @@ -983,8 +983,8 @@ std::unique_ptr<HrtfStore> LoadHrtf03(std::istream &data, const char *filename) return nullptr; } - auto fields = al::vector<HrtfStore::Field>(fdCount); - auto elevs = al::vector<HrtfStore::Elevation>{}; + auto fields = std::vector<HrtfStore::Field>(fdCount); + auto elevs = std::vector<HrtfStore::Elevation>{}; for(size_t f{0};f < fdCount;f++) { const ushort distance{readle<uint16_t>(data)}; @@ -1048,8 +1048,8 @@ std::unique_ptr<HrtfStore> LoadHrtf03(std::istream &data, const char *filename) }); const auto irTotal = static_cast<ushort>(elevs.back().azCount + elevs.back().irOffset); - auto coeffs = al::vector<HrirArray>(irTotal, HrirArray{}); - auto delays = al::vector<ubyte2>(irTotal); + auto coeffs = std::vector<HrirArray>(irTotal, HrirArray{}); + auto delays = std::vector<ubyte2>(irTotal); if(channelType == ChanType_LeftOnly) { for(auto &hrir : coeffs) @@ -1221,7 +1221,7 @@ al::span<const char> GetResource(int name) } // namespace -al::vector<std::string> EnumerateHrtf(std::optional<std::string> pathopt) +std::vector<std::string> EnumerateHrtf(std::optional<std::string> pathopt) { std::lock_guard<std::mutex> _{EnumeratedHrtfLock}; EnumeratedHrtfs.clear(); @@ -1270,7 +1270,7 @@ al::vector<std::string> EnumerateHrtf(std::optional<std::string> pathopt) AddBuiltInEntry("Built-In HRTF", IDR_DEFAULT_HRTF_MHR); } - al::vector<std::string> list; + std::vector<std::string> list; list.reserve(EnumeratedHrtfs.size()); for(auto &entry : EnumeratedHrtfs) list.emplace_back(entry.mDispName); @@ -1394,7 +1394,7 @@ HrtfStorePtr GetLoadedHrtf(const std::string &name, const uint devrate) /* Scale the delays for the new sample rate. */ float max_delay{0.0f}; - auto new_delays = al::vector<float2>(irCount); + auto new_delays = std::vector<float2>(irCount); const float rate_scale{static_cast<float>(devrate)/static_cast<float>(hrtf->mSampleRate)}; for(size_t i{0};i < irCount;++i) { diff --git a/core/hrtf.h b/core/hrtf.h index 7215711b..5e6e09a8 100644 --- a/core/hrtf.h +++ b/core/hrtf.h @@ -6,6 +6,7 @@ #include <memory> #include <optional> #include <string> +#include <vector> #include "almalloc.h" #include "alspan.h" @@ -14,7 +15,6 @@ #include "bufferline.h" #include "mixer/hrtfdefs.h" #include "intrusive_ptr.h" -#include "vector.h" struct HrtfStore { @@ -83,7 +83,7 @@ struct DirectHrtfState { }; -al::vector<std::string> EnumerateHrtf(std::optional<std::string> pathopt); +std::vector<std::string> EnumerateHrtf(std::optional<std::string> pathopt); HrtfStorePtr GetLoadedHrtf(const std::string &name, const uint devrate); #endif /* CORE_HRTF_H */ diff --git a/core/logging.cpp b/core/logging.cpp index 8e0116ea..34385cf4 100644 --- a/core/logging.cpp +++ b/core/logging.cpp @@ -6,10 +6,10 @@ #include <cstdarg> #include <cstdio> #include <string> +#include <vector> #include "alspan.h" #include "strutils.h" -#include "vector.h" #if defined(_WIN32) @@ -34,7 +34,7 @@ void al_print(LogLevel level, FILE *logfile, const char *fmt, ...) case LogLevel::Trace: prefix = al::span{"[ALSOFT] (II) "}.first<14>(); break; } - al::vector<char> dynmsg; + std::vector<char> dynmsg; std::array<char,256> stcmsg{}; char *str{stcmsg.data()}; |