aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/solaris.cpp
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-05 13:52:12 +0100
committerSven Göthel <[email protected]>2024-01-05 13:52:12 +0100
commitec98cdacc85ff0202852472c7756586437912f22 (patch)
tree42414746a27ab35cb8cdbc95af521d74821e57f4 /alc/backends/solaris.cpp
parentfd5269bec9a5fe4815974b1786a037e6a247bfd2 (diff)
parentb82cd2e60edb8fbe5fdd3567105ae76a016a554c (diff)
Merge remote-tracking branch 'upstream/master'HEADmaster
Diffstat (limited to 'alc/backends/solaris.cpp')
-rw-r--r--alc/backends/solaris.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/alc/backends/solaris.cpp b/alc/backends/solaris.cpp
index 38f9db19..c7387284 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"};
@@ -74,8 +75,6 @@ struct SolarisBackend final : public BackendBase {
std::atomic<bool> mKillNow{true};
std::thread mThread;
-
- DEF_NEWDEL(SolarisBackend)
};
SolarisBackend::~SolarisBackend()
@@ -91,7 +90,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 +114,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 +129,7 @@ int SolarisBackend::mixerProc()
break;
}
- to_write -= static_cast<size_t>(wrote);
- write_ptr += wrote;
+ buffer = buffer.subspan(static_cast<size_t>(wrote));
}
}
@@ -267,7 +265,7 @@ BackendFactory &SolarisBackendFactory::getFactory()
bool SolarisBackendFactory::init()
{
- if(auto devopt = ConfigValueStr(nullptr, "solaris", "device"))
+ if(auto devopt = ConfigValueStr({}, "solaris", "device"))
solaris_driver = std::move(*devopt);
return true;
}