Use central method to check for engine for processor operations
[ardour.git] / gtk2_ardour / route_ui.cc
index 0eea9d8d44b2992034e171ce9b50640a3f02a8ec..157bb40a308b7646bc5b5a0b8fdf47dc1a93600b 100644 (file)
@@ -499,7 +499,7 @@ RouteUI::mute_press (GdkEventButton* ev)
                                        }
 
                                        boost::shared_ptr<MuteControl> mc = _route->mute_control();
-                                       mc->start_touch (_session->audible_frame ());
+                                       mc->start_touch (_session->audible_sample ());
                                        _session->set_controls (route_list_to_control_list (rl, &Stripable::mute_control), _route->muted_by_self() ? 0.0 : 1.0, Controllable::InverseGroup);
                                }
 
@@ -515,7 +515,7 @@ RouteUI::mute_press (GdkEventButton* ev)
                                }
 
                                boost::shared_ptr<MuteControl> mc = _route->mute_control();
-                               mc->start_touch (_session->audible_frame ());
+                               mc->start_touch (_session->audible_sample ());
                                mc->set_value (!_route->muted_by_self(), Controllable::UseGroup);
                        }
                }
@@ -533,7 +533,7 @@ RouteUI::mute_release (GdkEventButton* /*ev*/)
                _mute_release = 0;
        }
 
-       _route->mute_control()->stop_touch (_session->audible_frame ());
+       _route->mute_control()->stop_touch (_session->audible_sample ());
 
        return false;
 }
@@ -1920,7 +1920,7 @@ RouteUI::map_frozen ()
 void
 RouteUI::adjust_latency ()
 {
-       LatencyDialog dialog (_route->name() + _(" latency"), *(_route->output()), _session->frame_rate(), AudioEngine::instance()->samples_per_cycle());
+       LatencyDialog dialog (_route->name() + _(" latency"), *(_route->output()), _session->sample_rate(), AudioEngine::instance()->samples_per_cycle());
 }
 
 
@@ -2323,6 +2323,10 @@ RouteUI::manage_pins ()
 void
 RouteUI::fan_out (bool to_busses, bool group)
 {
+       if (ARDOUR_UI_UTILS::no_engine_notify ()) {
+               return;
+       }
+
        DisplaySuspender ds;
        boost::shared_ptr<ARDOUR::Route> route = _route;
        boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (route->the_instrument ());
@@ -2368,19 +2372,27 @@ RouteUI::fan_out (bool to_busses, bool group)
                std::string bn = BUSNAME;
                boost::shared_ptr<Route> r = _session->route_by_name (bn);
                if (!r) {
-                       if (to_busses) {
-                               RouteList rl = _session->new_audio_route (busnames[bn], outputs, NULL, 1, bn, PresentationInfo::AudioBus, PresentationInfo::max_order);
-                               r = rl.front ();
-                               assert (r);
-                       } else {
-                               list<boost::shared_ptr<AudioTrack> > tl =
-                                       _session->new_audio_track (busnames[bn], outputs, NULL, 1, bn, PresentationInfo::max_order, Normal);
-                               r = tl.front ();
-                               assert (r);
-
-                               boost::shared_ptr<ControlList> cl (new ControlList);
-                               cl->push_back (r->monitoring_control ());
-                               _session->set_controls (cl, (double) MonitorInput, Controllable::NoGroup);
+                       try {
+                               if (to_busses) {
+                                       RouteList rl = _session->new_audio_route (busnames[bn], outputs, NULL, 1, bn, PresentationInfo::AudioBus, PresentationInfo::max_order);
+                                       r = rl.front ();
+                                       assert (r);
+                               } else {
+                                       list<boost::shared_ptr<AudioTrack> > tl =
+                                               _session->new_audio_track (busnames[bn], outputs, NULL, 1, bn, PresentationInfo::max_order, Normal);
+                                       r = tl.front ();
+                                       assert (r);
+
+                                       boost::shared_ptr<ControlList> cl (new ControlList);
+                                       cl->push_back (r->monitoring_control ());
+                                       _session->set_controls (cl, (double) MonitorInput, Controllable::NoGroup);
+                               }
+                       } catch (...) {
+                               if (!to_group.empty()) {
+                                       boost::shared_ptr<RouteList> rl (&to_group);
+                                       _session->remove_routes (rl);
+                               }
+                               return;
                        }
                        r->input ()->disconnect (this);
                }
@@ -2431,6 +2443,6 @@ void
 RouteUI::set_disk_io_point (DiskIOPoint diop)
 {
        if (_route && is_track()) {
-               track()->set_disk_io_position (diop);
+               track()->set_disk_io_point (diop);
        }
 }