diff options
author | Chris Robinson <[email protected]> | 2023-12-10 22:15:17 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-12-10 22:15:17 -0800 |
commit | bb3387b0fc5d3071a30c6d003b415dc6e77f3d62 (patch) | |
tree | 1645291391b412040ce55ae8dc34232cde5d22e0 /alc/backends | |
parent | cf37d92442ccf3c7f4b979bd97282dcbe28ca64a (diff) |
Much more clang-tidy cleanup
Diffstat (limited to 'alc/backends')
-rw-r--r-- | alc/backends/null.cpp | 1 | ||||
-rw-r--r-- | alc/backends/pipewire.cpp | 12 | ||||
-rw-r--r-- | alc/backends/portaudio.cpp | 3 | ||||
-rw-r--r-- | alc/backends/sdl2.cpp | 3 |
4 files changed, 10 insertions, 9 deletions
diff --git a/alc/backends/null.cpp b/alc/backends/null.cpp index 3c68e4ce..c149820c 100644 --- a/alc/backends/null.cpp +++ b/alc/backends/null.cpp @@ -42,6 +42,7 @@ using std::chrono::seconds; using std::chrono::milliseconds; using std::chrono::nanoseconds; +/* NOLINTNEXTLINE(*-avoid-c-arrays) */ constexpr char nullDevice[] = "No Output"; diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp index d934071e..2c726cbe 100644 --- a/alc/backends/pipewire.cpp +++ b/alc/backends/pipewire.cpp @@ -1420,8 +1420,7 @@ class PipeWirePlayback final : public BackendBase { PwStreamPtr mStream; spa_hook mStreamListener{}; spa_io_rate_match *mRateMatch{}; - std::unique_ptr<float*[]> mChannelPtrs; - uint mNumChannels{}; + std::vector<float*> mChannelPtrs; static constexpr pw_stream_events CreateEvents() { @@ -1468,7 +1467,7 @@ void PipeWirePlayback::outputCallback() noexcept if(!pw_buf) UNLIKELY return; const al::span<spa_data> datas{pw_buf->buffer->datas, - minu(mNumChannels, pw_buf->buffer->n_datas)}; + minz(mChannelPtrs.size(), pw_buf->buffer->n_datas)}; #if PW_CHECK_VERSION(0,3,49) /* In 0.3.49, pw_buffer::requested specifies the number of samples needed * by the resampler/graph for this audio update. @@ -1488,7 +1487,7 @@ void PipeWirePlayback::outputCallback() noexcept * buffer length in any one channel is smaller than we wanted (shouldn't * be, but just in case). */ - float **chanptr_end{mChannelPtrs.get()}; + auto chanptr_end = mChannelPtrs.begin(); for(const auto &data : datas) { length = minu(length, data.maxsize/sizeof(float)); @@ -1500,7 +1499,7 @@ void PipeWirePlayback::outputCallback() noexcept data.chunk->size = length * sizeof(float); } - mDevice->renderSamples({mChannelPtrs.get(), chanptr_end}, length); + mDevice->renderSamples(mChannelPtrs, length); pw_buf->size = length; pw_stream_queue_buffer(mStream.get(), pw_buf); @@ -1711,8 +1710,7 @@ bool PipeWirePlayback::reset() */ plock.unlock(); - mNumChannels = mDevice->channelsFromFmt(); - mChannelPtrs = std::make_unique<float*[]>(mNumChannels); + mChannelPtrs.resize(mDevice->channelsFromFmt()); setDefaultWFXChannelOrder(); diff --git a/alc/backends/portaudio.cpp b/alc/backends/portaudio.cpp index 2e2e33cc..554efe9a 100644 --- a/alc/backends/portaudio.cpp +++ b/alc/backends/portaudio.cpp @@ -39,7 +39,8 @@ namespace { -constexpr char pa_device[] = "PortAudio Default"; +/* NOLINTNEXTLINE(*-avoid-c-arrays) */ +constexpr char pa_device[]{"PortAudio Default"}; #ifdef HAVE_DYNLOAD diff --git a/alc/backends/sdl2.cpp b/alc/backends/sdl2.cpp index f5ed4316..d7f66d93 100644 --- a/alc/backends/sdl2.cpp +++ b/alc/backends/sdl2.cpp @@ -46,7 +46,8 @@ namespace { #define DEVNAME_PREFIX "" #endif -constexpr char defaultDeviceName[] = DEVNAME_PREFIX "Default Device"; +/* NOLINTNEXTLINE(*-avoid-c-arrays) */ +constexpr char defaultDeviceName[]{DEVNAME_PREFIX "Default Device"}; struct Sdl2Backend final : public BackendBase { Sdl2Backend(DeviceBase *device) noexcept : BackendBase{device} { } |