extend strict-i/o to include route outputs.
[ardour.git] / gtk2_ardour / processor_box.cc
index 3711c39029b775d3da52d1f259d26b17502fa7a8..03492d7c84f48536f37fcc5fb081f9a4d096f72b 100644 (file)
@@ -199,8 +199,10 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processo
 
                _button.set_active (_processor->active());
 
-               routing_icon.set_no_show_all(true);
                input_icon.set_no_show_all(true);
+               routing_icon.set_no_show_all(true);
+               output_icon.set_no_show_all(true);
+               output_routing_icon.set_no_show_all(true);
 
                _button.show ();
                input_icon.hide();
@@ -1025,12 +1027,16 @@ ProcessorEntry::RoutingIcon::set (
                const ARDOUR::ChanCount& sinks,
                const ARDOUR::ChanCount& sources,
                const ARDOUR::ChanMapping& in_map,
-               const ARDOUR::ChanMapping& out_map)
+               const ARDOUR::ChanMapping& out_map,
+               const ARDOUR::ChanMapping& thru_map)
 {
-       _in = in; _out = out;
-       _sources = sources; _sinks = sinks;
-       _in_map = in_map; _out_map = out_map;
-
+       _in       = in;
+       _out      = out;
+       _sources  = sources;
+       _sinks    = sinks;
+       _in_map   = in_map;
+       _out_map  = out_map;
+       _thru_map = thru_map;
 }
 
 bool
@@ -1038,14 +1044,14 @@ ProcessorEntry::RoutingIcon::identity () const {
        if (!_in_map.is_monotonic () || !_in_map.is_identity ()) {
                return false;
        }
-       if (_in_map.count () != _sinks.n_total () || _in.n_total () != _sinks.n_total ()) {
+       if (_in_map.n_total () != _sinks.n_total () || _in.n_total () != _sinks.n_total ()) {
                return false;
        }
        if (_feed) {
                if (!_f_out_map.is_monotonic () || !_f_out_map.is_identity ()) {
                        return false;
                }
-               if (_f_out_map.count () != _f_sources.n_total () || _sinks != _f_sources) {
+               if (_f_out_map.n_total () != _f_sources.n_total () || _sinks != _f_sources) {
                        return false;
                }
        }
@@ -1057,7 +1063,10 @@ ProcessorEntry::RoutingIcon::out_identity () const {
        if (!_out_map.is_monotonic () || !_out_map.is_identity ()) {
                return false;
        }
-       if (_out_map.count () != _sources.n_total () || _out.n_total () != _sources.n_total ()) {
+       if (_out_map.n_total () != _sources.n_total () || _out.n_total () != _sources.n_total ()) {
+               return false;
+       }
+       if (_thru_map.n_total () > 0) {
                return false;
        }
        return true;
@@ -1067,12 +1076,14 @@ void
 ProcessorEntry::RoutingIcon::set_feed (
                                const ARDOUR::ChanCount& out,
                                const ARDOUR::ChanCount& sources,
-                               const ARDOUR::ChanMapping& out_map)
+                               const ARDOUR::ChanMapping& out_map,
+                               const ARDOUR::ChanMapping& thru_map)
 {
-       _f_out     = out;
-       _f_sources = sources;
-       _f_out_map = out_map;
-       _feed      = true;
+       _f_out      = out;
+       _f_sources  = sources;
+       _f_out_map  = out_map;
+       _f_thru_map = thru_map;
+       _feed       = true;
 }
 
 double
@@ -1126,13 +1137,32 @@ void
 ProcessorEntry::RoutingIcon::draw_sidechain (cairo_t* cr, double x0, double height, bool midi)
 {
        const double dx = 1 + rint (max(2., 2. * UIConfiguration::instance().get_ui_scale()));
-       const double y0 = rint (height * .66) + .5;
+       const double y0 = rint (height * .6) + .5;
 
        cairo_move_to (cr, x0 - dx, height);
        cairo_line_to (cr, x0, y0);
        cairo_line_to (cr, x0 + dx, height);
        cairo_close_path (cr);
 
+       set_routing_color (cr, midi);
+       cairo_fill (cr);
+}
+
+void
+ProcessorEntry::RoutingIcon::draw_thru (cairo_t* cr, double x0, double height, bool midi)
+{
+       const double dx = 1 + rint (max(2., 2. * UIConfiguration::instance().get_ui_scale()));
+       const double y0 = rint (height * .5) + .5;
+
+       cairo_move_to (cr, x0 - dx - .5, y0);
+       cairo_line_to (cr, x0 + dx + .5, y0 - 2);
+
+       cairo_move_to (cr, x0 - dx - .5, y0 + 2);
+       cairo_line_to (cr, x0 + dx + .5, y0);
+
+       cairo_move_to (cr, x0, y0 + 1);
+       cairo_line_to (cr, x0, height);
+
        set_routing_color (cr, midi);
        cairo_set_line_width  (cr, 1.0);
        cairo_stroke (cr);
@@ -1224,7 +1254,13 @@ ProcessorEntry::RoutingIcon::expose_input_map (cairo_t* cr, const double width,
                        uint32_t src = _f_out_map.get_src (dt, idx, &valid_src);
                        if (!valid_src) {
                                double x = pin_x_pos (i, width, pc_in, 0, false);
-                               draw_gnd (cr, x, height, is_midi);
+                               bool valid_thru;
+                               _f_thru_map.get (dt, idx, &valid_thru);
+                               if (valid_thru) {
+                                       draw_thru (cr, x, height, is_midi);
+                               } else {
+                                       draw_gnd (cr, x, height, is_midi);
+                               }
                                continue;
                        }
                        c_x0 = pin_x_pos (src, width, _f_sources.n_total(), _f_sources.n_midi(), is_midi);
@@ -1251,8 +1287,6 @@ ProcessorEntry::RoutingIcon::expose_output_map (cairo_t* cr, const double width,
                DataType dt = is_midi ? DataType::MIDI : DataType::AUDIO;
                uint32_t idx = _out_map.get (dt, pn, &valid_out);
                if (!valid_out) {
-                       double x = pin_x_pos (i, width, pc_out, 0, is_midi);
-                       draw_X (cr, x, height - 5, is_midi);
                        continue;
                }
                double c_x0 = pin_x_pos (i, width, pc_out, 0, false);
@@ -1260,7 +1294,7 @@ ProcessorEntry::RoutingIcon::expose_output_map (cairo_t* cr, const double width,
                draw_connection (cr, c_x0, c_x1, 0, height - 3, is_midi);
        }
 
-       // arrows
+       // output arrows
        for (uint32_t i = 0; i < n_out; ++i) {
                const bool is_midi = i < n_out_midi;
                double x = pin_x_pos (i, width, n_out, 0, is_midi);
@@ -1269,7 +1303,13 @@ ProcessorEntry::RoutingIcon::expose_output_map (cairo_t* cr, const double width,
                bool valid_src;
                _out_map.get_src (dt, pn, &valid_src);
                if (!valid_src) {
-                       draw_gnd (cr, x, height, is_midi);
+                       bool valid_thru;
+                       _thru_map.get (dt, pn, &valid_thru);
+                       if (valid_thru) {
+                               draw_thru (cr, x, height, is_midi);
+                       } else {
+                               draw_gnd (cr, x, height, is_midi);
+                       }
                }
                set_routing_color (cr, is_midi);
                cairo_move_to (cr, x    , height);
@@ -2600,29 +2640,30 @@ ProcessorBox::setup_routing_feeds ()
                        ChanCount in, out;
                        pi->configured_io (in, out);
 
-                       ChanCount midi_trhu;
+                       ChanCount midi_thru;
                        ChanCount midi_bypass;
                        ChanMapping input_map (pi->input_map ());
-                       if (pi->has_midi_trhu ()) {
-                                midi_trhu.set(DataType::MIDI, 1);
+                       if (pi->has_midi_thru ()) {
+                                midi_thru.set(DataType::MIDI, 1);
                                 input_map.set (DataType::MIDI, 0, 0);
                        }
                        if (pi->has_midi_bypass ()) {
                                 midi_bypass.set(DataType::MIDI, 1);
                        }
 
-                       (*i)->input_icon.set_ports (sinks * count + midi_trhu);
+                       (*i)->input_icon.set_ports (sinks * count + midi_thru);
                        (*i)->output_icon.set_ports (sources * count + midi_bypass);
 
                        (*i)->routing_icon.set (
                                        in, out,
-                                       sinks * count + midi_trhu,
+                                       sinks * count + midi_thru,
                                        sources * count + midi_bypass,
                                        input_map,
-                                       pi->output_map ());
+                                       pi->output_map (),
+                                       pi->thru_map ());
 
                        if (next != children.end()) {
-                               (*next)->routing_icon.set_feed (out, sources * count + midi_bypass, pi->output_map ());
+                               (*next)->routing_icon.set_feed (out, sources * count + midi_bypass, pi->output_map (), pi->thru_map ());
                        }
 
                } else {
@@ -2630,15 +2671,16 @@ ProcessorBox::setup_routing_feeds ()
                        (*i)->output_icon.set_ports (p->output_streams());
                        ChanMapping inmap (p->input_streams ());
                        ChanMapping outmap (p->input_streams ());
+                       ChanMapping thrumap;
                        (*i)->routing_icon.set (
                                        p->input_streams(),
                                        p->output_streams(),
                                        p->input_streams(),
                                        p->output_streams(),
-                                       inmap, outmap);
+                                       inmap, outmap, thrumap);
 
                        if (next != children.end()) {
-                               (*next)->routing_icon.set_feed (p->output_streams(),  p->output_streams(), outmap);
+                               (*next)->routing_icon.set_feed (p->output_streams(),  p->output_streams(), outmap, thrumap);
                        }
                }