return str;
}
+std::string
+PortManager::get_pretty_name_by_name(const std::string& portname) const
+{
+ PortEngine::PortHandle ph = _backend->get_port_by_name (portname);
+ if (ph) {
+ std::string value;
+ std::string type;
+ if (0 == _backend->get_port_property (ph,
+ "http://jackaudio.org/metadata/pretty-name",
+ value, type))
+ {
+ return value;
+ }
+ }
+ return "";
+}
+
bool
PortManager::port_is_mine (const string& portname) const
{
int
PortManager::get_ports (const string& port_name_pattern, DataType type, PortFlags flags, vector<string>& s)
{
+ s.clear();
+
if (!_backend) {
return 0;
}
for (i = p->begin(); i != p->end(); ++i) {
if (i->second->reestablish ()) {
error << string_compose (_("Re-establising port %1 failed"), i->second->name()) << endmsg;
- cerr << string_compose (_("Re-establising port %1 failed"), i->second->name()) << endl;
+ std::cerr << string_compose (_("Re-establising port %1 failed"), i->second->name()) << std::endl;
break;
}
}
}
}
+void
+PortManager::silence_outputs (pframes_t nframes)
+{
+ std::vector<std::string> port_names;
+ if (get_ports("", DataType::AUDIO, IsOutput, port_names)) {
+ for (std::vector<std::string>::iterator p = port_names.begin(); p != port_names.end(); ++p) {
+ if (!port_is_mine(*p)) {
+ continue;
+ }
+ PortEngine::PortHandle ph = _backend->get_port_by_name (*p);
+ if (!ph) {
+ continue;
+ }
+ void *buf = _backend->get_buffer(ph, nframes);
+ if (!buf) {
+ continue;
+ }
+ memset (buf, 0, sizeof(float) * nframes);
+ }
+ }
+
+ if (get_ports("", DataType::MIDI, IsOutput, port_names)) {
+ for (std::vector<std::string>::iterator p = port_names.begin(); p != port_names.end(); ++p) {
+ if (!port_is_mine(*p)) {
+ continue;
+ }
+ PortEngine::PortHandle ph = _backend->get_port_by_name (*p);
+ if (!ph) {
+ continue;
+ }
+ void *buf = _backend->get_buffer(ph, nframes);
+ if (!buf) {
+ continue;
+ }
+ _backend->midi_clear (buf);
+ }
+ }
+}
+
void
PortManager::check_monitoring ()
{