From c5b986f420ec10c7dfa9634217b274bca05316ec Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 16 Jan 2021 17:44:05 +0100 Subject: [PATCH] ALSA: set pretty port names for audio I/O --- libs/backends/alsa/alsa_audiobackend.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libs/backends/alsa/alsa_audiobackend.cc b/libs/backends/alsa/alsa_audiobackend.cc index 43e28d1b2a..d2ca6f28b9 100644 --- a/libs/backends/alsa/alsa_audiobackend.cc +++ b/libs/backends/alsa/alsa_audiobackend.cc @@ -1244,7 +1244,7 @@ AlsaAudioBackend::register_system_audio_ports() if (!p) return -1; set_latency_range (p, false, lr); BackendPortPtr ap = boost::dynamic_pointer_cast(p); - //ap->set_hw_port_name ("") + ap->set_hw_port_name (string_compose (_("Main In %1"), i)); _system_inputs.push_back (ap); } @@ -1256,7 +1256,11 @@ AlsaAudioBackend::register_system_audio_ports() if (!p) return -1; set_latency_range (p, true, lr); BackendPortPtr ap = boost::dynamic_pointer_cast(p); - //ap->set_hw_port_name ("") + if (a_out == 2) { + ap->set_hw_port_name (i == 1 ? _("Out Left") : _("Out Right")); + } else { + ap->set_hw_port_name (string_compose (_("Main Out %1"), i)); + } _system_outputs.push_back (ap); } return 0; @@ -2081,7 +2085,9 @@ AlsaAudioBackend::add_slave (const char* device, } while (1); PortPtr p = add_port(std::string(tmp), DataType::AUDIO, static_cast(IsOutput | IsPhysical | IsTerminal)); if (!p) goto errout; - s->inputs.push_back (boost::dynamic_pointer_cast(p)); + BackendPortPtr ap = boost::dynamic_pointer_cast(p); + ap->set_hw_port_name (string_compose (_("Aux In %1"), n)); + s->inputs.push_back (ap); } for (uint32_t i = 0, n = 1; i < s->nplay (); ++i) { @@ -2096,7 +2102,9 @@ AlsaAudioBackend::add_slave (const char* device, } while (1); PortPtr p = add_port(std::string(tmp), DataType::AUDIO, static_cast(IsInput | IsPhysical | IsTerminal)); if (!p) goto errout; - s->outputs.push_back (boost::dynamic_pointer_cast (p)); + BackendPortPtr ap = boost::dynamic_pointer_cast(p); + ap->set_hw_port_name (string_compose (_("Aux Out %1"), n)); + s->outputs.push_back (ap); } if (!s->start ()) {