add partial support for mute automation (playback does not work, data is not recorded...
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 1 Jul 2014 18:36:58 +0000 (14:36 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 1 Jul 2014 18:37:05 +0000 (14:37 -0400)
gtk2_ardour/audio_time_axis.cc
gtk2_ardour/audio_time_axis.h
gtk2_ardour/midi_time_axis.cc
gtk2_ardour/route_time_axis.cc
gtk2_ardour/route_time_axis.h
libs/ardour/ardour/types.h
libs/ardour/automatable.cc
libs/ardour/event_type_map.cc
libs/ardour/route.cc

index 8c022abdb74e66cc2cd1f1259a61e7767cca1944..cc2686920aa5184b024819775f84b213e3699f54 100644 (file)
@@ -104,6 +104,11 @@ AudioTimeAxisView::set_route (boost::shared_ptr<Route> rt)
                create_automation_child (GainAutomation, false);
        }
 
+       /* if set_state above didn't create a mute automation child, we need to make one */
+       if (automation_child (MuteAutomation) == 0) {
+               create_automation_child (MuteAutomation, false);
+       }
+
        if (_route->panner_shell()) {
                _route->panner_shell()->Changed.connect (*this, invalidator (*this),
                                                          boost::bind (&AudioTimeAxisView::ensure_pan_views, this, false), gui_context());
@@ -202,6 +207,11 @@ AudioTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool
 
                /* handled elsewhere */
 
+       } else if (param.type() == MuteAutomation) {
+
+               create_mute_automation_child (param, show);
+               
+
        } else {
                error << "AudioTimeAxisView: unknown automation child " << EventTypeMap::instance().to_symbol(param) << endmsg;
        }
@@ -283,6 +293,22 @@ AudioTimeAxisView::update_gain_track_visibility ()
        }
 }
 
+void
+AudioTimeAxisView::update_mute_track_visibility ()
+{
+       bool const showit = mute_automation_item->get_active();
+
+       if (showit != string_is_affirmative (mute_track->gui_property ("visible"))) {
+               mute_track->set_marked_for_display (showit);
+
+               /* now trigger a redisplay */
+
+               if (!no_redraw) {
+                        _route->gui_changed (X_("visible_tracks"), (void *) 0); /* EMIT_SIGNAL */
+               }
+       }
+}
+
 void
 AudioTimeAxisView::update_pan_track_visibility ()
 {
@@ -404,6 +430,13 @@ AudioTimeAxisView::build_automation_action_menu (bool for_selection)
 
        _main_automation_menu_map[Evoral::Parameter(GainAutomation)] = gain_automation_item;
 
+       automation_items.push_back (CheckMenuElem (_("Mute"), sigc::mem_fun (*this, &AudioTimeAxisView::update_mute_track_visibility)));
+       mute_automation_item = dynamic_cast<Gtk::CheckMenuItem*> (&automation_items.back ());
+       mute_automation_item->set_active ((!for_selection || _editor.get_selection().tracks.size() == 1) && 
+                                         (mute_track && string_is_affirmative (mute_track->gui_property ("visible"))));
+
+       _main_automation_menu_map[Evoral::Parameter(MuteAutomation)] = mute_automation_item;
+
        if (!pan_tracks.empty()) {
                automation_items.push_back (CheckMenuElem (_("Pan"), sigc::mem_fun (*this, &AudioTimeAxisView::update_pan_track_visibility)));
                pan_automation_item = dynamic_cast<Gtk::CheckMenuItem*> (&automation_items.back ());
index 5790080160bb24bc3fb6124f81db66e0def4bdf5..7a5afe4f97f8422b3cd8de660ad948c697ce2b1f 100644 (file)
@@ -105,9 +105,11 @@ class AudioTimeAxisView : public RouteTimeAxisView
        void update_control_names ();
 
        void update_gain_track_visibility ();
+       void update_mute_track_visibility ();
        void update_pan_track_visibility ();
 
        Gtk::CheckMenuItem* gain_automation_item;
+       Gtk::CheckMenuItem* mute_automation_item;
        std::list<boost::shared_ptr<AutomationTimeAxisView> > pan_tracks;
        Gtk::CheckMenuItem* pan_automation_item;
 };
index c37916dbf0c95b7056b1c8f7668e8a7ec57570d3..af19c9b037552e93a878bb885ceebf2a6c0edea1 100644 (file)
@@ -171,6 +171,11 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
                create_automation_child (GainAutomation, false);
        }
 
+       /* if set_state above didn't create a mute automation child, we need to make one */
+       if (automation_child (MuteAutomation) == 0) {
+               create_automation_child (MuteAutomation, false);
+       }
+
        if (_route->panner_shell()) {
                _route->panner_shell()->Changed.connect (*this, invalidator (*this), boost::bind (&MidiTimeAxisView::ensure_pan_views, this, false), gui_context());
        }
@@ -1265,6 +1270,10 @@ MidiTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool
                create_gain_automation_child (param, show);
                break;
 
+       case MuteAutomation:
+               create_mute_automation_child (param, show);
+               break;
+
        case PluginAutomation:
                /* handled elsewhere */
                break;
index 55dbec5f8bc0d186d958dd5360efe17e529d23a1..77fb0815bcd537a5115fb33d1f7c135a7a979914 100644 (file)
@@ -2526,6 +2526,30 @@ RouteTimeAxisView::create_gain_automation_child (const Evoral::Parameter& param,
        add_automation_child (Evoral::Parameter(GainAutomation), gain_track, show);
 }
 
+void
+RouteTimeAxisView::create_mute_automation_child (const Evoral::Parameter& param, bool show)
+{
+       boost::shared_ptr<AutomationControl> c = _route->mute_control();
+       if (!c) {
+               error << "Route has no mute automation, unable to add automation track view." << endmsg;
+               return;
+       }
+
+       mute_track.reset (new AutomationTimeAxisView (_session,
+                                                     _route, _route, c, param,
+                                                     _editor,
+                                                     *this,
+                                                     false,
+                                                     parent_canvas,
+                                                     _route->describe_parameter(param)));
+
+       if (_view) {
+               _view->foreach_regionview (sigc::mem_fun (*mute_track.get(), &TimeAxisView::add_ghost));
+       }
+
+       add_automation_child (Evoral::Parameter(MuteAutomation), mute_track, show);
+}
+
 static
 void add_region_to_list (RegionView* rv, RegionList* l)
 {
index 3a717f0953dd784f059115987a52d22ed6f92b63..f56b747a8f9943dbb35a05e7f5455f7090eb33c2 100644 (file)
@@ -237,11 +237,13 @@ protected:
        void color_handler ();
        void region_view_added (RegionView*);
        void create_gain_automation_child (const Evoral::Parameter &, bool);
+       void create_mute_automation_child (const Evoral::Parameter &, bool);
        void setup_processor_menu_and_curves ();
        void route_color_changed ();
         bool can_edit_name() const;
 
        boost::shared_ptr<AutomationTimeAxisView> gain_track;
+       boost::shared_ptr<AutomationTimeAxisView> mute_track;
 
        StreamView*           _view;
        ArdourCanvas::Canvas& parent_canvas;
index 216de8bb0c31c6d5487c3fa4e5b40dc40acf2dab..af56e12a5be7838eff553b9821d3b22313a82bbe 100644 (file)
@@ -137,7 +137,7 @@ namespace ARDOUR {
                FadeInAutomation,
                FadeOutAutomation,
                EnvelopeAutomation,
-               RecEnableAutomation
+               RecEnableAutomation,
        };
 
        enum AutoState {
index 84f8cd56cca540948a29b93998d29a72e5d3fb29..7669f22df16c68d8782d557c0553d40c373c91a0 100644 (file)
@@ -156,6 +156,8 @@ Automatable::describe_parameter (Evoral::Parameter param)
 
        if (param == Evoral::Parameter(GainAutomation)) {
                return _("Fader");
+       } else if (param.type() == MuteAutomation) {
+               return _("Mute");
        } else if (param.type() == MidiCCAutomation) {
                return string_compose("Controller %1 [%2]", param.id(), int(param.channel()) + 1);
        } else if (param.type() == MidiPgmChangeAutomation) {
index 7cf6045d86bc4fa85c875071e01480c9a9d42f0e..29a363c78b42952220af25b8b162ff5b59855a8a 100644 (file)
@@ -163,14 +163,17 @@ EventTypeMap::new_parameter(uint32_t type, uint8_t channel, uint32_t id) const
                /* default 0.0 - 1.0 is fine */
                break;
        case PluginAutomation:
-       case SoloAutomation:
-       case MuteAutomation:
        case FadeInAutomation:
        case FadeOutAutomation:
        case EnvelopeAutomation:
                max = 2.0f;
                normal = 1.0f;
                break;
+       case SoloAutomation:
+       case MuteAutomation:
+               max = 1.0f;
+               normal = 0.0f;
+               break;
        case MidiCCAutomation:
        case MidiPgmChangeAutomation:
        case MidiChannelPressureAutomation:
index 5df58ea846b63669d26722f4e07449d5138dd346..bac9996dee0cfcb4bd49addcb4681b2b8b42119f 100644 (file)
@@ -3441,6 +3441,8 @@ Route::MuteControllable::set_value (double val)
                return;
        }
 
+       cerr << " _route->mute with val = " << val << endl;
+
        rl->push_back (r);
        _session.set_mute (rl, bval);
 }