+
+ io->changed.connect (_io_connection, invalidator (*this), boost::bind (&IOSelector::io_changed_proxy, this), gui_context ());
+
+ setup_all_ports ();
+ init ();
+}
+
+void
+IOSelector::setup_type ()
+{
+ /* set type according to what's in the IO */
+
+ int N = 0;
+ DataType type_with_ports = DataType::NIL;
+ for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
+ if (_io->ports().num_ports (*i)) {
+ type_with_ports = *i;
+ ++N;
+ }
+ }
+
+ if (N <= 1) {
+ set_type (type_with_ports);
+ } else {
+ set_type (DataType::NIL);
+ }
+}
+
+void
+IOSelector::io_changed_proxy ()
+{
+ /* The IO's changed signal is emitted from code that holds its route's processor lock,
+ so we can't call setup_all_ports (which results in a call to Route::foreach_processor)
+ without a deadlock unless we break things up with this idle handler.
+ */