aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/solaris.cpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-11-28 12:51:46 +0100
committerSven Gothel <[email protected]>2023-11-28 12:51:46 +0100
commit1aaf4f070011490bcece50394b9b32dfa593fd9e (patch)
tree17d68284e401a35eea3d3a574d986d446a60763a /alc/backends/solaris.cpp
parent6e7cee4fa9a8af03f28ca26cd89f8357390dfc90 (diff)
parent571b546f35eead77ce109f8d4dd6c3de3199d573 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'alc/backends/solaris.cpp')
-rw-r--r--alc/backends/solaris.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/alc/backends/solaris.cpp b/alc/backends/solaris.cpp
index 791609ce..38f9db19 100644
--- a/alc/backends/solaris.cpp
+++ b/alc/backends/solaris.cpp
@@ -35,17 +35,16 @@
#include <poll.h>
#include <math.h>
#include <string.h>
+#include <vector>
#include <thread>
#include <functional>
-#include "albyte.h"
#include "alc/alconfig.h"
+#include "althrd_setname.h"
#include "core/device.h"
#include "core/helpers.h"
#include "core/logging.h"
-#include "threads.h"
-#include "vector.h"
#include <sys/audioio.h>
@@ -63,7 +62,7 @@ struct SolarisBackend final : public BackendBase {
int mixerProc();
- void open(const char *name) override;
+ void open(std::string_view name) override;
bool reset() override;
void start() override;
void stop() override;
@@ -71,7 +70,7 @@ struct SolarisBackend final : public BackendBase {
int mFd{-1};
uint mFrameStep{};
- al::vector<al::byte> mBuffer;
+ std::vector<std::byte> mBuffer;
std::atomic<bool> mKillNow{true};
std::thread mThread;
@@ -116,7 +115,7 @@ int SolarisBackend::mixerProc()
continue;
}
- al::byte *write_ptr{mBuffer.data()};
+ 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))
@@ -140,13 +139,13 @@ int SolarisBackend::mixerProc()
}
-void SolarisBackend::open(const char *name)
+void SolarisBackend::open(std::string_view name)
{
- if(!name)
+ if(name.empty())
name = solaris_device;
- else if(strcmp(name, solaris_device) != 0)
- throw al::backend_exception{al::backend_error::NoDevice, "Device name \"%s\" not found",
- name};
+ else if(name != solaris_device)
+ throw al::backend_exception{al::backend_error::NoDevice, "Device name \"%.*s\" not found",
+ static_cast<int>(name.length()), name.data()};
int fd{::open(solaris_driver.c_str(), O_WRONLY)};
if(fd == -1)
@@ -231,7 +230,7 @@ bool SolarisBackend::reset()
setDefaultChannelOrder();
mBuffer.resize(mDevice->UpdateSize * size_t{frame_size});
- std::fill(mBuffer.begin(), mBuffer.end(), al::byte{});
+ std::fill(mBuffer.begin(), mBuffer.end(), std::byte{});
return true;
}