diff options
author | Robin Gareus <robin@gareus.org> | 2015-03-08 18:39:19 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-03-08 19:02:31 +0100 |
commit | 8008d4262fbef8eb53ced3087f521f4712952ea3 (patch) | |
tree | fe3cbcc19e2a1ce5f4c3b00a3e2d0f35c6f6de63 /libs | |
parent | 1ad42b249bd3e3e4ea76425da9c7c6aeb06b126e (diff) |
nicely named session bundles
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/session.cc | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index a54afa6293..b18b756e60 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -442,6 +442,19 @@ Session::immediately_post_engine () return -1; } + /* TODO somehow keep bundles in sync with engine. + * + * eg. midi ports may come and go dynamically (currently both with jack as well + * as with CoreMidi. But also changing the engine or device will do the trick.. + * + * We need to keep track of bundles added during setup_bundles(), + * and add/remove the changes. + * + * also doing so in a background thread would be nice (same_thread may be RT thread). + * but in principle it's going to be sth like: + * _engine.PortRegisteredOrUnregistered.connect_same_thread (*this, boost::bind (&Session::do_the_bundles, this)); + */ + return 0; } @@ -704,7 +717,12 @@ Session::setup_bundles () for (uint32_t np = 0; np < outputs[DataType::AUDIO].size(); ++np) { char buf[32]; - snprintf (buf, sizeof (buf), _("out %" PRIu32), np+1); + std::string pn = _engine.get_pretty_name_by_name (outputs[DataType::AUDIO][np]); + if (!pn.empty()) { + snprintf (buf, sizeof (buf), _("out %s"), pn.substr(0,12).c_str()); + } else { + snprintf (buf, sizeof (buf), _("out %" PRIu32), np+1); + } boost::shared_ptr<Bundle> c (new Bundle (buf, true)); c->add_channel (_("mono"), DataType::AUDIO); @@ -733,7 +751,12 @@ Session::setup_bundles () for (uint32_t np = 0; np < inputs[DataType::AUDIO].size(); ++np) { char buf[32]; - snprintf (buf, sizeof (buf), _("in %" PRIu32), np+1); + std::string pn = _engine.get_pretty_name_by_name (inputs[DataType::AUDIO][np]); + if (!pn.empty()) { + snprintf (buf, sizeof (buf), _("in %s"), pn.substr(0,12).c_str()); + } else { + snprintf (buf, sizeof (buf), _("in %" PRIu32), np+1); + } boost::shared_ptr<Bundle> c (new Bundle (buf, false)); c->add_channel (_("mono"), DataType::AUDIO); @@ -763,8 +786,12 @@ Session::setup_bundles () for (uint32_t np = 0; np < inputs[DataType::MIDI].size(); ++np) { string n = inputs[DataType::MIDI][np]; - boost::erase_first (n, X_("alsa_pcm:")); - + std::string pn = _engine.get_pretty_name_by_name (n); + if (!pn.empty()) { + n = pn; + } else { + boost::erase_first (n, X_("alsa_pcm:")); + } boost::shared_ptr<Bundle> c (new Bundle (n, false)); c->add_channel ("", DataType::MIDI); c->set_port (0, inputs[DataType::MIDI][np]); @@ -775,8 +802,12 @@ Session::setup_bundles () for (uint32_t np = 0; np < outputs[DataType::MIDI].size(); ++np) { string n = outputs[DataType::MIDI][np]; - boost::erase_first (n, X_("alsa_pcm:")); - + std::string pn = _engine.get_pretty_name_by_name (n); + if (!pn.empty()) { + n = pn; + } else { + boost::erase_first (n, X_("alsa_pcm:")); + } boost::shared_ptr<Bundle> c (new Bundle (n, true)); c->add_channel ("", DataType::MIDI); c->set_port (0, outputs[DataType::MIDI][np]); |