summaryrefslogtreecommitdiffstats
path: root/src/AlsaDriver.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-11-28 12:02:55 +0100
committerDavid Robillard <d@drobilla.net>2020-11-28 12:45:57 +0100
commit0ae4276ac187a9a361950f26bd67eb2d54636aff (patch)
treecc46c2ff5df75d426de5e80b891042ae1ebb7bf3 /src/AlsaDriver.cpp
parent4ac8e622bb4ef5841435fc0815efb6bb756f76da (diff)
downloadpatchage-0ae4276ac187a9a361950f26bd67eb2d54636aff.tar.gz
patchage-0ae4276ac187a9a361950f26bd67eb2d54636aff.tar.bz2
patchage-0ae4276ac187a9a361950f26bd67eb2d54636aff.zip
Simplify driver connection interface
Diffstat (limited to 'src/AlsaDriver.cpp')
-rw-r--r--src/AlsaDriver.cpp45
1 files changed, 11 insertions, 34 deletions
diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp
index b8dcdc6..a132d54 100644
--- a/src/AlsaDriver.cpp
+++ b/src/AlsaDriver.cpp
@@ -24,6 +24,7 @@
PATCHAGE_DISABLE_FMT_WARNINGS
#include <fmt/core.h>
+#include <fmt/ostream.h>
PATCHAGE_RESTORE_WARNINGS
#include <cassert>
@@ -406,12 +407,7 @@ AlsaDriver::ignore(const snd_seq_addr_t& addr, bool add)
* \return Whether connection succeeded.
*/
bool
-AlsaDriver::connect(const PortID tail_id,
- const std::string& tail_client_name,
- const std::string& tail_port_name,
- const PortID head_id,
- const std::string& head_client_name,
- const std::string& head_port_name)
+AlsaDriver::connect(const PortID tail_id, const PortID head_id)
{
if (tail_id.type() != PortID::Type::alsa ||
head_id.type() != PortID::Type::alsa) {
@@ -455,17 +451,10 @@ AlsaDriver::connect(const PortID tail_id,
}
if (result) {
- _log.info(fmt::format("[ALSA] Connected {}:{} => {}:{}",
- tail_client_name,
- tail_port_name,
- head_client_name,
- head_port_name));
+ _log.info(fmt::format("[ALSA] Connected {} => {}", tail_id, head_id));
} else {
- _log.error(fmt::format("[ALSA] Failed to connect {}:{} => {}:{}",
- tail_client_name,
- tail_port_name,
- head_client_name,
- head_port_name));
+ _log.error(
+ fmt::format("[ALSA] Failed to connect {} => {}", tail_id, head_id));
}
return (!result);
@@ -476,12 +465,7 @@ AlsaDriver::connect(const PortID tail_id,
* \return Whether disconnection succeeded.
*/
bool
-AlsaDriver::disconnect(const PortID tail_id,
- const std::string& tail_client_name,
- const std::string& tail_port_name,
- const PortID head_id,
- const std::string& head_client_name,
- const std::string& head_port_name)
+AlsaDriver::disconnect(const PortID tail_id, const PortID head_id)
{
if (tail_id.type() != PortID::Type::alsa ||
head_id.type() != PortID::Type::alsa) {
@@ -512,21 +496,14 @@ AlsaDriver::disconnect(const PortID tail_id,
int ret = snd_seq_unsubscribe_port(_seq, subs);
if (ret < 0) {
- _log.error(
- fmt::format("[ALSA] Failed to disconnect {}:{} => {}:{} ({})",
- tail_client_name,
- tail_port_name,
- head_client_name,
- head_port_name,
- snd_strerror(ret)));
+ _log.error(fmt::format("[ALSA] Failed to disconnect {} => {} ({})",
+ tail_id,
+ head_id,
+ snd_strerror(ret)));
return false;
}
- _log.info(fmt::format("[ALSA] Disconnected {}:{} => {}:{}",
- tail_client_name,
- tail_port_name,
- head_client_name,
- head_port_name));
+ _log.info(fmt::format("[ALSA] Disconnected {} => {}", tail_id, head_id));
return true;
}