diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 32962fef0d..a3c0468930 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -371,7 +371,6 @@ class IO : public SessionObject, public AutomatableControls, public Latent int32_t find_input_port_hole (const char* base); int32_t find_output_port_hole (const char* base); - void create_bundles_for_inputs_and_outputs (); void setup_bundles_for_inputs_and_outputs (); std::string bundle_channel_name (uint32_t, uint32_t) const; }; diff --git a/libs/ardour/audio_track_importer.cc b/libs/ardour/audio_track_importer.cc index 0f17323dc6..32b90e00dc 100644 --- a/libs/ardour/audio_track_importer.cc +++ b/libs/ardour/audio_track_importer.cc @@ -28,6 +28,7 @@ #include #include +#include #include "i18n.h" @@ -154,10 +155,6 @@ AudioTrackImporter::parse_io () return false; } - // TODO - io->remove_property ("inputs"); - io->remove_property ("outputs"); - XMLPropertyList const & props = io->properties(); for (XMLPropertyList::const_iterator it = props.begin(); it != props.end(); ++it) { @@ -172,9 +169,18 @@ AudioTrackImporter::parse_io () (*it)->set_value (id.to_s()); id_ok = true; } else if (!prop.compare("inputs")) { - // TODO Let the IO class do it's thing for now... + // TODO Handle this properly! + /* Input and output ports are counted and added empty, so that no in/output connecting function fails. */ + uint32_t num_inputs = std::count ((*it)->value().begin(), (*it)->value().end(), '{'); + std::string value; + for (uint32_t i = 0; i < num_inputs; i++) { value += "{}"; } + (*it)->set_value (value); } else if (!prop.compare("outputs")) { - // TODO Let the IO class do it's thing for now... + // TODO See comments above + uint32_t num_outputs = std::count ((*it)->value().begin(), (*it)->value().end(), '{'); + std::string value; + for (uint32_t i = 0; i < num_outputs; i++) { value += "{}"; } + (*it)->set_value (value); } else { std::cerr << string_compose (X_("AudioTrackImporter: did not recognise XML-property \"%1\""), prop) << endmsg; } diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index dbe7b3c526..89b3b9e89f 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -155,7 +155,7 @@ IO::IO (Session& s, const string& name, _session.add_controllable (_gain_control); - create_bundles_for_inputs_and_outputs (); + setup_bundles_for_inputs_and_outputs (); } IO::IO (Session& s, const XMLNode& node, DataType dt) @@ -194,7 +194,7 @@ IO::IO (Session& s, const XMLNode& node, DataType dt) _session.add_controllable (_gain_control); - create_bundles_for_inputs_and_outputs (); + setup_bundles_for_inputs_and_outputs (); } IO::~IO () @@ -2586,7 +2586,7 @@ IO::update_port_total_latencies () /** - * Setup bundles that describe our inputs and outputs. + * Setup bundles that describe our inputs and outputs. Also creates bundles if necessary. */ void @@ -2594,6 +2594,13 @@ IO::setup_bundles_for_inputs_and_outputs () { char buf[32]; + if (!_bundle_for_inputs) { + _bundle_for_inputs.reset (new Bundle (true)); + } + if (!_bundle_for_outputs) { + _bundle_for_outputs.reset (new Bundle (false)); + } + _bundle_for_inputs->remove_channels (); _bundle_for_outputs->remove_channels (); @@ -2614,19 +2621,6 @@ IO::setup_bundles_for_inputs_and_outputs () } } - -/** - * Create and setup bundles that describe our inputs and outputs. - */ - -void -IO::create_bundles_for_inputs_and_outputs () -{ - _bundle_for_inputs = boost::shared_ptr (new Bundle (true)); - _bundle_for_outputs = boost::shared_ptr (new Bundle (false)); - setup_bundles_for_inputs_and_outputs (); -} - /** @return Bundles connected to our inputs */ BundleList IO::bundles_connected_to_inputs ()