diff options
Diffstat (limited to 'gtk2_ardour')
48 files changed, 504 insertions, 305 deletions
diff --git a/gtk2_ardour/SConscript b/gtk2_ardour/SConscript index 384e312e62..91245a5584 100644 --- a/gtk2_ardour/SConscript +++ b/gtk2_ardour/SConscript @@ -101,6 +101,7 @@ automation_midi_cc_line.cc automation_line.cc automation_pan_line.cc automation_time_axis.cc +automation_controller.cc midi_time_axis.cc midi_streamview.cc axis_view.cc diff --git a/gtk2_ardour/ardour.bindings.in b/gtk2_ardour/ardour.bindings.in index 2bdbe71883..bbe72c0578 100644 --- a/gtk2_ardour/ardour.bindings.in +++ b/gtk2_ardour/ardour.bindings.in @@ -10,14 +10,14 @@ ; (gtk_accel_path "<Actions>/Editor/Autoconnect" "") ; (gtk_accel_path "<Actions>/Editor/Edit" "") (gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-end" "<Control>comma") -; (gtk_accel_path "<Actions>/redirectmenu/copy" "") +; (gtk_accel_path "<Actions>/processormenu/copy" "") ; (gtk_accel_path "<Actions>/options/MeterFalloffFaster" "") (gtk_accel_path "<Actions>/Transport/ToggleRollForgetCapture" "<Control>space") (gtk_accel_path "<Actions>/Transport/Record" "<Shift>r") ; (gtk_accel_path "<Actions>/RegionList/SortByRegionLength" "") ; (gtk_accel_path "<Actions>/options/MeterFalloffSlowest" "") ; (gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-sync" "") -; (gtk_accel_path "<Actions>/redirectmenu/deactivate_all" "") +; (gtk_accel_path "<Actions>/processormenu/deactivate_all" "") ; (gtk_accel_path "<Actions>/RegionList/SortByRegionPosition" "") ; (gtk_accel_path "<Actions>/Editor/ZoomFocus" "") ; (gtk_accel_path "<Actions>/options/MeterFalloffSlow" "") @@ -28,7 +28,7 @@ ; (gtk_accel_path "<Actions>/Zoom/zoom-focus-playhead" "") ; (gtk_accel_path "<Actions>/Editor/center-edit-cursor" "") ; (gtk_accel_path "<Actions>/Editor/Monitoring" "") -; (gtk_accel_path "<Actions>/redirectmenu/deactivate" "") +; (gtk_accel_path "<Actions>/processormenu/deactivate" "") ; (gtk_accel_path "<Actions>/options/LatchedRecordEnable" "") ; (gtk_accel_path "<Actions>/Transport/TogglePunchIn" "") ; (gtk_accel_path "<Actions>/ShuttleActions/SetShuttleUnitsPercentage" "") @@ -96,9 +96,9 @@ ; (gtk_accel_path "<Actions>/Zoom/zoom-focus-edit" "") (gtk_accel_path "<Actions>/Editor/playhead-to-previous-region-start" "comma") ; (gtk_accel_path "<Actions>/Editor/EditCursorMovementOptions" "") -; (gtk_accel_path "<Actions>/redirectmenu/activate_all" "") +; (gtk_accel_path "<Actions>/processormenu/activate_all" "") ; (gtk_accel_path "<Actions>/Editor/addExternalAudioAsTapeTrack" "") -; (gtk_accel_path "<Actions>/redirectmenu/paste" "") +; (gtk_accel_path "<Actions>/processormenu/paste" "") ; (gtk_accel_path "<Actions>/Editor/Smpte25" "") ; (gtk_accel_path "<Actions>/options/RegionEquivalentsOverlap" "") ; (gtk_accel_path "<Actions>/Main/MeteringFallOffRate" "") @@ -123,7 +123,7 @@ (gtk_accel_path "<Actions>/Editor/align-regions-sync-relative" "a") ; (gtk_accel_path "<Actions>/Editor/EditSelectRegionOptions" "") (gtk_accel_path "<Actions>/Editor/crop" "c") -; (gtk_accel_path "<Actions>/redirectmenu/newsend" "") +; (gtk_accel_path "<Actions>/processormenu/newsend" "") ; (gtk_accel_path "<Actions>/Editor/ToggleGeneric MIDISurfaceSubMenu" "") ; (gtk_accel_path "<Actions>/Editor/MeterFalloff" "") ; (gtk_accel_path "<Actions>/RegionList/rlRemove" "") @@ -136,7 +136,7 @@ (gtk_accel_path "<Actions>/Editor/align-regions-sync" "<Mod2>a") ; (gtk_accel_path "<Actions>/Main/Windows" "") ; (gtk_accel_path "<Actions>/Main/CleanupUnused" "") -; (gtk_accel_path "<Actions>/redirectmenu/deselectall" "") +; (gtk_accel_path "<Actions>/processormenu/deselectall" "") ; (gtk_accel_path "<Actions>/options/SoloViaBus" "") (gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-zoom" "z") ; (gtk_accel_path "<Actions>/RegionList/rlAudition" "") @@ -202,7 +202,7 @@ (gtk_accel_path "<Actions>/Editor/temporal-zoom-in" "minus") ; (gtk_accel_path "<Actions>/JACK/Latency" "") (gtk_accel_path "<Actions>/Editor/edit-cursor-to-range-end" "F2") -; (gtk_accel_path "<Actions>/redirectmenu/rename" "") +; (gtk_accel_path "<Actions>/processormenu/rename" "") ; (gtk_accel_path "<Actions>/RegionList/rlShowAuto" "") (gtk_accel_path "<Actions>/Editor/select-all-before-playhead" "<Control>p") ; (gtk_accel_path "<Actions>/Editor/addExistingAudioFiles" "") @@ -231,7 +231,7 @@ (gtk_accel_path "<Actions>/Common/goto-mixer" "<Alt>m") ; (gtk_accel_path "<Actions>/Editor/addExternalAudioToTrack" "") ; (gtk_accel_path "<Actions>/RegionList/SortBySourceFileCreationDate" "") -; (gtk_accel_path "<Actions>/redirectmenu/activate" "") +; (gtk_accel_path "<Actions>/processormenu/activate" "") (gtk_accel_path "<Actions>/Editor/extend-range-to-start-of-region" "leftanglebracket") ; (gtk_accel_path "<Actions>/Editor/PullupMinus1" "") ; (gtk_accel_path "<Actions>/Editor/snap-normal" "") @@ -239,7 +239,7 @@ (gtk_accel_path "<Actions>/Common/ToggleBigClock" "<Alt>b") ; (gtk_accel_path "<Actions>/Snap/snap-to-asixteenthbeat" "") (gtk_accel_path "<Actions>/Editor/select-all-in-punch-range" "<Control>d") -; (gtk_accel_path "<Actions>/redirectmenu/edit" "") +; (gtk_accel_path "<Actions>/processormenu/edit" "") (gtk_accel_path "<Actions>/Editor/duplicate-region" "d") ; (gtk_accel_path "<Actions>/JACK/JACKLatency2048" "") ; (gtk_accel_path "<Actions>/Editor/ToggleWaveformsWhileRecording" "") @@ -248,8 +248,8 @@ ; (gtk_accel_path "<Actions>/options/FileHeaderFormatWAVE" "") (gtk_accel_path "<Actions>/Transport/GotoZero" "KP_Insert") (gtk_accel_path "<Actions>/Transport/GotoEnd" "End") -; (gtk_accel_path "<Actions>/redirectmenu/cut" "") -; (gtk_accel_path "<Actions>/redirectmenu/newinsert" "") +; (gtk_accel_path "<Actions>/processormenu/cut" "") +; (gtk_accel_path "<Actions>/processormenu/newinsert" "") ; (gtk_accel_path "<Actions>/options/UseMMC" "") ; (gtk_accel_path "<Actions>/options/MeterFalloffOff" "") (gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-object" "o") @@ -296,7 +296,7 @@ ; (gtk_accel_path "<Actions>/Editor/toggle-xfades-active" "") ; (gtk_accel_path "<Actions>/Snap/snap-to-bar" "") ; (gtk_accel_path "<Actions>/Editor/LayerLaterHigher" "") -; (gtk_accel_path "<Actions>/redirectmenu/selectall" "") +; (gtk_accel_path "<Actions>/processormenu/selectall" "") (gtk_accel_path "<Actions>/Editor/editor-copy" "<Control>c") ; (gtk_accel_path "<Actions>/Snap/snap-to-quarters" "") (gtk_accel_path "<Actions>/Editor/temporal-zoom-out" "equal") @@ -306,13 +306,13 @@ ; (gtk_accel_path "<Actions>/options/OutputAutoConnectManual" "") ; (gtk_accel_path "<Actions>/Snap/snap-to-region-sync" "") (gtk_accel_path "<Actions>/Editor/edit-cursor-to-previous-region-sync" "apostrophe") -; (gtk_accel_path "<Actions>/redirectmenu/clear" "") +; (gtk_accel_path "<Actions>/processormenu/clear" "") ; (gtk_accel_path "<Actions>/Editor/ToggleGeneric MIDISurfaceFeedback" "") ; (gtk_accel_path "<Actions>/Editor/PullupPlus4Minus1" "") ; (gtk_accel_path "<Actions>/JACK/JACKLatency512" "") (gtk_accel_path "<Actions>/Editor/edit-cursor-to-next-region-end" "<Control>bracketright") ; (gtk_accel_path "<Actions>/Main/Recent" "") -; (gtk_accel_path "<Actions>/redirectmenu/newplugin" "") +; (gtk_accel_path "<Actions>/processormenu/newplugin" "") ; (gtk_accel_path "<Actions>/options/InputAutoConnectManual" "") ; (gtk_accel_path "<Actions>/options/MeterHoldLong" "") ; (gtk_accel_path "<Actions>/Snap/snap-to-seconds" "") diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus index 13b8cbf738..27dea430d8 100644 --- a/gtk2_ardour/ardour.menus +++ b/gtk2_ardour/ardour.menus @@ -374,7 +374,7 @@ </menu> </menubar> - <popup name='redirectmenu'> + <popup name='processormenu'> <menuitem action='newplugin'/> <menuitem action='newinsert'/> <menuitem action='newsend'/> diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 058295949f..40349877a1 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -171,11 +171,11 @@ AudioRegionView::init (Gdk::Color& basic_color, bool wfd) setup_fade_handle_positions (); - string foo = _region->name(); - foo += ':'; - foo += "gain"; + string line_name = _region->name(); + line_name += ':'; + line_name += "gain"; - gain_line = new AudioRegionGainLine (foo, trackview.session(), *this, *group, audio_region()->envelope()); + gain_line = new AudioRegionGainLine (line_name, trackview.session(), *this, *group, audio_region()->envelope()); if (!(_flags & EnvelopeVisible)) { gain_line->hide (); @@ -489,7 +489,7 @@ AudioRegionView::reset_fade_shapes () void AudioRegionView::reset_fade_in_shape () { - reset_fade_in_shape_width ((nframes_t) audio_region()->fade_in().back()->when); + reset_fade_in_shape_width ((nframes_t) audio_region()->fade_in()->back()->when); } void @@ -534,7 +534,7 @@ AudioRegionView::reset_fade_in_shape_width (nframes_t width) fade_in_shape->show(); float curve[npoints]; - audio_region()->fade_in().curve().get_vector (0, audio_region()->fade_in().back()->when, curve, npoints); + audio_region()->fade_in()->curve().get_vector (0, audio_region()->fade_in()->back()->when, curve, npoints); points = get_canvas_points ("fade in shape", npoints+3); @@ -573,7 +573,7 @@ AudioRegionView::reset_fade_in_shape_width (nframes_t width) void AudioRegionView::reset_fade_out_shape () { - reset_fade_out_shape_width ((nframes_t) audio_region()->fade_out().back()->when); + reset_fade_out_shape_width ((nframes_t) audio_region()->fade_out()->back()->when); } void @@ -620,7 +620,7 @@ AudioRegionView::reset_fade_out_shape_width (nframes_t width) fade_out_shape->show(); float curve[npoints]; - audio_region()->fade_out().curve().get_vector (0, audio_region()->fade_out().back()->when, curve, npoints); + audio_region()->fade_out()->curve().get_vector (0, audio_region()->fade_out()->back()->when, curve, npoints); if (_height > NAME_HIGHLIGHT_THRESH) { h = _height - NAME_HIGHLIGHT_SIZE; @@ -941,7 +941,7 @@ AudioRegionView::add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev) gain_line->view_to_model_y (y); trackview.session().begin_reversible_command (_("add gain control point")); - XMLNode &before = audio_region()->envelope().get_state(); + XMLNode &before = audio_region()->envelope()->get_state(); if (!audio_region()->envelope_active()) { XMLNode ®ion_before = audio_region()->get_state(); @@ -950,10 +950,10 @@ AudioRegionView::add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev) trackview.session().add_command (new MementoCommand<AudioRegion>(*(audio_region().get()), ®ion_before, ®ion_after)); } - audio_region()->envelope().add (fx, y); + audio_region()->envelope()->add (fx, y); - XMLNode &after = audio_region()->envelope().get_state(); - trackview.session().add_command (new MementoCommand<AutomationList>(audio_region()->envelope(), &before, &after)); + XMLNode &after = audio_region()->envelope()->get_state(); + trackview.session().add_command (new MementoCommand<AutomationList>(*audio_region()->envelope().get(), &before, &after)); trackview.session().commit_reversible_command (); } @@ -961,7 +961,7 @@ void AudioRegionView::remove_gain_point_event (ArdourCanvas::Item *item, GdkEvent *ev) { ControlPoint *cp = reinterpret_cast<ControlPoint *> (item->get_data ("control_point")); - audio_region()->envelope().erase (cp->model); + audio_region()->envelope()->erase (cp->model); } void diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc index 416a86c1a5..3d62915171 100644 --- a/gtk2_ardour/audio_time_axis.cc +++ b/gtk2_ardour/audio_time_axis.cc @@ -284,18 +284,25 @@ void AudioTimeAxisView::create_automation_child (ParamID param) { if (param.type() == GainAutomation) { + + boost::shared_ptr<AutomationControl> c = _route->gain_control(); + if (!c) { + error << "Route has no gain automation, unable to add automation track view." << endmsg; + return; + } + GainAutomationTimeAxisView* gain_track = new GainAutomationTimeAxisView (_session, _route, editor, *this, parent_canvas, _route->describe_parameter(param), - _route->gain_automation()); + c); AutomationLine* line = new AutomationGainLine ("automation gain", *gain_track, *gain_track->canvas_display, - _route->gain_automation()); + c->list()); line->set_line_color (Config->canvasvar_AutomationLine.get()); @@ -304,7 +311,7 @@ AudioTimeAxisView::create_automation_child (ParamID param) add_automation_child(ParamID(GainAutomation), gain_track); } else if (param.type() == PanAutomation) { - + PanAutomationTimeAxisView* pan_track = new PanAutomationTimeAxisView (_session, _route, editor, diff --git a/gtk2_ardour/automation_controller.cc b/gtk2_ardour/automation_controller.cc new file mode 100644 index 0000000000..a72aa0ba7d --- /dev/null +++ b/gtk2_ardour/automation_controller.cc @@ -0,0 +1,110 @@ +/* + Copyright (C) 2007 Paul Davis + Author: Dave Robillard + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include <pbd/error.h> +#include "automation_controller.h" +#include "ardour/automation_event.h" +#include "ardour/automation_control.h" +#include "ardour_ui.h" +#include "utils.h" + +#include "i18n.h" + +using namespace ARDOUR; +using namespace Gtk; + + +AutomationController::AutomationController(boost::shared_ptr<AutomationControl> ac, Adjustment* adj) + : BarController(*adj, *ac) + , _ignore_change(false) + , _controllable(ac) + , _adjustment(adj) +{ + set_name (X_("PluginSlider")); // FIXME: get yer own name! + set_style (BarController::LeftToRight); + set_use_parent (true); + + label_callback = sigc::mem_fun(this, &AutomationController::update_label); + + StartGesture.connect (mem_fun(*this, &AutomationController::start_touch)); + StopGesture.connect (mem_fun(*this, &AutomationController::end_touch)); + + _adjustment->signal_value_changed().connect ( + mem_fun(*this, &AutomationController::value_adjusted)); + + _screen_update_connection = ARDOUR_UI::RapidScreenUpdate.connect ( + mem_fun (*this, &AutomationController::display_effective_value)); +} + +AutomationController::~AutomationController() +{ +} + +boost::shared_ptr<AutomationController> +AutomationController::create(Session& s, boost::shared_ptr<AutomationList> al, boost::shared_ptr<AutomationControl> ac) +{ + Gtk::Adjustment* adjustment = manage(new Gtk::Adjustment(al->default_value(), al->get_min_y(), al->get_max_y())); + if (!ac) { + PBD::warning << "Creating AutomationController for " << al->param_id().to_string() << endmsg; + ac = boost::shared_ptr<AutomationControl>(new AutomationControl(s, al)); + } + return boost::shared_ptr<AutomationController>(new AutomationController(ac, adjustment)); +} + +void +AutomationController::update_label(char* label, int label_len) +{ + //cerr << "Controller label: " << label << endl; +} + +void +AutomationController::display_effective_value() +{ + if ( ! _controllable->list()->automation_playback()) + return; + + float value = _controllable->get_value(); + + if (_adjustment->get_value() != value) { + _ignore_change = true; + _adjustment->set_value (value); + _ignore_change = false; + } +} + +void +AutomationController::value_adjusted() +{ + if (!_ignore_change) { + _controllable->set_value(_adjustment->get_value()); + } +} + +void +AutomationController::start_touch() +{ + _controllable->list()->start_touch(); +} + +void +AutomationController::end_touch() +{ + _controllable->list()->stop_touch(); +} diff --git a/gtk2_ardour/automation_controller.h b/gtk2_ardour/automation_controller.h new file mode 100644 index 0000000000..042f4a3b96 --- /dev/null +++ b/gtk2_ardour/automation_controller.h @@ -0,0 +1,62 @@ +/* + Copyright (C) 2007 Paul Davis + Author: Dave Robillard + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __ardour_gtk_automation_controller_h__ +#define __ardour_gtk_automation_controller_h__ + +#include <boost/shared_ptr.hpp> +#include <gtkmm.h> +#include <gtkmm2ext/barcontroller.h> + +namespace ARDOUR { + class Session; + class AutomationList; + class AutomationControl; +} + + +class AutomationController : public Gtkmm2ext::BarController { +public: + static boost::shared_ptr<AutomationController> create( + ARDOUR::Session& s, + boost::shared_ptr<ARDOUR::AutomationList> al, + boost::shared_ptr<ARDOUR::AutomationControl> ac); + + ~AutomationController(); + + boost::shared_ptr<ARDOUR::AutomationControl> controllable() { return _controllable; } + + void update_label(char* label, int label_len); + void display_effective_value(); + void value_adjusted(); + +private: + AutomationController(boost::shared_ptr<ARDOUR::AutomationControl> ac, Gtk::Adjustment* adj); + void start_touch(); + void end_touch(); + + bool _ignore_change; + boost::shared_ptr<ARDOUR::AutomationControl> _controllable; + Gtk::Adjustment* _adjustment; + sigc::connection _screen_update_connection; +}; + + +#endif /* __ardour_gtk_automation_controller_h__ */ diff --git a/gtk2_ardour/automation_gain_line.cc b/gtk2_ardour/automation_gain_line.cc index 84488dc2b5..0480016ca2 100644 --- a/gtk2_ardour/automation_gain_line.cc +++ b/gtk2_ardour/automation_gain_line.cc @@ -30,7 +30,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -AutomationGainLine::AutomationGainLine (const string & name, TimeAxisView& tv, ArdourCanvas::Group& parent, AutomationList& l) +AutomationGainLine::AutomationGainLine (const string & name, TimeAxisView& tv, ArdourCanvas::Group& parent, boost::shared_ptr<AutomationList> l) : AutomationLine (name, tv, parent, l) { diff --git a/gtk2_ardour/automation_gain_line.h b/gtk2_ardour/automation_gain_line.h index fe8c9274f2..a5ddafdd57 100644 --- a/gtk2_ardour/automation_gain_line.h +++ b/gtk2_ardour/automation_gain_line.h @@ -30,7 +30,7 @@ class TimeAxisView; class AutomationGainLine : public AutomationLine { public: - AutomationGainLine (const string & name, TimeAxisView&, ArdourCanvas::Group& parent, ARDOUR::AutomationList&); + AutomationGainLine (const string & name, TimeAxisView&, ArdourCanvas::Group& parent, boost::shared_ptr<ARDOUR::AutomationList>); void view_to_model_y (double&); void model_to_view_y (double&); diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 683a767935..f6b54cd128 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -57,7 +57,7 @@ using namespace Gnome; // for Canvas ControlPoint::ControlPoint (AutomationLine& al) : line (al) { - model = al.the_list().end(); + model = al.the_list()->end(); view_index = 0; can_slide = true; _x = 0; @@ -220,7 +220,7 @@ ControlPoint::move_to (double x, double y, ShapeType shape) /*****/ -AutomationLine::AutomationLine (const string & name, TimeAxisView& tv, ArdourCanvas::Group& parent, AutomationList& al) +AutomationLine::AutomationLine (const string & name, TimeAxisView& tv, ArdourCanvas::Group& parent, boost::shared_ptr<AutomationList> al) : trackview (tv), _name (name), alist (al), @@ -245,10 +245,9 @@ AutomationLine::AutomationLine (const string & name, TimeAxisView& tv, ArdourCan line->signal_event().connect (mem_fun (*this, &AutomationLine::event_handler)); - alist.StateChanged.connect (mem_fun(*this, &AutomationLine::list_changed)); - - trackview.session().register_with_memento_command_factory(alist.id(), this); + alist->StateChanged.connect (mem_fun(*this, &AutomationLine::list_changed)); + trackview.session().register_with_memento_command_factory(alist->id(), this); } AutomationLine::~AutomationLine () @@ -612,7 +611,7 @@ AutomationLine::determine_visible_control_points (ALPoints& points) view_index = 0; - for (model = alist.begin(), pi = 0; pi < npoints; ++model, ++pi) { + for (model = alist->begin(), pi = 0; pi < npoints; ++model, ++pi) { double tx = points[pi].x; double ty = points[pi].y; @@ -808,7 +807,7 @@ AutomationLine::start_drag (ControlPoint* cp, nframes_t x, float fraction) } trackview.editor.current_session()->begin_reversible_command (str); - trackview.editor.current_session()->add_command (new MementoCommand<AutomationList>(alist, &get_state(), 0)); + trackview.editor.current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &get_state(), 0)); drag_x = x; drag_distance = 0; @@ -872,7 +871,7 @@ AutomationLine::end_drag (ControlPoint* cp) return; } - alist.freeze (); + alist->freeze (); if (cp) { sync_model_with_view_point (*cp, did_push, drag_distance); @@ -880,11 +879,11 @@ AutomationLine::end_drag (ControlPoint* cp) sync_model_with_view_line (line_drag_cp1, line_drag_cp2); } - alist.thaw (); + alist->thaw (); update_pending = false; - trackview.editor.current_session()->add_command (new MementoCommand<AutomationList>(alist, 0, &alist.get_state())); + trackview.editor.current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), 0, &alist->get_state())); trackview.editor.current_session()->commit_reversible_command (); trackview.editor.current_session()->set_dirty (); } @@ -919,14 +918,14 @@ AutomationLine::sync_model_with_view_point (ControlPoint& cp, bool did_push, int /* interpolate */ if (y_delta || x_delta) { - alist.modify (i, (*i)->when + x_delta, mr.ymin + y_delta); + alist->modify (i, (*i)->when + x_delta, mr.ymin + y_delta); } } /* change the primary point */ update_pending = true; - alist.modify (cp.model, mr.xval, mr.yval); + alist->modify (cp.model, mr.xval, mr.yval); /* change later points */ @@ -942,7 +941,7 @@ AutomationLine::sync_model_with_view_point (ControlPoint& cp, bool did_push, int /* all later points move by the same distance along the x-axis as the main point */ if (delta) { - alist.modify (i, (*i)->when + distance, (*i)->value + delta); + alist->modify (i, (*i)->when + distance, (*i)->value + delta); } ++i; @@ -954,7 +953,7 @@ AutomationLine::sync_model_with_view_point (ControlPoint& cp, bool did_push, int as the main point moved. */ - alist.slide (mr.end, drag_distance); + alist->slide (mr.end, drag_distance); } } @@ -998,7 +997,7 @@ AutomationLine::is_last_point (ControlPoint& cp) // If the list is not empty, and the point is the last point in the list - if (!alist.empty() && mr.end == alist.end()) { + if (!alist->empty() && mr.end == alist->end()) { return true; } @@ -1014,7 +1013,7 @@ AutomationLine::is_first_point (ControlPoint& cp) // If the list is not empty, and the point is the first point in the list - if (!alist.empty() && mr.start == alist.begin()) { + if (!alist->empty() && mr.start == alist->begin()) { return true; } @@ -1030,11 +1029,12 @@ AutomationLine::remove_point (ControlPoint& cp) model_representation (cp, mr); trackview.editor.current_session()->begin_reversible_command (_("remove control point")); - XMLNode &before = alist.get_state(); + XMLNode &before = alist->get_state(); - alist.erase (mr.start, mr.end); + alist->erase (mr.start, mr.end); - trackview.editor.current_session()->add_command(new MementoCommand<AutomationList>(alist, &before, &alist.get_state())); + trackview.editor.current_session()->add_command(new MementoCommand<AutomationList>( + *alist.get(), &before, &alist->get_state())); trackview.editor.current_session()->commit_reversible_command (); trackview.editor.current_session()->set_dirty (); } @@ -1229,7 +1229,7 @@ AutomationLine::reset () return; } - alist.apply_to_points (*this, &AutomationLine::reset_callback); + alist->apply_to_points (*this, &AutomationLine::reset_callback); } void @@ -1237,7 +1237,7 @@ AutomationLine::clear () { /* parent must create command */ XMLNode &before = get_state(); - alist.clear(); + alist->clear(); trackview.editor.current_session()->add_command (new MementoCommand<AutomationLine>(*this, &before, &get_state())); trackview.editor.current_session()->commit_reversible_command (); trackview.editor.current_session()->set_dirty (); @@ -1251,7 +1251,7 @@ AutomationLine::change_model (AutomationList::iterator i, double x, double y) void AutomationLine::change_model_range (AutomationList::iterator start, AutomationList::iterator end, double xdelta, float ydelta) { - alist.move_range (start, end, xdelta, ydelta); + alist->move_range (start, end, xdelta, ydelta); } void @@ -1281,12 +1281,12 @@ XMLNode & AutomationLine::get_state (void) { /* function as a proxy for the model */ - return alist.get_state(); + return alist->get_state(); } int AutomationLine::set_state (const XMLNode &node) { /* function as a proxy for the model */ - return alist.set_state (node); + return alist->set_state (node); } diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index 41034dbf6e..a915966d97 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -98,7 +98,7 @@ class ControlPoint class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoingAway { public: - AutomationLine (const string & name, TimeAxisView&, ArdourCanvas::Group&, ARDOUR::AutomationList&); + AutomationLine (const string & name, TimeAxisView&, ArdourCanvas::Group&, boost::shared_ptr<ARDOUR::AutomationList>); virtual ~AutomationLine (); void queue_reset (); @@ -150,7 +150,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin virtual void view_to_model_y (double&) = 0; virtual void model_to_view_y (double&) = 0; - ARDOUR::AutomationList& the_list() const { return alist; } + boost::shared_ptr<ARDOUR::AutomationList> the_list() const { return alist; } void show_all_control_points (); void hide_all_but_selected_control_points (); @@ -168,7 +168,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin guint32 _y_position; guint32 _height; uint32_t _line_color; - ARDOUR::AutomationList& alist; + boost::shared_ptr<ARDOUR::AutomationList> alist; bool _visible : 1; bool _vc_uses_gain_mapping : 1; diff --git a/gtk2_ardour/automation_midi_cc_line.cc b/gtk2_ardour/automation_midi_cc_line.cc index 4a074ddbe9..9bfef278e1 100644 --- a/gtk2_ardour/automation_midi_cc_line.cc +++ b/gtk2_ardour/automation_midi_cc_line.cc @@ -27,7 +27,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -AutomationMidiCCLine::AutomationMidiCCLine (const string & name, TimeAxisView& tv, ArdourCanvas::Group& parent, AutomationList& l) +AutomationMidiCCLine::AutomationMidiCCLine (const string & name, TimeAxisView& tv, ArdourCanvas::Group& parent, boost::shared_ptr<AutomationList> l) : AutomationLine (name, tv, parent, l) { diff --git a/gtk2_ardour/automation_midi_cc_line.h b/gtk2_ardour/automation_midi_cc_line.h index 6ac078a911..82a5e0f816 100644 --- a/gtk2_ardour/automation_midi_cc_line.h +++ b/gtk2_ardour/automation_midi_cc_line.h @@ -30,7 +30,7 @@ class TimeAxisView; class AutomationMidiCCLine : public AutomationLine { public: - AutomationMidiCCLine (const string & name, TimeAxisView&, ArdourCanvas::Group& parent, ARDOUR::AutomationList&); + AutomationMidiCCLine (const string & name, TimeAxisView&, ArdourCanvas::Group& parent, boost::shared_ptr<ARDOUR::AutomationList>); void view_to_model_y (double&); void model_to_view_y (double&); diff --git a/gtk2_ardour/automation_pan_line.cc b/gtk2_ardour/automation_pan_line.cc index 0e36f4ef88..02c9fe2c49 100644 --- a/gtk2_ardour/automation_pan_line.cc +++ b/gtk2_ardour/automation_pan_line.cc @@ -30,7 +30,7 @@ using namespace ARDOUR; using namespace PBD; -AutomationPanLine::AutomationPanLine (const string & name, TimeAxisView& tv, ArdourCanvas::Group& parent, AutomationList& l) +AutomationPanLine::AutomationPanLine (const string & name, TimeAxisView& tv, ArdourCanvas::Group& parent, boost::shared_ptr<AutomationList> l) : AutomationLine (name, tv, parent, l) { diff --git a/gtk2_ardour/automation_pan_line.h b/gtk2_ardour/automation_pan_line.h index 6374c535e0..d77efdd8e3 100644 --- a/gtk2_ardour/automation_pan_line.h +++ b/gtk2_ardour/automation_pan_line.h @@ -30,7 +30,7 @@ class TimeAxisView; class AutomationPanLine : public AutomationLine { public: - AutomationPanLine (const string & name, TimeAxisView&, ArdourCanvas::Group& parent, ARDOUR::AutomationList&); + AutomationPanLine (const string & name, TimeAxisView&, ArdourCanvas::Group& parent, boost::shared_ptr<ARDOUR::AutomationList>); void view_to_model_y (double&); void model_to_view_y (double&); diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 04ac1ee076..ffb66e2270 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -17,8 +17,11 @@ */ +#include <utility> #include <ardour/route.h> +#include <ardour/automation_control.h> #include <pbd/memento_command.h> +#include <gtkmm2ext/barcontroller.h> #include "ardour_ui.h" #include "automation_time_axis.h" @@ -38,6 +41,7 @@ using namespace ARDOUR; using namespace PBD; using namespace Gtk; +using namespace Gtkmm2ext; using namespace Editing; Pango::FontDescription AutomationTimeAxisView::name_font; @@ -69,7 +73,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro auto_play_item = 0; ignore_state_request = false; first_call_to_set_height = true; - + base_rect = new SimpleRect(*canvas_display); base_rect->property_x1() = 0.0; base_rect->property_y1() = 0.0; @@ -217,6 +221,17 @@ AutomationTimeAxisView::auto_clicked () automation_menu->popup (1, gtk_get_current_event_time()); } +void +AutomationTimeAxisView::set_automation_state (AutoState state) +{ + if (!ignore_state_request) { + for (Lines::iterator i = lines.begin(); i != lines.end(); ++i) { + route->set_parameter_automation_state ( + i->second->controllable()->list()->param_id(), + state); + } + } +} void AutomationTimeAxisView::automation_state_changed () @@ -228,7 +243,7 @@ AutomationTimeAxisView::automation_state_changed () if (lines.empty()) { state = Off; } else { - state = lines.front()->the_list().automation_state (); + state = lines.front().first->the_list()->automation_state (); } switch (state & (Off|Play|Touch|Write)) { @@ -292,8 +307,8 @@ void AutomationTimeAxisView::clear_clicked () { _session.begin_reversible_command (_("clear automation")); - for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) { - (*i)->clear (); + for (Lines::iterator i = lines.begin(); i != lines.end(); ++i) { + i->first->clear (); } _session.commit_reversible_command (); } @@ -304,7 +319,7 @@ AutomationTimeAxisView::set_height (TrackHeight ht) uint32_t h = height_to_pixels (ht); bool changed = (height != (uint32_t) h); - bool changed_between_small_and_normal = ( (ht == Small || ht == Smaller) ^ (height_style == Small || height_style == Smaller) ); + //bool changed_between_small_and_normal = ( (ht == Small || ht == Smaller) ^ (height_style == Small || height_style == Smaller) ); TimeAxisView* state_parent = get_parent_with_state (); XMLNode* xml_node = state_parent->get_child_xml_node (_state_name); @@ -312,8 +327,8 @@ AutomationTimeAxisView::set_height (TrackHeight ht) TimeAxisView::set_height (ht); base_rect->property_y2() = h; - for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) { - (*i)->set_y_position_and_height (0, h); + for (Lines::iterator i = lines.begin(); i != lines.end(); ++i) { + i->first->set_y_position_and_height (0, h); } for (list<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) { @@ -347,12 +362,20 @@ AutomationTimeAxisView::set_height (TrackHeight ht) break; } - if (changed_between_small_and_normal || first_call_to_set_height) { + //if (changed_between_small_and_normal || first_call_to_set_height) { first_call_to_set_height = false; + unsigned control_cnt = 0; switch (ht) { case Largest: case Large: case Larger: + + for (Lines::iterator i = lines.begin(); i != lines.end(); ++i) { + i->second->show (); + controls_table.attach (*i->second.get(), 0, 8, 2 + control_cnt, 3 + control_cnt, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND); + ++control_cnt; + } + case Normal: controls_table.remove (name_hbox); @@ -400,7 +423,7 @@ AutomationTimeAxisView::set_height (TrackHeight ht) hide_button.hide(); break; } - } + //} if (changed) { /* only emit the signal if the height really changed */ @@ -413,8 +436,8 @@ AutomationTimeAxisView::set_samples_per_unit (double spu) { TimeAxisView::set_samples_per_unit (editor.get_current_zoom()); - for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) { - (*i)->reset (); + for (Lines::iterator i = lines.begin(); i != lines.end(); ++i) { + i->first->reset (); } } @@ -486,8 +509,8 @@ AutomationTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op) { bool ret = false; - for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) { - ret = cut_copy_clear_one ((**i), selection, op); + for (Lines::iterator i = lines.begin(); i != lines.end(); ++i) { + ret = cut_copy_clear_one (*i->first, selection, op); } return ret; @@ -497,28 +520,28 @@ bool AutomationTimeAxisView::cut_copy_clear_one (AutomationLine& line, Selection& selection, CutCopyOp op) { AutomationList* what_we_got = 0; - AutomationList& alist (line.the_list()); + boost::shared_ptr<AutomationList> alist (line.the_list()); bool ret = false; - XMLNode &before = alist.get_state(); + XMLNode &before = alist->get_state(); switch (op) { case Cut: - if ((what_we_got = alist.cut (selection.time.front().start, selection.time.front().end)) != 0) { + if ((what_we_got = alist->cut (selection.time.front().start, selection.time.front().end)) != 0) { editor.get_cut_buffer().add (what_we_got); - _session.add_command(new MementoCommand<AutomationList>(alist, &before, &alist.get_state())); + _session.add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state())); ret = true; } break; case Copy: - if ((what_we_got = alist.copy (selection.time.front().start, selection.time.front().end)) != 0) { + if ((what_we_got = alist->copy (selection.time.front().start, selection.time.front().end)) != 0) { editor.get_cut_buffer().add (what_we_got); } break; case Clear: - if ((what_we_got = alist.cut (selection.time.front().start, selection.time.front().end)) != 0) { - _session.add_command(new MementoCommand<AutomationList>(alist, &before, &alist.get_state())); + if ((what_we_got = alist->cut (selection.time.front().start, selection.time.front().end)) != 0) { + _session.add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state())); delete what_we_got; what_we_got = 0; ret = true; @@ -540,17 +563,17 @@ AutomationTimeAxisView::cut_copy_clear_one (AutomationLine& line, Selection& sel void AutomationTimeAxisView::reset_objects (PointSelection& selection) { - for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) { - reset_objects_one ((**i), selection); + for (Lines::iterator i = lines.begin(); i != lines.end(); ++i) { + reset_objects_one (*i->first, selection); } } void AutomationTimeAxisView::reset_objects_one (AutomationLine& line, PointSelection& selection) { - AutomationList& alist (line.the_list()); + boost::shared_ptr<AutomationList> alist(line.the_list()); - _session.add_command (new MementoCommand<AutomationList>(alist, &alist.get_state(), 0)); + _session.add_command (new MementoCommand<AutomationList>(*alist.get(), &alist->get_state(), 0)); for (PointSelection::iterator i = selection.begin(); i != selection.end(); ++i) { @@ -558,7 +581,7 @@ AutomationTimeAxisView::reset_objects_one (AutomationLine& line, PointSelection& continue; } - alist.reset_range ((*i).start, (*i).end); + alist->reset_range ((*i).start, (*i).end); } } @@ -567,8 +590,8 @@ AutomationTimeAxisView::cut_copy_clear_objects (PointSelection& selection, CutCo { bool ret = false; - for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) { - ret = cut_copy_clear_objects_one ((**i), selection, op); + for (Lines::iterator i = lines.begin(); i != lines.end(); ++i) { + ret = cut_copy_clear_objects_one (*i->first, selection, op); } return ret; @@ -578,10 +601,10 @@ bool AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointSelection& selection, CutCopyOp op) { AutomationList* what_we_got = 0; - AutomationList& alist (line.the_list()); + boost::shared_ptr<AutomationList> alist(line.the_list()); bool ret = false; - XMLNode &before = alist.get_state(); + XMLNode &before = alist->get_state(); for (PointSelection::iterator i = selection.begin(); i != selection.end(); ++i) { @@ -591,21 +614,21 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS switch (op) { case Cut: - if ((what_we_got = alist.cut ((*i).start, (*i).end)) != 0) { + if ((what_we_got = alist->cut ((*i).start, (*i).end)) != 0) { editor.get_cut_buffer().add (what_we_got); - _session.add_command (new MementoCommand<AutomationList>(alist, new XMLNode (before), &alist.get_state())); + _session.add_command (new MementoCommand<AutomationList>(*alist.get(), new XMLNode (before), &alist->get_state())); ret = true; } break; case Copy: - if ((what_we_got = alist.copy ((*i).start, (*i).end)) != 0) { + if ((what_we_got = alist->copy ((*i).start, (*i).end)) != 0) { editor.get_cut_buffer().add (what_we_got); } break; case Clear: - if ((what_we_got = alist.cut ((*i).start, (*i).end)) != 0) { - _session.add_command (new MementoCommand<AutomationList>(alist, new XMLNode (before), &alist.get_state())); + if ((what_we_got = alist->cut ((*i).start, (*i).end)) != 0) { + _session.add_command (new MementoCommand<AutomationList>(*alist.get(), new XMLNode (before), &alist->get_state())); delete what_we_got; what_we_got = 0; ret = true; @@ -632,8 +655,8 @@ AutomationTimeAxisView::paste (nframes_t pos, float times, Selection& selection, { bool ret = true; - for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) { - ret = paste_one (**i, pos, times, selection, nth); + for (Lines::iterator i = lines.begin(); i != lines.end(); ++i) { + ret = paste_one (*i->first, pos, times, selection, nth); } return ret; @@ -643,7 +666,7 @@ bool AutomationTimeAxisView::paste_one (AutomationLine& line, nframes_t pos, float times, Selection& selection, size_t nth) { AutomationSelection::iterator p; - AutomationList& alist (line.the_list()); + boost::shared_ptr<AutomationList> alist(line.the_list()); for (p = selection.lines.begin(); p != selection.lines.end() && nth; ++p, --nth); @@ -664,9 +687,9 @@ AutomationTimeAxisView::paste_one (AutomationLine& line, nframes_t pos, float ti (*x)->value = foo; } - XMLNode &before = alist.get_state(); - alist.paste (copy, pos, times); - _session.add_command (new MementoCommand<AutomationList>(alist, &before, &alist.get_state())); + XMLNode &before = alist->get_state(); + alist->paste (copy, pos, times); + _session.add_command (new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state())); return true; } @@ -725,8 +748,8 @@ AutomationTimeAxisView::get_selectables (nframes_t start, nframes_t end, double botfrac = 1.0 - ((bot - y_position) / height); } - for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) { - (*i)->get_selectables (start, end, botfrac, topfrac, results); + for (Lines::iterator i = lines.begin(); i != lines.end(); ++i) { + i->first->get_selectables (start, end, botfrac, topfrac, results); } } } @@ -734,25 +757,24 @@ AutomationTimeAxisView::get_selectables (nframes_t start, nframes_t end, double void AutomationTimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>& result) { - for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) { - (*i)->get_inverted_selectables (sel, result); + for (Lines::iterator i = lines.begin(); i != lines.end(); ++i) { + i->first->get_inverted_selectables (sel, result); } } void AutomationTimeAxisView::set_selected_points (PointSelection& points) { - for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) { - (*i)->set_selected_points (points); + for (Lines::iterator i = lines.begin(); i != lines.end(); ++i) { + i->first->set_selected_points (points); } } void AutomationTimeAxisView::clear_lines () { - for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) { - delete *i; - } + for (Lines::iterator i = lines.begin(); i != lines.end(); ++i) + delete i->first; lines.clear (); automation_connection.disconnect (); @@ -765,33 +787,38 @@ AutomationTimeAxisView::add_line (AutomationLine& line) if (lines.empty()) { /* first line is the Model for automation state */ - automation_connection = line.the_list().automation_state_changed.connect + automation_connection = line.the_list()->automation_state_changed.connect (mem_fun(*this, &AutomationTimeAxisView::automation_state_changed)); get = true; } - lines.push_back (&line); + lines.push_back (std::make_pair(&line, + AutomationController::create(_session, line.the_list(), + route->control(line.the_list()->param_id())))); + line.set_y_position_and_height (0, height); if (get) { /* pick up the current state */ automation_state_changed (); } + + line.show(); } void AutomationTimeAxisView::show_all_control_points () { - for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) { - (*i)->show_all_control_points (); + for (Lines::iterator i = lines.begin(); i != lines.end(); ++i) { + i->first->show_all_control_points (); } } void AutomationTimeAxisView::hide_all_but_selected_control_points () { - for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) { - (*i)->hide_all_but_selected_control_points (); + for (Lines::iterator i = lines.begin(); i != lines.end(); ++i) { + i->first->hide_all_but_selected_control_points (); } } @@ -808,36 +835,23 @@ AutomationTimeAxisView::exited () } void -AutomationTimeAxisView::set_colors () { - - for( list<GhostRegion *>::iterator i=ghosts.begin(); i != ghosts.end(); i++ ) { - (*i)->set_colors(); +AutomationTimeAxisView::set_colors () +{ + for (list<GhostRegion*>::iterator i=ghosts.begin(); i != ghosts.end(); i++ ) { + (*i)->set_colors(); } - for( vector<AutomationLine *>::iterator i=lines.begin(); i != lines.end(); i++ ) { - (*i)->set_colors(); + for (Lines::iterator i=lines.begin(); i != lines.end(); i++ ) { + i->first->set_colors(); } - } void AutomationTimeAxisView::color_handler () { - - //case cGhostTrackWave: - //case cGhostTrackWaveClip: - //case cGhostTrackZeroLine: - - //case cControlPoint: - //case cControlPointFill: - //case cControlPointOutline: - //case cAutomationLine: set_colors (); - } - - void AutomationTimeAxisView::set_state (const XMLNode& node) { diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h index e302e14ebb..b88c21d68d 100644 --- a/gtk2_ardour/automation_time_axis.h +++ b/gtk2_ardour/automation_time_axis.h @@ -23,6 +23,7 @@ #include <vector> #include <list> #include <string> +#include <utility> #include <boost/shared_ptr.hpp> @@ -31,6 +32,7 @@ #include "canvas.h" #include "time_axis_view.h" #include "simplerect.h" +#include "automation_controller.h" using std::vector; using std::list; @@ -50,6 +52,8 @@ class GhostRegion; class Selection; class Selectable; +/** TODO: All the derived types of this can probably be merged into this cleanly. + */ class AutomationTimeAxisView : public TimeAxisView { public: AutomationTimeAxisView (ARDOUR::Session&, @@ -72,7 +76,8 @@ class AutomationTimeAxisView : public TimeAxisView { virtual void clear_lines (); virtual void add_line (AutomationLine&); - vector<AutomationLine*> lines; + typedef vector<std::pair<AutomationLine*,boost::shared_ptr<AutomationController> > > Lines; + Lines lines; void set_selected_points (PointSelection&); void get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable *>&); @@ -102,6 +107,7 @@ class AutomationTimeAxisView : public TimeAxisView { string _name; string _state_name; bool in_destructor; + bool ignore_toggle; bool first_call_to_set_height; @@ -132,7 +138,7 @@ class AutomationTimeAxisView : public TimeAxisView { bool paste_one (AutomationLine&, nframes_t, float times, Selection&, size_t nth); void reset_objects_one (AutomationLine&, PointSelection&); - virtual void set_automation_state (ARDOUR::AutoState) = 0; + void set_automation_state (ARDOUR::AutoState); bool ignore_state_request; void automation_state_changed (); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 61250c1289..520db57eb4 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -1163,7 +1163,7 @@ Editor::connect_to_session (Session *t) RouteTimeAxisView *rtv; if ((rtv = dynamic_cast<RouteTimeAxisView*>(tv)) != 0) { - if (rtv->route()->master()) { + if (rtv->route()->is_master()) { route_list_display.get_selection()->unselect (i); } } diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index f6f4d3bf0b..bcbb806b79 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -1676,7 +1676,7 @@ Editor::start_fade_in_grab (ArdourCanvas::Item* item, GdkEvent* event) AudioRegionView* arv = static_cast<AudioRegionView*>(drag_info.data); - drag_info.pointer_frame_offset = drag_info.grab_frame - ((nframes_t) arv->audio_region()->fade_in().back()->when + arv->region()->position()); + drag_info.pointer_frame_offset = drag_info.grab_frame - ((nframes_t) arv->audio_region()->fade_in()->back()->when + arv->region()->position()); } void @@ -1755,13 +1755,13 @@ Editor::fade_in_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* even continue; } - AutomationList& alist = tmp->audio_region()->fade_in(); - XMLNode &before = alist.get_state(); + boost::shared_ptr<AutomationList> alist = tmp->audio_region()->fade_in(); + XMLNode &before = alist->get_state(); tmp->audio_region()->set_fade_in_length (fade_length); - XMLNode &after = alist.get_state(); - session->add_command(new MementoCommand<AutomationList>(alist, &before, &after)); + XMLNode &after = alist->get_state(); + session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after)); } commit_reversible_command (); @@ -1783,7 +1783,7 @@ Editor::start_fade_out_grab (ArdourCanvas::Item* item, GdkEvent* event) AudioRegionView* arv = static_cast<AudioRegionView*>(drag_info.data); - drag_info.pointer_frame_offset = drag_info.grab_frame - (arv->region()->length() - (nframes_t) arv->audio_region()->fade_out().back()->when + arv->region()->position()); + drag_info.pointer_frame_offset = drag_info.grab_frame - (arv->region()->length() - (nframes_t) arv->audio_region()->fade_out()->back()->when + arv->region()->position()); } void @@ -1871,13 +1871,13 @@ Editor::fade_out_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* eve continue; } - AutomationList& alist = tmp->audio_region()->fade_out(); - XMLNode &before = alist.get_state(); + boost::shared_ptr<AutomationList> alist = tmp->audio_region()->fade_out(); + XMLNode &before = alist->get_state(); tmp->audio_region()->set_fade_out_length (fade_length); - XMLNode &after = alist.get_state(); - session->add_command(new MementoCommand<AutomationList>(alist, &before, &after)); + XMLNode &after = alist->get_state(); + session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after)); } commit_reversible_command (); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 843e0e3add..ccfcdbd6c5 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -3392,11 +3392,11 @@ Editor::reset_region_gain_envelopes () for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) { AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i); if (arv) { - AutomationList& alist (arv->audio_region()->envelope()); - XMLNode& before (alist.get_state()); + boost::shared_ptr<AutomationList> alist (arv->audio_region()->envelope()); + XMLNode& before (alist->get_state()); arv->audio_region()->set_default_envelope (); - session->add_command (new MementoCommand<AutomationList>(arv->audio_region()->envelope(), &before, &alist.get_state())); + session->add_command (new MementoCommand<AutomationList>(*arv->audio_region()->envelope().get(), &before, &alist->get_state())); } } @@ -3485,13 +3485,13 @@ Editor::set_fade_in_shape (AudioRegion::FadeShape shape) return; } - AutomationList& alist = tmp->audio_region()->fade_in(); - XMLNode &before = alist.get_state(); + boost::shared_ptr<AutomationList> alist = tmp->audio_region()->fade_in(); + XMLNode &before = alist->get_state(); tmp->audio_region()->set_fade_in_shape (shape); - XMLNode &after = alist.get_state(); - session->add_command(new MementoCommand<AutomationList>(alist, &before, &after)); + XMLNode &after = alist->get_state(); + session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after)); } commit_reversible_command (); @@ -3509,13 +3509,13 @@ Editor::set_fade_out_shape (AudioRegion::FadeShape shape) return; } - AutomationList& alist = tmp->audio_region()->fade_out(); - XMLNode &before = alist.get_state(); + boost::shared_ptr<AutomationList> alist = tmp->audio_region()->fade_out(); + XMLNode &before = alist->get_state(); tmp->audio_region()->set_fade_out_shape (shape); - XMLNode &after = alist.get_state(); - session->add_command(new MementoCommand<AutomationList>(alist, &before, &after)); + XMLNode &after = alist->get_state(); + session->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after)); } commit_reversible_command (); diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc index 04ef8b46b0..e11738f65b 100644 --- a/gtk2_ardour/editor_route_list.cc +++ b/gtk2_ardour/editor_route_list.cc @@ -56,7 +56,7 @@ Editor::handle_new_route (Session::RouteList& routes) for (Session::RouteList::iterator x = routes.begin(); x != routes.end(); ++x) { boost::shared_ptr<Route> route = (*x); - if (route->hidden()) { + if (route->is_hidden()) { continue; } diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc index 2d73887d3a..2cf96fe02a 100644 --- a/gtk2_ardour/export_dialog.cc +++ b/gtk2_ardour/export_dialog.cc @@ -1089,7 +1089,7 @@ ExportDialog::fill_lists () boost::shared_ptr<Route> route = (*ri); - if (route->hidden()) { + if (route->is_hidden()) { continue; } diff --git a/gtk2_ardour/gain_automation_time_axis.cc b/gtk2_ardour/gain_automation_time_axis.cc index 509c941555..0daec3b250 100644 --- a/gtk2_ardour/gain_automation_time_axis.cc +++ b/gtk2_ardour/gain_automation_time_axis.cc @@ -33,12 +33,12 @@ using namespace Gtk; GainAutomationTimeAxisView::GainAutomationTimeAxisView (Session& s, boost::shared_ptr<Route> r, PublicEditor& e, TimeAxisView& parent, - ArdourCanvas::Canvas& canvas, const string & n, ARDOUR::AutomationList& l) + ArdourCanvas::Canvas& canvas, const string & n, + boost::shared_ptr<ARDOUR::AutomationControl> c) : AxisView (s), AutomationTimeAxisView (s, r, e, parent, canvas, n, X_("gain"), ""), - list (l) - + _control (c) { } @@ -59,20 +59,13 @@ GainAutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* item, GdkE /* map using line */ - lines.front()->view_to_model_y (y); + lines.front().first->view_to_model_y (y); _session.begin_reversible_command (_("add gain automation event")); - XMLNode& before = list.get_state(); - list.add (when, y); - XMLNode& after = list.get_state(); - _session.commit_reversible_command (new MementoCommand<ARDOUR::AutomationList>(list, &before, &after)); + XMLNode& before = _control->list()->get_state(); + _control->list()->add (when, y); + XMLNode& after = _control->list()->get_state(); + _session.commit_reversible_command (new MementoCommand<ARDOUR::AutomationList>(*_control->list(), &before, &after)); _session.set_dirty (); } -void -GainAutomationTimeAxisView::set_automation_state (AutoState state) -{ - if (!ignore_state_request) { - route->set_parameter_automation_state (ParamID(GainAutomation), state); - } -} diff --git a/gtk2_ardour/gain_automation_time_axis.h b/gtk2_ardour/gain_automation_time_axis.h index 3f07be4ace..f4132acb20 100644 --- a/gtk2_ardour/gain_automation_time_axis.h +++ b/gtk2_ardour/gain_automation_time_axis.h @@ -25,6 +25,7 @@ namespace ARDOUR { class AutomationList; + class AutomationControl; } class GainAutomationTimeAxisView : public AutomationTimeAxisView @@ -36,17 +37,16 @@ class GainAutomationTimeAxisView : public AutomationTimeAxisView TimeAxisView& parent_axis, ArdourCanvas::Canvas& canvas, const string & name, - ARDOUR::AutomationList&); + boost::shared_ptr<ARDOUR::AutomationControl> control); ~GainAutomationTimeAxisView(); void add_automation_event (ArdourCanvas::Item *item, GdkEvent *event, nframes_t, double); private: - ARDOUR::AutomationList& list; + boost::shared_ptr<ARDOUR::AutomationControl> _control; void automation_changed (); - void set_automation_state (ARDOUR::AutoState); }; #endif /* __ardour_gtk_gain_automation_time_axis_h__ */ diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc index a4eea61bfa..d365066774 100644 --- a/gtk2_ardour/gain_meter.cc +++ b/gtk2_ardour/gain_meter.cc @@ -91,7 +91,7 @@ GainMeter::GainMeter (boost::shared_ptr<IO> io, Session& s) gain_slider = manage (new VSliderController (slider, &gain_adjustment, - _io->gain_control(), + *_io->gain_control().get(), false)); gain_slider->signal_button_press_event().connect (mem_fun(*this, &GainMeter::start_gain_touch)); @@ -154,12 +154,12 @@ GainMeter::GainMeter (boost::shared_ptr<IO> io, Session& s) if ((r = dynamic_cast<Route*> (_io.get())) != 0) { - /* + /* if we have a route (ie. we're not the click), pack some route-dependent stuff. */ - gain_display_box.pack_end (peak_display, true, true); + gain_display_box.pack_end (peak_display, true, true); hbox.pack_end (meter_packer, true, true); @@ -187,8 +187,8 @@ GainMeter::GainMeter (boost::shared_ptr<IO> io, Session& s) gain_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &GainMeter::gain_automation_style_button_event), false); gain_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &GainMeter::gain_automation_state_button_event), false); - r->gain_automation().automation_state_changed.connect (mem_fun(*this, &GainMeter::gain_automation_state_changed)); - r->gain_automation().automation_style_changed.connect (mem_fun(*this, &GainMeter::gain_automation_style_changed)); + r->gain_control()->list()->automation_state_changed.connect (mem_fun(*this, &GainMeter::gain_automation_state_changed)); + r->gain_control()->list()->automation_style_changed.connect (mem_fun(*this, &GainMeter::gain_automation_style_changed)); fader_vbox->pack_start (gain_automation_state_button, false, false, 0); gain_automation_state_changed (); @@ -199,7 +199,7 @@ GainMeter::GainMeter (boost::shared_ptr<IO> io, Session& s) pack_start (gain_display_box, Gtk::PACK_SHRINK); pack_start (hbox, Gtk::PACK_SHRINK); - _io->gain_changed.connect (mem_fun(*this, &GainMeter::gain_changed)); + _io->gain_control()->Changed.connect (mem_fun(*this, &GainMeter::gain_changed)); meter_metric_area.signal_expose_event().connect (mem_fun(*this, &GainMeter::meter_metrics_expose)); gain_adjustment.signal_value_changed().connect (mem_fun(*this, &GainMeter::gain_adjusted)); @@ -208,7 +208,7 @@ GainMeter::GainMeter (boost::shared_ptr<IO> io, Session& s) Config->ParameterChanged.connect (mem_fun (*this, &GainMeter::parameter_changed)); - gain_changed (0); + gain_changed (); show_gain (); update_gain_sensitive (); @@ -606,7 +606,7 @@ GainMeter::gain_activated () f = min (f, 6.0f); - _io->set_gain (dB_to_coefficient(f), this); + _io->gain_control()->set_value (dB_to_coefficient(f)); if (gain_display.has_focus()) { PublicEditor::instance().reset_focus(); @@ -634,7 +634,7 @@ void GainMeter::gain_adjusted () { if (!ignore_toggle) { - _io->set_gain (slider_position_to_gain (gain_adjustment.get_value()), this); + _io->gain_control()->set_value (slider_position_to_gain (gain_adjustment.get_value())); } show_gain (); } @@ -652,7 +652,7 @@ GainMeter::effective_gain_display () } void -GainMeter::gain_changed (void *src) +GainMeter::gain_changed () { Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &GainMeter::effective_gain_display)); } @@ -672,7 +672,7 @@ GainMeter::set_fader_name (const char * name) void GainMeter::update_gain_sensitive () { - static_cast<Gtkmm2ext::SliderController*>(gain_slider)->set_sensitive (!(_io->gain_automation().automation_state() & Play)); + static_cast<Gtkmm2ext::SliderController*>(gain_slider)->set_sensitive (!(_io->gain_control()->list()->automation_state() & Play)); } @@ -815,14 +815,14 @@ GainMeter::meter_point_clicked () gint GainMeter::start_gain_touch (GdkEventButton* ev) { - _io->gain_automation().start_touch (); + _io->gain_control()->list()->start_touch (); return FALSE; } gint GainMeter::end_gain_touch (GdkEventButton* ev) { - _io->gain_automation().stop_touch (); + _io->gain_control()->list()->stop_touch (); return FALSE; } @@ -926,10 +926,10 @@ GainMeter::gain_automation_style_changed () // Route* _route = dynamic_cast<Route*>(&_io); switch (_width) { case Wide: - gain_automation_style_button.set_label (astyle_string(_io->gain_automation().automation_style())); + gain_automation_style_button.set_label (astyle_string(_io->gain_control()->list()->automation_style())); break; case Narrow: - gain_automation_style_button.set_label (short_astyle_string(_io->gain_automation().automation_style())); + gain_automation_style_button.set_label (short_astyle_string(_io->gain_control()->list()->automation_style())); break; } } @@ -944,14 +944,14 @@ GainMeter::gain_automation_state_changed () switch (_width) { case Wide: - gain_automation_state_button.set_label (astate_string(_io->gain_automation().automation_state())); + gain_automation_state_button.set_label (astate_string(_io->gain_control()->list()->automation_state())); break; case Narrow: - gain_automation_state_button.set_label (short_astate_string(_io->gain_automation().automation_state())); + gain_automation_state_button.set_label (short_astate_string(_io->gain_control()->list()->automation_state())); break; } - x = (_io->gain_automation().automation_state() != Off); + x = (_io->gain_control()->list()->automation_state() != Off); if (gain_automation_state_button.get_active() != x) { ignore_toggle = true; diff --git a/gtk2_ardour/gain_meter.h b/gtk2_ardour/gain_meter.h index 447271ed55..3839221e73 100644 --- a/gtk2_ardour/gain_meter.h +++ b/gtk2_ardour/gain_meter.h @@ -149,7 +149,7 @@ class GainMeter : public Gtk::VBox Gtk::HBox meter_packer; void gain_adjusted (); - void gain_changed (void *); + void gain_changed (); void meter_point_clicked (); void gain_unit_changed (); diff --git a/gtk2_ardour/ladspa_pluginui.cc b/gtk2_ardour/ladspa_pluginui.cc index 721e50753a..eacc8f024b 100644 --- a/gtk2_ardour/ladspa_pluginui.cc +++ b/gtk2_ardour/ladspa_pluginui.cc @@ -496,7 +496,7 @@ LadspaPluginUI::build_control_ui (guint32 port_index, PBD::Controllable* mcontro automation_state_changed (control_ui); plugin->ParameterChanged.connect (bind (mem_fun(*this, &LadspaPluginUI::parameter_changed), control_ui)); - insert->automation_list (ParamID(PluginAutomation, port_index))->automation_state_changed.connect + insert->control (ParamID(PluginAutomation, port_index))->list()->automation_state_changed.connect (bind (mem_fun(*this, &LadspaPluginUI::automation_state_changed), control_ui)); } else if (plugin->parameter_is_output (port_index)) { @@ -553,13 +553,13 @@ LadspaPluginUI::build_control_ui (guint32 port_index, PBD::Controllable* mcontro void LadspaPluginUI::start_touch (LadspaPluginUI::ControlUI* cui) { - insert->automation_list (ParamID(PluginAutomation, cui->port_index))->start_touch (); + insert->control (ParamID(PluginAutomation, cui->port_index))->list()->start_touch (); } void LadspaPluginUI::stop_touch (LadspaPluginUI::ControlUI* cui) { - insert->automation_list (ParamID(PluginAutomation, cui->port_index))->stop_touch (); + insert->control (ParamID(PluginAutomation, cui->port_index))->list()->stop_touch (); } void diff --git a/gtk2_ardour/midi_controller_time_axis.cc b/gtk2_ardour/midi_controller_time_axis.cc index a3dcb0f508..d25b5e398a 100644 --- a/gtk2_ardour/midi_controller_time_axis.cc +++ b/gtk2_ardour/midi_controller_time_axis.cc @@ -20,6 +20,7 @@ #include <ardour/automation_event.h> #include <ardour/route.h> #include <pbd/memento_command.h> +#include <pbd/controllable.h> #include "midi_controller_time_axis.h" #include "automation_line.h" @@ -34,12 +35,10 @@ using namespace Gtk; MidiControllerTimeAxisView::MidiControllerTimeAxisView (Session& s, boost::shared_ptr<Route> r, PublicEditor& e, TimeAxisView& parent, ArdourCanvas::Canvas& canvas, const string & n, - ParamID param, ARDOUR::AutomationList& l) - + boost::shared_ptr<AutomationControl> c) : AxisView (s), - AutomationTimeAxisView (s, r, e, parent, canvas, n, param.to_string(), ""), - _list (l), - _param (param) + AutomationTimeAxisView (s, r, e, parent, canvas, n, c->list()->param_id().to_string(), ""), + _control (c) { } @@ -60,22 +59,13 @@ MidiControllerTimeAxisView::add_automation_event (ArdourCanvas::Item* item, GdkE /* map using line */ - lines.front()->view_to_model_y (y); + lines.front().first->view_to_model_y (y); _session.begin_reversible_command (_("add midi controller automation event")); - XMLNode& before = _list.get_state(); - _list.add (when, y); - XMLNode& after = _list.get_state(); - _session.commit_reversible_command (new MementoCommand<ARDOUR::AutomationList>(_list, &before, &after)); + XMLNode& before = _control->list()->get_state(); + _control->list()->add (when, y); + XMLNode& after = _control->list()->get_state(); + _session.commit_reversible_command (new MementoCommand<ARDOUR::AutomationList>(*_control->list().get(), &before, &after)); _session.set_dirty (); } -void -MidiControllerTimeAxisView::set_automation_state (AutoState state) -{ - if (!ignore_state_request) { - cerr << "FIXME: set midi controller automation state" << endl; - //route->set_midi_controller_state (state); - } -} - diff --git a/gtk2_ardour/midi_controller_time_axis.h b/gtk2_ardour/midi_controller_time_axis.h index 78f3c12c1a..db14a77ca9 100644 --- a/gtk2_ardour/midi_controller_time_axis.h +++ b/gtk2_ardour/midi_controller_time_axis.h @@ -36,19 +36,16 @@ class MidiControllerTimeAxisView : public AutomationTimeAxisView TimeAxisView& parent_axis, ArdourCanvas::Canvas& canvas, const string & name, - ARDOUR::ParamID param, - ARDOUR::AutomationList&); + boost::shared_ptr<ARDOUR::AutomationControl> c); ~MidiControllerTimeAxisView(); void add_automation_event (ArdourCanvas::Item *item, GdkEvent *event, nframes_t, double); private: - ARDOUR::AutomationList& _list; - ARDOUR::ParamID _param; + boost::shared_ptr<ARDOUR::AutomationControl> _control; void automation_changed (); - void set_automation_state (ARDOUR::AutoState); }; #endif /* __ardour_gtk_midi_controller_time_axis_h__ */ diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 52c9a29f12..8fe5823c78 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -185,12 +185,13 @@ MidiTimeAxisView::create_automation_child (ParamID param) /* FIXME: this all probably leaks */ - ARDOUR::AutomationList* al = _route->automation_list(param); + boost::shared_ptr<AutomationControl> c =_route->control(param); - if (!al) - al = new ARDOUR::AutomationList(param, 0, 127, 64); - - _route->add_automation_parameter(al); + if (!c) { + boost::shared_ptr<AutomationList> al(new ARDOUR::AutomationList(param, 0, 127, 64)); + c = boost::shared_ptr<AutomationControl>(new AutomationControl(_session, al)); + _route->add_control(c); + } MidiControllerTimeAxisView* track = new MidiControllerTimeAxisView (_session, _route, @@ -198,13 +199,12 @@ MidiTimeAxisView::create_automation_child (ParamID param) *this, parent_canvas, _route->describe_parameter(param), - param, - *al); + c); AutomationMidiCCLine* line = new AutomationMidiCCLine (param.to_string(), *track, *track->canvas_display, - *al); + c->list()); line->set_line_color (Config->canvasvar_AutomationLine.get()); diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 40571d3e91..54c3965993 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -261,7 +261,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK); global_vpacker.pack_start (comment_button, Gtk::PACK_SHRINK); - if (route()->master() || route()->control()) { + if (route()->is_master() || route()->is_control()) { if (scrollbar_height == 0) { HScrollbar scrollbar; @@ -403,6 +403,8 @@ MixerStrip::set_width (Width w, void* owner) pre_processor_box.set_width (w); post_processor_box.set_width (w); + boost::shared_ptr<AutomationList> gain_automation = _route->gain_control()->list(); + _width_owner = owner; if (_width == w) { @@ -435,8 +437,8 @@ MixerStrip::set_width (Width w, void* owner) ((Gtk::Label*)comment_button.get_child())->set_text (_("*comments*")); } - ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(_route->gain_automation().automation_style())); - ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(_route->gain_automation().automation_state())); + ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.astyle_string(gain_automation->automation_style())); + ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.astate_string(gain_automation->automation_state())); ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.astyle_string(_route->panner().automation_style())); ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.astate_string(_route->panner().automation_state())); Gtkmm2ext::set_size_request_to_display_given_text (name_button, "long", 2, 2); @@ -457,8 +459,8 @@ MixerStrip::set_width (Width w, void* owner) ((Gtk::Label*)comment_button.get_child())->set_text (_("*Cmt*")); } - ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(_route->gain_automation().automation_style())); - ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(_route->gain_automation().automation_state())); + ((Gtk::Label*)gpm.gain_automation_style_button.get_child())->set_text (gpm.short_astyle_string(gain_automation->automation_style())); + ((Gtk::Label*)gpm.gain_automation_state_button.get_child())->set_text (gpm.short_astate_string(gain_automation->automation_state())); ((Gtk::Label*)panners.pan_automation_style_button.get_child())->set_text (panners.short_astyle_string(_route->panner().automation_style())); ((Gtk::Label*)panners.pan_automation_state_button.get_child())->set_text (panners.short_astate_string(_route->panner().automation_state())); Gtkmm2ext::set_size_request_to_display_given_text (name_button, "longest label", 2, 2); @@ -699,8 +701,8 @@ MixerStrip::connect_to_pan () if (!_route->panner().empty()) { StreamPanner* sp = _route->panner().front(); - panstate_connection = sp->automation().automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed)); - panstyle_connection = sp->automation().automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed)); + panstate_connection = sp->automation()->automation_state_changed.connect (mem_fun(panners, &PannerUI::pan_automation_state_changed)); + panstyle_connection = sp->automation()->automation_style_changed.connect (mem_fun(panners, &PannerUI::pan_automation_style_changed)); } panners.pan_changed (this); diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 665420fdbd..11f9b6357d 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -267,7 +267,7 @@ Mixer_UI::add_strip (Session::RouteList& routes) for (Session::RouteList::iterator x = routes.begin(); x != routes.end(); ++x) { boost::shared_ptr<Route> route = (*x); - if (route->hidden()) { + if (route->is_hidden()) { return; } @@ -473,7 +473,7 @@ Mixer_UI::set_all_strips_visibility (bool yn) continue; } - if (strip->route()->master() || strip->route()->control()) { + if (strip->route()->is_master() || strip->route()->is_control()) { continue; } @@ -501,7 +501,7 @@ Mixer_UI::set_all_audio_visibility (int tracks, bool yn) continue; } - if (strip->route()->master() || strip->route()->control()) { + if (strip->route()->is_master() || strip->route()->is_control()) { continue; } @@ -605,7 +605,7 @@ Mixer_UI::redisplay_track_list () if (strip->packed()) { - if (strip->route()->master() || strip->route()->control()) { + if (strip->route()->is_master() || strip->route()->is_control()) { out_packer.reorder_child (*strip, -1); } else { strip_packer.reorder_child (*strip, -1); /* put at end */ @@ -613,7 +613,7 @@ Mixer_UI::redisplay_track_list () } else { - if (strip->route()->master() || strip->route()->control()) { + if (strip->route()->is_master() || strip->route()->is_control()) { out_packer.pack_start (*strip, false, false); } else { strip_packer.pack_start (*strip, false, false); @@ -624,7 +624,7 @@ Mixer_UI::redisplay_track_list () } else { - if (strip->route()->master() || strip->route()->control()) { + if (strip->route()->is_master() || strip->route()->is_control()) { /* do nothing, these cannot be hidden */ } else { if (strip->packed()) { @@ -702,7 +702,7 @@ Mixer_UI::track_display_button_press (GdkEventButton* ev) MixerStrip* strip = (*iter)[track_columns.strip]; if (strip) { - if (!strip->route()->master() && !strip->route()->control()) { + if (!strip->route()->is_master() && !strip->route()->is_control()) { bool visible = (*iter)[track_columns.visible]; (*iter)[track_columns.visible] = !visible; } diff --git a/gtk2_ardour/pan_automation_time_axis.cc b/gtk2_ardour/pan_automation_time_axis.cc index 1199982b5d..49eed5d221 100644 --- a/gtk2_ardour/pan_automation_time_axis.cc +++ b/gtk2_ardour/pan_automation_time_axis.cc @@ -88,15 +88,15 @@ PanAutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* item, GdkEv /* map using line */ - lines.front()->view_to_model_y (y); + lines.front().first->view_to_model_y (y); - AutomationList& alist (lines[line_index]->the_list()); + boost::shared_ptr<AutomationList> alist (lines[line_index].first->the_list()); _session.begin_reversible_command (_("add pan automation event")); - XMLNode &before = alist.get_state(); - alist.add (when, y); - XMLNode &after = alist.get_state(); - _session.add_command(new MementoCommand<AutomationList>(alist, &before, &after)); + XMLNode &before = alist->get_state(); + alist->add (when, y); + XMLNode &after = alist->get_state(); + _session.add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after)); _session.commit_reversible_command (); _session.set_dirty (); } @@ -147,11 +147,3 @@ PanAutomationTimeAxisView::set_height (TimeAxisView::TrackHeight th) multiline_selector.hide(); } } - -void -PanAutomationTimeAxisView::set_automation_state (AutoState state) -{ - if (!ignore_state_request) { - route->panner().set_automation_state (state); - } -} diff --git a/gtk2_ardour/pan_automation_time_axis.h b/gtk2_ardour/pan_automation_time_axis.h index d4a22ebc29..fdffa875ca 100644 --- a/gtk2_ardour/pan_automation_time_axis.h +++ b/gtk2_ardour/pan_automation_time_axis.h @@ -52,7 +52,6 @@ class PanAutomationTimeAxisView : public AutomationTimeAxisView private: void automation_changed (); - void set_automation_state (ARDOUR::AutoState); }; #endif /* __ardour_gtk_pan_automation_time_axis_h__ */ diff --git a/gtk2_ardour/panner.cc b/gtk2_ardour/panner.cc index 23fae953a1..2607cdf2b8 100644 --- a/gtk2_ardour/panner.cc +++ b/gtk2_ardour/panner.cc @@ -34,8 +34,8 @@ null_label_callback (char* buf, unsigned int bufsize) } -PannerBar::PannerBar (Gtk::Adjustment& adj, PBD::Controllable& c) - : BarController (adj, c, sigc::ptr_fun (null_label_callback)) +PannerBar::PannerBar (Gtk::Adjustment& adj, boost::shared_ptr<PBD::Controllable> c) + : BarController (adj, *c.get(), sigc::ptr_fun (null_label_callback)) { set_style (BarController::Line); } diff --git a/gtk2_ardour/panner.h b/gtk2_ardour/panner.h index 6813f3d032..21f984aa7c 100644 --- a/gtk2_ardour/panner.h +++ b/gtk2_ardour/panner.h @@ -21,11 +21,12 @@ #define __gtk_ardour_panner_h__ #include <gtkmm2ext/barcontroller.h> +#include <boost/shared_ptr.hpp> class PannerBar : public Gtkmm2ext::BarController { public: - PannerBar (Gtk::Adjustment& adj, PBD::Controllable&); + PannerBar (Gtk::Adjustment& adj, boost::shared_ptr<PBD::Controllable>); ~PannerBar (); protected: diff --git a/gtk2_ardour/panner_ui.cc b/gtk2_ardour/panner_ui.cc index 42ccba992e..0e12a418e7 100644 --- a/gtk2_ardour/panner_ui.cc +++ b/gtk2_ardour/panner_ui.cc @@ -573,9 +573,9 @@ PannerUI::update_pan_bars (bool only_if_aplay) float xpos, val; if (only_if_aplay) { - AutomationList& alist (_io->panner()[n]->automation()); + boost::shared_ptr<AutomationList> alist (_io->panner()[n]->automation()); - if (!alist.automation_playback()) { + if (!alist->automation_playback()) { continue; } } @@ -707,7 +707,7 @@ PannerUI::pan_automation_state_changed () return; } - x = (_io->panner().front()->automation().automation_state() != Off); + x = (_io->panner().front()->automation()->automation_state() != Off); if (pan_automation_state_button.get_active() != x) { ignore_toggle = true; diff --git a/gtk2_ardour/processor_automation_line.cc b/gtk2_ardour/processor_automation_line.cc index 8b83b736f0..86eb7c7a7d 100644 --- a/gtk2_ardour/processor_automation_line.cc +++ b/gtk2_ardour/processor_automation_line.cc @@ -32,12 +32,11 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -ProcessorAutomationLine::ProcessorAutomationLine (const string & name, Processor& proc, ParamID param, - TimeAxisView& tv, ArdourCanvas::Group& parent, AutomationList& l) +ProcessorAutomationLine::ProcessorAutomationLine (const string & name, Processor& proc, + TimeAxisView& tv, ArdourCanvas::Group& parent, boost::shared_ptr<AutomationList> l) : AutomationLine (name, tv, parent, l), - _processor(proc), - _param(param) + _processor(proc) { set_verbose_cursor_uses_gain_mapping (false); @@ -49,7 +48,7 @@ ProcessorAutomationLine::ProcessorAutomationLine (const string & name, Processor /*NOTREACHED*/ } - pi->plugin()->get_parameter_descriptor (_param, desc); + pi->plugin()->get_parameter_descriptor (l->param_id(), desc); _upper = desc.upper; _lower = desc.lower; diff --git a/gtk2_ardour/processor_automation_line.h b/gtk2_ardour/processor_automation_line.h index 3a0a95786b..422f2b7f6f 100644 --- a/gtk2_ardour/processor_automation_line.h +++ b/gtk2_ardour/processor_automation_line.h @@ -33,17 +33,15 @@ class TimeAxisView; class ProcessorAutomationLine : public AutomationLine { public: - ProcessorAutomationLine (const string & name, ARDOUR::Processor&, ARDOUR::ParamID param, - TimeAxisView&, ArdourCanvas::Group& parent, ARDOUR::AutomationList&); + ProcessorAutomationLine (const string & name, ARDOUR::Processor&, + TimeAxisView&, ArdourCanvas::Group& parent, boost::shared_ptr<ARDOUR::AutomationList>); - ARDOUR::ParamID param() const { return _param; } ARDOUR::Processor& processor() const { return _processor; } string get_verbose_cursor_string (float); private: ARDOUR::Processor& _processor; - ARDOUR::ParamID _param; float _upper; float _lower; diff --git a/gtk2_ardour/processor_automation_time_axis.cc b/gtk2_ardour/processor_automation_time_axis.cc index 37c996d17e..4940f1fc10 100644 --- a/gtk2_ardour/processor_automation_time_axis.cc +++ b/gtk2_ardour/processor_automation_time_axis.cc @@ -91,11 +91,11 @@ ProcessorAutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* item, /* map to model space */ if (!lines.empty()) { - AutomationList* alist (_processor.automation_list(_param, true)); + boost::shared_ptr<AutomationList> alist (_processor.control(_param, true)->list()); string description = _("add automation event to "); description += _processor.describe_parameter (_param); - lines.front()->view_to_model_y (y); + lines.front().first->view_to_model_y (y); _session.begin_reversible_command (description); XMLNode &before = alist->get_state(); @@ -168,7 +168,33 @@ void ProcessorAutomationTimeAxisView::set_automation_state (AutoState state) { if (!ignore_state_request) { - _processor.automation_list (_param, true)->set_automation_state (state); + _processor.control (_param, true)->list()->set_automation_state (state); } } +void +ProcessorAutomationTimeAxisView::add_line (AutomationLine& line) +{ + bool get = false; + + if (lines.empty()) { + /* first line is the Model for automation state */ + automation_connection = line.the_list()->automation_state_changed.connect + (mem_fun(*this, &ProcessorAutomationTimeAxisView::automation_state_changed)); + get = true; + } + + lines.push_back (std::make_pair(&line, + AutomationController::create(_session, line.the_list(), + _processor.control(line.the_list()->param_id())))); + + line.set_y_position_and_height (0, height); + + if (get) { + /* pick up the current state */ + automation_state_changed (); + } + + line.show(); +} + diff --git a/gtk2_ardour/processor_automation_time_axis.h b/gtk2_ardour/processor_automation_time_axis.h index ec8caaf98f..980acdc441 100644 --- a/gtk2_ardour/processor_automation_time_axis.h +++ b/gtk2_ardour/processor_automation_time_axis.h @@ -46,6 +46,7 @@ class ProcessorAutomationTimeAxisView : public AutomationTimeAxisView ~ProcessorAutomationTimeAxisView(); void add_automation_event (ArdourCanvas::Item *item, GdkEvent *event, nframes_t, double); + void add_line (AutomationLine&); guint32 show_at (double y, int& nth, Gtk::VBox *parent); void hide (); diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 51257e18c0..756067e1e2 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -347,7 +347,7 @@ ProcessorBox::processor_button_release_event (GdkEventButton *ev) Menu * ProcessorBox::build_processor_menu () { - processor_menu = dynamic_cast<Gtk::Menu*>(ActionManager::get_widget("/redirectmenu") ); + processor_menu = dynamic_cast<Gtk::Menu*>(ActionManager::get_widget("/processormenu") ); processor_menu->set_name ("ArdourContextMenu"); show_all_children(); @@ -1184,7 +1184,7 @@ ProcessorBox::enter_box (GdkEventCrossing *ev, ProcessorBox* rb) void ProcessorBox::register_actions () { - Glib::RefPtr<Gtk::ActionGroup> popup_act_grp = Gtk::ActionGroup::create(X_("redirectmenu")); + Glib::RefPtr<Gtk::ActionGroup> popup_act_grp = Gtk::ActionGroup::create(X_("processormenu")); Glib::RefPtr<Action> act; /* new stuff */ diff --git a/gtk2_ardour/region_gain_line.cc b/gtk2_ardour/region_gain_line.cc index 25ba903ca8..6299813121 100644 --- a/gtk2_ardour/region_gain_line.cc +++ b/gtk2_ardour/region_gain_line.cc @@ -38,7 +38,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -AudioRegionGainLine::AudioRegionGainLine (const string & name, Session& s, AudioRegionView& r, ArdourCanvas::Group& parent, AutomationList& l) +AudioRegionGainLine::AudioRegionGainLine (const string & name, Session& s, AudioRegionView& r, ArdourCanvas::Group& parent, boost::shared_ptr<AutomationList> l) : AutomationLine (name, r.get_time_axis_view(), parent, l), session (s), rv (r) @@ -67,8 +67,8 @@ AudioRegionGainLine::start_drag (ControlPoint* cp, nframes_t x, float fraction) { AutomationLine::start_drag (cp, x, fraction); if (!rv.audio_region()->envelope_active()) { - trackview.session().add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), &rv.audio_region()->get_state(), 0)); - rv.audio_region()->set_envelope_active(false); + trackview.session().add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), &rv.audio_region()->get_state(), 0)); + rv.audio_region()->set_envelope_active(false); } } @@ -81,18 +81,18 @@ AudioRegionGainLine::remove_point (ControlPoint& cp) model_representation (cp, mr); trackview.editor.current_session()->begin_reversible_command (_("remove control point")); - XMLNode &before = alist.get_state(); + XMLNode &before = alist->get_state(); if (!rv.audio_region()->envelope_active()) { - XMLNode ®ion_before = rv.audio_region()->get_state(); + XMLNode ®ion_before = rv.audio_region()->get_state(); rv.audio_region()->set_envelope_active(true); - XMLNode ®ion_after = rv.audio_region()->get_state(); - trackview.session().add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), ®ion_before, ®ion_after)); + XMLNode ®ion_after = rv.audio_region()->get_state(); + trackview.session().add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), ®ion_before, ®ion_after)); } - alist.erase (mr.start, mr.end); + alist->erase (mr.start, mr.end); - trackview.editor.current_session()->add_command (new MementoCommand<AutomationList>(alist, &before, &alist.get_state())); + trackview.editor.current_session()->add_command (new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state())); trackview.editor.current_session()->commit_reversible_command (); trackview.editor.current_session()->set_dirty (); } diff --git a/gtk2_ardour/region_gain_line.h b/gtk2_ardour/region_gain_line.h index 259615aa39..fe03c0f76f 100644 --- a/gtk2_ardour/region_gain_line.h +++ b/gtk2_ardour/region_gain_line.h @@ -35,7 +35,7 @@ class AudioRegionView; class AudioRegionGainLine : public AutomationLine { public: - AudioRegionGainLine (const string & name, ARDOUR::Session&, AudioRegionView&, ArdourCanvas::Group& parent, ARDOUR::AutomationList&); + AudioRegionGainLine (const string & name, ARDOUR::Session&, AudioRegionView&, ArdourCanvas::Group& parent, boost::shared_ptr<ARDOUR::AutomationList>); void view_to_model_y (double&); void model_to_view_y (double&); diff --git a/gtk2_ardour/route_params_ui.cc b/gtk2_ardour/route_params_ui.cc index fb63ae8bd6..cbddd098bb 100644 --- a/gtk2_ardour/route_params_ui.cc +++ b/gtk2_ardour/route_params_ui.cc @@ -178,7 +178,7 @@ RouteParams_UI::add_routes (Session::RouteList& routes) for (Session::RouteList::iterator x = routes.begin(); x != routes.end(); ++x) { boost::shared_ptr<Route> route = (*x); - if (route->hidden()) { + if (route->is_hidden()) { return; } diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 3b89517fce..dff6630213 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -1570,7 +1570,7 @@ RouteTimeAxisView::show_existing_automation () map<ARDOUR::ParamID, RouteAutomationNode*>::iterator i; for (i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) { // FIXME: only shown if /first/ line has points - if (!i->second->track->lines.empty() && i->second->track->lines[0]->npoints() > 0) { + if (!i->second->track->lines.empty() && i->second->track->lines[0].first->npoints() > 0) { i->second->track->set_marked_for_display (true); i->second->track->canvas_display->show(); i->second->track->get_state_node()->add_property ("shown", X_("yes")); @@ -1714,14 +1714,16 @@ RouteTimeAxisView::add_processor_automation_curve (boost::shared_ptr<Processor> /* create a string that is a legal XML node name that can be used to refer to this redirect+port combination */ + /* FIXME: ew */ + char state_name[256]; snprintf (state_name, sizeof (state_name), "Redirect-%s-%" PRIu32, legalize_for_xml_node (processor->name()).c_str(), what.id()); ran->view = new ProcessorAutomationTimeAxisView (_session, _route, editor, *this, parent_canvas, name, what, *processor, state_name); ral = new ProcessorAutomationLine (name, - *processor, what, *ran->view, - *ran->view->canvas_display, *processor->automation_list (what, true)); + *processor, *ran->view, *ran->view->canvas_display, + processor->control (what, true)->list()); ral->set_line_color (Config->canvasvar_ProcessorAutomationLine.get()); ral->queue_reset (); @@ -1974,7 +1976,7 @@ RouteTimeAxisView::find_processor_automation_curve (boost::shared_ptr<Processor> if ((ran = find_processor_automation_node (processor, what)) != 0) { if (ran->view) { - return dynamic_cast<ProcessorAutomationLine*> (ran->view->lines.front()); + return dynamic_cast<ProcessorAutomationLine*> (ran->view->lines.front().first); } } diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 95042af6ea..76c4b7b5b3 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -80,10 +80,10 @@ RouteUI::RouteUI (boost::shared_ptr<ARDOUR::Route> rt, ARDOUR::Session& sess, co _route->active_changed.connect (mem_fun (*this, &RouteUI::route_active_changed)); - mute_button = manage (new BindableToggleButton (_route->mute_control(), m_name )); + mute_button = manage (new BindableToggleButton (*_route->mute_control().get(), m_name )); mute_button->set_self_managed (true); - solo_button = manage (new BindableToggleButton (_route->solo_control(), s_name )); + solo_button = manage (new BindableToggleButton (*_route->solo_control().get(), s_name )); solo_button->set_self_managed (true); mute_button->set_name ("MuteButton"); @@ -104,7 +104,7 @@ RouteUI::RouteUI (boost::shared_ptr<ARDOUR::Route> rt, ARDOUR::Session& sess, co _session.RecordStateChanged.connect (mem_fun (*this, &RouteUI::session_rec_enable_changed)); - rec_enable_button = manage (new BindableToggleButton (t->rec_enable_control(), r_name )); + rec_enable_button = manage (new BindableToggleButton (*t->rec_enable_control().get(), r_name )); rec_enable_button->set_name ("RecordEnableButton"); rec_enable_button->set_self_managed (true); diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index e47be6a54b..c20b56f6f4 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -31,7 +31,6 @@ #include <pbd/file_utils.h> #include <gtkmm2ext/utils.h> -//#include <ardour/ardour.h> #include <ardour/filesystem_paths.h> |