aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/jack.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-08-06 18:49:42 -0700
committerChris Robinson <[email protected]>2023-08-06 18:49:42 -0700
commit9296af5566afea4ba4cb78b374ef3ee0bf9bc04b (patch)
treeac71d8896956166aed320ed38ffb32847bc2cba7 /alc/backends/jack.cpp
parent05d80f9b3283d7686a27e5d3ed0bac6086669368 (diff)
Use a string_view for the backend open method
Diffstat (limited to 'alc/backends/jack.cpp')
-rw-r--r--alc/backends/jack.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp
index 66fc0877..a0a5c440 100644
--- a/alc/backends/jack.cpp
+++ b/alc/backends/jack.cpp
@@ -298,7 +298,7 @@ struct JackPlayback 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;
@@ -460,7 +460,7 @@ int JackPlayback::mixerProc()
}
-void JackPlayback::open(const char *name)
+void JackPlayback::open(std::string_view name)
{
if(!mClient)
{
@@ -484,9 +484,9 @@ void JackPlayback::open(const char *name)
if(PlaybackList.empty())
EnumerateDevices(mClient, PlaybackList);
- if(!name && !PlaybackList.empty())
+ if(name.empty() && !PlaybackList.empty())
{
- name = PlaybackList[0].mName.c_str();
+ name = PlaybackList[0].mName;
mPortPattern = PlaybackList[0].mPattern;
}
else
@@ -496,14 +496,10 @@ void JackPlayback::open(const char *name)
auto iter = std::find_if(PlaybackList.cbegin(), PlaybackList.cend(), check_name);
if(iter == PlaybackList.cend())
throw al::backend_exception{al::backend_error::NoDevice,
- "Device name \"%s\" not found", name?name:""};
+ "Device name \"%.*s\" not found", static_cast<int>(name.length()), name.data()};
mPortPattern = iter->mPattern;
}
- mRTMixing = GetConfigValueBool(name, "jack", "rt-mix", true);
- jack_set_process_callback(mClient,
- mRTMixing ? &JackPlayback::processRtC : &JackPlayback::processC, this);
-
mDevice->DeviceName = name;
}
@@ -514,6 +510,10 @@ bool JackPlayback::reset()
std::for_each(mPort.begin(), mPort.end(), unregister_port);
mPort.fill(nullptr);
+ mRTMixing = GetConfigValueBool(mDevice->DeviceName.c_str(), "jack", "rt-mix", true);
+ jack_set_process_callback(mClient,
+ mRTMixing ? &JackPlayback::processRtC : &JackPlayback::processC, this);
+
/* Ignore the requested buffer metrics and just keep one JACK-sized buffer
* ready for when requested.
*/