aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/solaris.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-12-11 18:59:54 -0800
committerChris Robinson <[email protected]>2023-12-11 18:59:54 -0800
commit60aa22f20d63a3da9f06b9398a2a8656ebbd0342 (patch)
treec6067ff97fd013906309d2fafd5e41a5447fee29 /alc/backends/solaris.cpp
parente79e5a978df22a5e5967169cf62cf46f3456d833 (diff)
Mostly finish cleanup for backends
Except CoreAudio and Solaris backends
Diffstat (limited to 'alc/backends/solaris.cpp')
-rw-r--r--alc/backends/solaris.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/alc/backends/solaris.cpp b/alc/backends/solaris.cpp
index 38f9db19..2c4a97fd 100644
--- a/alc/backends/solaris.cpp
+++ b/alc/backends/solaris.cpp
@@ -51,6 +51,7 @@
namespace {
+/* NOLINTNEXTLINE(*-avoid-c-arrays) */
constexpr char solaris_device[] = "Solaris Default";
std::string solaris_driver{"/dev/audio"};
@@ -91,7 +92,7 @@ int SolarisBackend::mixerProc()
althrd_setname(MIXER_THREAD_NAME);
const size_t frame_step{mDevice->channelsFromFmt()};
- const uint frame_size{mDevice->frameSizeFromFmt()};
+ const size_t frame_size{mDevice->frameSizeFromFmt()};
while(!mKillNow.load(std::memory_order_acquire)
&& mDevice->Connected.load(std::memory_order_acquire))
@@ -115,12 +116,12 @@ int SolarisBackend::mixerProc()
continue;
}
- std::byte *write_ptr{mBuffer.data()};
- size_t to_write{mBuffer.size()};
- mDevice->renderSamples(write_ptr, static_cast<uint>(to_write/frame_size), frame_step);
- while(to_write > 0 && !mKillNow.load(std::memory_order_acquire))
+ al::span<std::byte> buffer{mBuffer};
+ mDevice->renderSamples(buffer.data(), static_cast<uint>(buffer.size()/frame_size),
+ frame_step);
+ while(!buffer.empty() && !mKillNow.load(std::memory_order_acquire))
{
- ssize_t wrote{write(mFd, write_ptr, to_write)};
+ ssize_t wrote{write(mFd, buffer.data(), buffer.size())};
if(wrote < 0)
{
if(errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)
@@ -130,8 +131,7 @@ int SolarisBackend::mixerProc()
break;
}
- to_write -= static_cast<size_t>(wrote);
- write_ptr += wrote;
+ buffer = buffer.subspan(static_cast<size_t>(wrote));
}
}