tweaks to NO_PLUGIN_STATE logic
[ardour.git] / libs / ardour / route.cc
index 29e778e4159a36c32c75e0e90d71641e45d33cbc..9d7dc8792b17ee7b5e9e4ad9614206eb2919b94f 100644 (file)
@@ -83,6 +83,7 @@ Route::Route (Session& sess, string name, Flag flg, DataType default_type)
        , _flags (flg)
        , _pending_declick (true)
        , _meter_point (MeterPostFader)
+       , _meter_type (MeterPeak)
        , _self_solo (false)
        , _soloed_by_others_upstream (0)
        , _soloed_by_others_downstream (0)
@@ -1878,6 +1879,8 @@ Route::state(bool full_state)
        node->add_property("denormal-protection", _denormal_protection?"yes":"no");
        node->add_property("meter-point", enum_2_string (_meter_point));
 
+       node->add_property("meter-type", enum_2_string (_meter_type));
+
        if (_route_group) {
                node->add_property("route-group", _route_group->name());
        }
@@ -2052,6 +2055,10 @@ Route::set_state (const XMLNode& node, int version)
                }
        }
 
+       if ((prop = node.property (X_("meter-type"))) != 0) {
+               _meter_type = MeterType (string_2_enum (prop->value (), _meter_type));
+       }
+
        set_processor_state (processor_state);
 
        // this looks up the internal instrument in processors
@@ -2551,9 +2558,24 @@ Route::set_processor_state (const XMLNode& node)
                                        continue;
                                }
 
-                               if (processor->set_state (**niter, Stateful::current_state_version) != 0) {
-                                       /* This processor could not be configured.  Turn it into a UnknownProcessor */
-                                       processor.reset (new UnknownProcessor (_session, **niter));
+                               if (boost::dynamic_pointer_cast<PluginInsert>(processor)) {     
+#ifndef NO_PLUGIN_STATE
+                                       if (processor->set_state (**niter, Stateful::current_state_version) != 0) {
+                                               /* This processor could not be configured.  Turn it into a UnknownProcessor */
+                                               processor.reset (new UnknownProcessor (_session, **niter));
+                                       }
+#else
+                                       /* plugin, with NO_PLUGIN_STATE defined
+                                        * =>::set_state() not allowed. Do not
+                                        * display a message here - things will
+                                        * get too verbose.
+                                        */
+#endif
+                               } else {
+                                       if (processor->set_state (**niter, Stateful::current_state_version) != 0) {
+                                               /* This processor could not be configured.  Turn it into a UnknownProcessor */
+                                               processor.reset (new UnknownProcessor (_session, **niter));
+                                       }
                                }
 
                                /* we have to note the monitor send here, otherwise a new one will be created
@@ -2938,6 +2960,8 @@ Route::output_change_handler (IOChange change, void * /*src*/)
                   contains ConfigurationChanged 
                */
                need_to_queue_solo_change = false;
+               configure_processors (0);
+               io_changed (); /* EMIT SIGNAL */
        }
 
        if (!_output->connected() && _soloed_by_others_downstream) {