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 /alc | |
parent | 72f02418e505a192c0cc7b27cd7b3aa28a7a03ec (diff) |
Avoid using al::vector unnecessarily
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 12 | ||||
-rw-r--r-- | alc/backends/alsa.cpp | 16 | ||||
-rw-r--r-- | alc/backends/coreaudio.cpp | 4 | ||||
-rw-r--r-- | alc/backends/dsound.cpp | 9 | ||||
-rw-r--r-- | alc/backends/jack.cpp | 5 | ||||
-rw-r--r-- | alc/backends/oss.cpp | 14 | ||||
-rw-r--r-- | alc/backends/pulseaudio.cpp | 6 | ||||
-rw-r--r-- | alc/backends/solaris.cpp | 4 | ||||
-rw-r--r-- | alc/backends/wasapi.cpp | 18 | ||||
-rw-r--r-- | alc/backends/wave.cpp | 4 | ||||
-rw-r--r-- | alc/backends/winmm.cpp | 2 | ||||
-rw-r--r-- | alc/context.h | 6 | ||||
-rw-r--r-- | alc/device.h | 10 | ||||
-rw-r--r-- | alc/effects/chorus.cpp | 4 | ||||
-rw-r--r-- | alc/effects/echo.cpp | 6 | ||||
-rw-r--r-- | alc/panning.cpp | 3 |
16 files changed, 63 insertions, 60 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 290cc3d1..9fedee0b 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -55,6 +55,7 @@ #include <string> #include <type_traits> #include <utility> +#include <vector> #include "AL/al.h" #include "AL/alc.h" @@ -102,7 +103,6 @@ #include "opthelpers.h" #include "strutils.h" #include "threads.h" -#include "vector.h" #include "backends/base.h" #include "backends/null.h" @@ -1050,8 +1050,8 @@ using DeviceRef = al::intrusive_ptr<ALCdevice>; /************************************************ * Device lists ************************************************/ -al::vector<ALCdevice*> DeviceList; -al::vector<ALCcontext*> ContextList; +std::vector<ALCdevice*> DeviceList; +std::vector<ALCcontext*> ContextList; std::recursive_mutex ListLock; @@ -3130,7 +3130,7 @@ START_API_FUNC } if(!dev || dev->Type == DeviceType::Capture) { - auto ivals = al::vector<int>(static_cast<uint>(size)); + auto ivals = std::vector<int>(static_cast<uint>(size)); if(size_t got{GetIntegerv(dev.get(), pname, ivals)}) std::copy_n(ivals.begin(), got, values); return; @@ -3249,7 +3249,7 @@ START_API_FUNC break; default: - auto ivals = al::vector<int>(static_cast<uint>(size)); + auto ivals = std::vector<int>(static_cast<uint>(size)); if(size_t got{GetIntegerv(dev.get(), pname, ivals)}) std::copy_n(ivals.begin(), got, values); break; @@ -3676,7 +3676,7 @@ START_API_FUNC DeviceList.erase(iter); std::unique_lock<std::mutex> statelock{dev->StateLock}; - al::vector<ContextRef> orphanctxs; + std::vector<ContextRef> orphanctxs; for(ContextBase *ctx : *dev->mContexts.load()) { auto ctxiter = std::lower_bound(ContextList.begin(), ContextList.end(), ctx); diff --git a/alc/backends/alsa.cpp b/alc/backends/alsa.cpp index c1690867..ce368f5e 100644 --- a/alc/backends/alsa.cpp +++ b/alc/backends/alsa.cpp @@ -35,6 +35,7 @@ #include <string> #include <thread> #include <utility> +#include <vector> #include "albit.h" #include "alc/alconfig.h" @@ -46,7 +47,6 @@ #include "dynload.h" #include "ringbuffer.h" #include "threads.h" -#include "vector.h" #include <alsa/asoundlib.h> @@ -248,8 +248,8 @@ struct DevMap { { } }; -al::vector<DevMap> PlaybackDevices; -al::vector<DevMap> CaptureDevices; +std::vector<DevMap> PlaybackDevices; +std::vector<DevMap> CaptureDevices; const char *prefix_name(snd_pcm_stream_t stream) @@ -258,9 +258,9 @@ const char *prefix_name(snd_pcm_stream_t stream) return (stream==SND_PCM_STREAM_PLAYBACK) ? "device-prefix" : "capture-prefix"; } -al::vector<DevMap> probe_devices(snd_pcm_stream_t stream) +std::vector<DevMap> probe_devices(snd_pcm_stream_t stream) { - al::vector<DevMap> devlist; + std::vector<DevMap> devlist; snd_ctl_card_info_t *info; snd_ctl_card_info_malloc(&info); @@ -439,7 +439,7 @@ struct AlsaPlayback final : public BackendBase { std::mutex mMutex; uint mFrameStep{}; - al::vector<std::byte> mBuffer; + std::vector<std::byte> mBuffer; std::atomic<bool> mKillNow{true}; std::thread mThread; @@ -880,7 +880,7 @@ struct AlsaCapture final : public BackendBase { snd_pcm_t *mPcmHandle{nullptr}; - al::vector<std::byte> mBuffer; + std::vector<std::byte> mBuffer; bool mDoCapture{false}; RingBufferPtr mRing{nullptr}; @@ -1024,7 +1024,7 @@ void AlsaCapture::stop() /* The ring buffer implicitly captures when checking availability. * Direct access needs to explicitly capture it into temp storage. */ - auto temp = al::vector<std::byte>( + auto temp = std::vector<std::byte>( static_cast<size_t>(snd_pcm_frames_to_bytes(mPcmHandle, avail))); captureSamples(temp.data(), avail); mBuffer = std::move(temp); diff --git a/alc/backends/coreaudio.cpp b/alc/backends/coreaudio.cpp index c2a79815..521f085d 100644 --- a/alc/backends/coreaudio.cpp +++ b/alc/backends/coreaudio.cpp @@ -25,13 +25,13 @@ #include <cmath> #include <inttypes.h> #include <memory> -#include <mutex> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string> #include <string.h> #include <unistd.h> +#include <vector> #include "alnumeric.h" #include "core/converter.h" @@ -578,7 +578,7 @@ struct CoreAudioCapture final : public BackendBase { SampleConverterPtr mConverter; - al::vector<char> mCaptureData; + std::vector<char> mCaptureData; RingBufferPtr mRing{nullptr}; diff --git a/alc/backends/dsound.cpp b/alc/backends/dsound.cpp index ffcd8430..5fc8a1c7 100644 --- a/alc/backends/dsound.cpp +++ b/alc/backends/dsound.cpp @@ -46,6 +46,7 @@ #include "albit.h" #include "alnumeric.h" +#include "alspan.h" #include "comptr.h" #include "core/device.h" #include "core/helpers.h" @@ -130,10 +131,10 @@ struct DevMap { { } }; -al::vector<DevMap> PlaybackDevices; -al::vector<DevMap> CaptureDevices; +std::vector<DevMap> PlaybackDevices; +std::vector<DevMap> CaptureDevices; -bool checkName(const al::vector<DevMap> &list, const std::string &name) +bool checkName(const al::span<DevMap> list, const std::string &name) { auto match_name = [&name](const DevMap &entry) -> bool { return entry.name == name; }; @@ -145,7 +146,7 @@ BOOL CALLBACK DSoundEnumDevices(GUID *guid, const WCHAR *desc, const WCHAR*, voi if(!guid) return TRUE; - auto& devices = *static_cast<al::vector<DevMap>*>(data); + auto& devices = *static_cast<std::vector<DevMap>*>(data); const std::string basename{DEVNAME_HEAD + wstr_to_utf8(desc)}; int count{1}; diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp index b12edf9f..9e023e21 100644 --- a/alc/backends/jack.cpp +++ b/alc/backends/jack.cpp @@ -30,6 +30,7 @@ #include <mutex> #include <thread> #include <functional> +#include <vector> #include "albit.h" #include "alc/alconfig.h" @@ -168,10 +169,10 @@ struct DeviceEntry { { } }; -al::vector<DeviceEntry> PlaybackList; +std::vector<DeviceEntry> PlaybackList; -void EnumerateDevices(jack_client_t *client, al::vector<DeviceEntry> &list) +void EnumerateDevices(jack_client_t *client, std::vector<DeviceEntry> &list) { std::remove_reference_t<decltype(list)>{}.swap(list); diff --git a/alc/backends/oss.cpp b/alc/backends/oss.cpp index 1fdee701..dc18c4c3 100644 --- a/alc/backends/oss.cpp +++ b/alc/backends/oss.cpp @@ -38,6 +38,7 @@ #include <string> #include <thread> #include <utility> +#include <vector> #include "alc/alconfig.h" #include "almalloc.h" @@ -47,7 +48,6 @@ #include "core/logging.h" #include "ringbuffer.h" #include "threads.h" -#include "vector.h" #include <sys/soundcard.h> @@ -88,22 +88,22 @@ struct DevMap { std::string device_name; }; -al::vector<DevMap> PlaybackDevices; -al::vector<DevMap> CaptureDevices; +std::vector<DevMap> PlaybackDevices; +std::vector<DevMap> CaptureDevices; #ifdef ALC_OSS_COMPAT #define DSP_CAP_OUTPUT 0x00020000 #define DSP_CAP_INPUT 0x00010000 -void ALCossListPopulate(al::vector<DevMap> &devlist, int type) +void ALCossListPopulate(std::vector<DevMap> &devlist, int type) { devlist.emplace_back(DevMap{DefaultName, (type==DSP_CAP_INPUT) ? DefaultCapture : DefaultPlayback}); } #else -void ALCossListAppend(al::vector<DevMap> &list, al::span<const char> handle, al::span<const char> path) +void ALCossListAppend(std::vector<DevMap> &list, al::span<const char> handle, al::span<const char> path) { #ifdef ALC_OSS_DEVNODE_TRUC for(size_t i{0};i < path.size();++i) @@ -148,7 +148,7 @@ void ALCossListAppend(al::vector<DevMap> &list, al::span<const char> handle, al: TRACE("Got device \"%s\", \"%s\"\n", entry.name.c_str(), entry.device_name.c_str()); } -void ALCossListPopulate(al::vector<DevMap> &devlist, int type_flag) +void ALCossListPopulate(std::vector<DevMap> &devlist, int type_flag) { int fd{open("/dev/mixer", O_RDONLY)}; if(fd < 0) @@ -234,7 +234,7 @@ struct OSSPlayback final : public BackendBase { int mFd{-1}; - al::vector<std::byte> mMixData; + std::vector<std::byte> mMixData; std::atomic<bool> mKillNow{true}; std::thread mThread; diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index e5696817..d2883f5c 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -37,6 +37,7 @@ #include <string> #include <sys/types.h> #include <utility> +#include <vector> #include "albit.h" #include "alc/alconfig.h" @@ -49,7 +50,6 @@ #include "dynload.h" #include "opthelpers.h" #include "strutils.h" -#include "vector.h" #include <pulse/pulseaudio.h> @@ -282,8 +282,8 @@ bool checkName(const al::span<const DevMap> list, const std::string &name) return std::find_if(list.cbegin(), list.cend(), match_name) != list.cend(); } -al::vector<DevMap> PlaybackDevices; -al::vector<DevMap> CaptureDevices; +std::vector<DevMap> PlaybackDevices; +std::vector<DevMap> CaptureDevices; /* Global flags and properties */ diff --git a/alc/backends/solaris.cpp b/alc/backends/solaris.cpp index 4eeeafac..ae87e7eb 100644 --- a/alc/backends/solaris.cpp +++ b/alc/backends/solaris.cpp @@ -35,6 +35,7 @@ #include <poll.h> #include <math.h> #include <string.h> +#include <vector> #include <thread> #include <functional> @@ -44,7 +45,6 @@ #include "core/helpers.h" #include "core/logging.h" #include "threads.h" -#include "vector.h" #include <sys/audioio.h> @@ -70,7 +70,7 @@ struct SolarisBackend final : public BackendBase { int mFd{-1}; uint mFrameStep{}; - al::vector<std::byte> mBuffer; + std::vector<std::byte> mBuffer; std::atomic<bool> mKillNow{true}; std::thread mThread; diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp index 97f0a291..d4ad38e2 100644 --- a/alc/backends/wasapi.cpp +++ b/alc/backends/wasapi.cpp @@ -59,6 +59,7 @@ #include "albit.h" #include "alc/alconfig.h" #include "alnumeric.h" +#include "alspan.h" #include "comptr.h" #include "core/converter.h" #include "core/device.h" @@ -180,15 +181,14 @@ struct DevMap { { } }; -bool checkName(const al::vector<DevMap> &list, const std::string &name) +bool checkName(const al::span<DevMap> list, const std::string &name) { - auto match_name = [&name](const DevMap &entry) -> bool - { return entry.name == name; }; + auto match_name = [&name](const DevMap &entry) -> bool { return entry.name == name; }; return std::find_if(list.cbegin(), list.cend(), match_name) != list.cend(); } -al::vector<DevMap> PlaybackDevices; -al::vector<DevMap> CaptureDevices; +std::vector<DevMap> PlaybackDevices; +std::vector<DevMap> CaptureDevices; using NameGUIDPair = std::pair<std::string,std::string>; @@ -262,7 +262,7 @@ EndpointFormFactor get_device_formfactor(IMMDevice *device) } -void add_device(IMMDevice *device, const WCHAR *devid, al::vector<DevMap> &list) +void add_device(IMMDevice *device, const WCHAR *devid, std::vector<DevMap> &list) { for(auto &entry : list) { @@ -301,9 +301,9 @@ WCHAR *get_device_id(IMMDevice *device) return devid; } -void probe_devices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, al::vector<DevMap> &list) +void probe_devices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, std::vector<DevMap> &list) { - al::vector<DevMap>{}.swap(list); + std::vector<DevMap>{}.swap(list); ComPtr<IMMDeviceCollection> coll; HRESULT hr{devenum->EnumAudioEndpoints(flowdir, DEVICE_STATE_ACTIVE, al::out_ptr(coll))}; @@ -1355,7 +1355,7 @@ FORCE_ALIGN int WasapiCapture::recordProc() althrd_setname(RECORD_THREAD_NAME); - al::vector<float> samples; + std::vector<float> samples; while(!mKillNow.load(std::memory_order_relaxed)) { UINT32 avail; diff --git a/alc/backends/wave.cpp b/alc/backends/wave.cpp index f8302f1e..1ee2fe51 100644 --- a/alc/backends/wave.cpp +++ b/alc/backends/wave.cpp @@ -32,6 +32,7 @@ #include <exception> #include <functional> #include <thread> +#include <vector> #include "albit.h" #include "alc/alconfig.h" @@ -43,7 +44,6 @@ #include "opthelpers.h" #include "strutils.h" #include "threads.h" -#include "vector.h" namespace { @@ -104,7 +104,7 @@ struct WaveBackend final : public BackendBase { FILE *mFile{nullptr}; long mDataStart{-1}; - al::vector<std::byte> mBuffer; + std::vector<std::byte> mBuffer; std::atomic<bool> mKillNow{true}; std::thread mThread; diff --git a/alc/backends/winmm.cpp b/alc/backends/winmm.cpp index edb875a0..0345fe10 100644 --- a/alc/backends/winmm.cpp +++ b/alc/backends/winmm.cpp @@ -58,7 +58,7 @@ namespace { std::vector<std::string> PlaybackDevices; std::vector<std::string> CaptureDevices; -bool checkName(const al::vector<std::string> &list, const std::string &name) +bool checkName(const std::vector<std::string> &list, const std::string &name) { return std::find(list.cbegin(), list.cend(), name) != list.cend(); } void ProbePlaybackDevices(void) diff --git a/alc/context.h b/alc/context.h index acbb3788..779be113 100644 --- a/alc/context.h +++ b/alc/context.h @@ -9,6 +9,7 @@ #include <string> #include <string_view> #include <utility> +#include <vector> #include "AL/al.h" #include "AL/alc.h" @@ -21,7 +22,6 @@ #include "core/context.h" #include "inprogext.h" #include "intrusive_ptr.h" -#include "vector.h" #ifdef ALSOFT_EAX #include "al/eax/call.h" @@ -132,11 +132,11 @@ struct ALCcontext : public al::intrusive_ref<ALCcontext>, ContextBase { ALlistener mListener{}; - al::vector<SourceSubList> mSourceList; + std::vector<SourceSubList> mSourceList; ALuint mNumSources{0}; std::mutex mSourceLock; - al::vector<EffectSlotSubList> mEffectSlotList; + std::vector<EffectSlotSubList> mEffectSlotList; ALuint mNumEffectSlots{0u}; std::mutex mEffectSlotLock; diff --git a/alc/device.h b/alc/device.h index d5e82ce3..1274e287 100644 --- a/alc/device.h +++ b/alc/device.h @@ -8,6 +8,7 @@ #include <stdint.h> #include <string> #include <utility> +#include <vector> #include "AL/alc.h" #include "AL/alext.h" @@ -18,7 +19,6 @@ #include "core/device.h" #include "inprogext.h" #include "intrusive_ptr.h" -#include "vector.h" #ifdef ALSOFT_EAX #include "al/eax/x_ram.h" @@ -95,7 +95,7 @@ struct ALCdevice : public al::intrusive_ref<ALCdevice>, DeviceBase { uint AuxiliaryEffectSlotMax{}; std::string mHrtfName; - al::vector<std::string> mHrtfList; + std::vector<std::string> mHrtfList; ALCenum mHrtfStatus{ALC_FALSE}; enum class OutputMode1 : ALCenum { @@ -118,15 +118,15 @@ struct ALCdevice : public al::intrusive_ref<ALCdevice>, DeviceBase { // Map of Buffers for this device std::mutex BufferLock; - al::vector<BufferSubList> BufferList; + std::vector<BufferSubList> BufferList; // Map of Effects for this device std::mutex EffectLock; - al::vector<EffectSubList> EffectList; + std::vector<EffectSubList> EffectList; // Map of Filters for this device std::mutex FilterLock; - al::vector<FilterSubList> FilterList; + std::vector<FilterSubList> FilterList; #ifdef ALSOFT_EAX ALuint eax_x_ram_free_size{eax_x_ram_max_size}; diff --git a/alc/effects/chorus.cpp b/alc/effects/chorus.cpp index 10ccf9f6..7c281aa5 100644 --- a/alc/effects/chorus.cpp +++ b/alc/effects/chorus.cpp @@ -25,6 +25,7 @@ #include <climits> #include <cstdlib> #include <iterator> +#include <vector> #include "alc/effects/base.h" #include "almalloc.h" @@ -41,7 +42,6 @@ #include "core/resampler_limits.h" #include "intrusive_ptr.h" #include "opthelpers.h" -#include "vector.h" namespace { @@ -49,7 +49,7 @@ namespace { using uint = unsigned int; struct ChorusState final : public EffectState { - al::vector<float,16> mDelayBuffer; + std::vector<float> mDelayBuffer; uint mOffset{0}; uint mLfoOffset{0}; diff --git a/alc/effects/echo.cpp b/alc/effects/echo.cpp index a69529dc..7824c246 100644 --- a/alc/effects/echo.cpp +++ b/alc/effects/echo.cpp @@ -25,6 +25,7 @@ #include <cstdlib> #include <iterator> #include <tuple> +#include <vector> #include "alc/effects/base.h" #include "almalloc.h" @@ -39,7 +40,6 @@ #include "core/mixer.h" #include "intrusive_ptr.h" #include "opthelpers.h" -#include "vector.h" namespace { @@ -49,7 +49,7 @@ using uint = unsigned int; constexpr float LowpassFreqRef{5000.0f}; struct EchoState final : public EffectState { - al::vector<float,16> mSampleBuffer; + std::vector<float> mSampleBuffer; // The echo is two tap. The delay is the number of samples from before the // current offset @@ -87,7 +87,7 @@ void EchoState::deviceUpdate(const DeviceBase *Device, const BufferStorage*) const uint maxlen{NextPowerOf2(float2uint(EchoMaxDelay*frequency + 0.5f) + float2uint(EchoMaxLRDelay*frequency + 0.5f))}; if(maxlen != mSampleBuffer.size()) - al::vector<float,16>(maxlen).swap(mSampleBuffer); + decltype(mSampleBuffer)(maxlen).swap(mSampleBuffer); std::fill(mSampleBuffer.begin(), mSampleBuffer.end(), 0.0f); for(auto &e : mGains) diff --git a/alc/panning.cpp b/alc/panning.cpp index 60ce7ca4..6fc955ee 100644 --- a/alc/panning.cpp +++ b/alc/panning.cpp @@ -34,6 +34,7 @@ #include <numeric> #include <optional> #include <string> +#include <vector> #include "AL/al.h" #include "AL/alc.h" @@ -628,7 +629,7 @@ void InitPanning(ALCdevice *device, const bool hqdec=false, const bool stablize= const size_t ambicount{decoder.mIs3D ? AmbiChannelsFromOrder(decoder.mOrder) : Ambi2DChannelsFromOrder(decoder.mOrder)}; const bool dual_band{hqdec && !decoder.mCoeffsLF.empty()}; - al::vector<ChannelDec> chancoeffs, chancoeffslf; + std::vector<ChannelDec> chancoeffs, chancoeffslf; for(size_t i{0u};i < decoder.mChannels.size();++i) { const uint idx{device->channelIdxByName(decoder.mChannels[i])}; |