From 7857ec8b456d6fc233d1ee9b111744fc831dccca Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 12 Nov 2009 05:47:05 +0000 Subject: comments for BBT math methods; remove chunks from GUI; split location UI into a widget and a window; add the widget part to the editor RHS notebook. this is unfinished - it looks absurd. but its the starting point for a reworking of the location UI in its rightful place git-svn-id: svn://localhost/ardour2/branches/3.0@6071 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour_ui.h | 8 ++-- gtk2_ardour/ardour_ui2.cc | 2 + gtk2_ardour/ardour_ui_dialogs.cc | 2 +- gtk2_ardour/editor.cc | 35 +++------------ gtk2_ardour/editor.h | 31 +------------ gtk2_ardour/editor_actions.cc | 2 - gtk2_ardour/editor_locations.cc | 45 +++++++++++++++++++ gtk2_ardour/editor_locations.h | 45 +++++++++++++++++++ gtk2_ardour/editor_mixer.cc | 4 -- gtk2_ardour/editor_ops.cc | 57 ------------------------ gtk2_ardour/editor_regions.h | 4 +- gtk2_ardour/location_ui.cc | 96 +++++++++++++++++++++++++--------------- gtk2_ardour/location_ui.h | 36 ++++++++++----- gtk2_ardour/wscript | 2 +- libs/ardour/tempo.cc | 14 ++++-- 15 files changed, 204 insertions(+), 179 deletions(-) create mode 100644 gtk2_ardour/editor_locations.cc create mode 100644 gtk2_ardour/editor_locations.h diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 97a64c5330..4d8d057460 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -75,7 +75,7 @@ class BundleManager; class ConnectionEditor; class KeyEditor; class Keyboard; -class LocationUI; +class LocationUIWindow; class Mixer_UI; class PublicEditor; class RCOptionEditor; @@ -572,9 +572,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI BundleManager *bundle_manager; void create_bundle_manager (); - LocationUI *location_ui; - int create_location_ui (); - void handle_locations_change (ARDOUR::Location*); + LocationUIWindow *location_ui; + int create_location_ui (); + void handle_locations_change (ARDOUR::Location*); static UIConfiguration *ui_config; ThemeManager *theme_manager; diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 60477c894f..b54fe9225a 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -127,6 +127,7 @@ ARDOUR_UI::display_message (const char *prefix, gint prefix_len, RefPtrset_session (session); location_ui->signal_unmap().connect (sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("/Common/ToggleLocations"))); } diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 21135fc2dc..8c5d93e749 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -103,6 +103,7 @@ #include "mixer_strip.h" #include "editor_route_groups.h" #include "editor_regions.h" +#include "editor_locations.h" #include "editor_snapshots.h" #include "i18n.h" @@ -524,22 +525,7 @@ Editor::Editor () _routes = new EditorRoutes (this); _regions = new EditorRegions (this); _snapshots = new EditorSnapshots (this); - - named_selection_scroller.add (named_selection_display); - named_selection_scroller.set_policy (POLICY_NEVER, POLICY_AUTOMATIC); - - named_selection_model = TreeStore::create (named_selection_columns); - named_selection_display.set_model (named_selection_model); - named_selection_display.append_column (_("Chunks"), named_selection_columns.text); - named_selection_display.set_headers_visible (false); - named_selection_display.set_size_request (100, -1); - named_selection_display.set_name ("NamedSelectionDisplay"); - - named_selection_display.get_selection()->set_mode (SELECTION_SINGLE); - named_selection_display.set_size_request (100, -1); - named_selection_display.signal_button_release_event().connect (mem_fun(*this, &Editor::named_selection_display_button_release), false); - named_selection_display.signal_key_release_event().connect (mem_fun(*this, &Editor::named_selection_display_key_release), false); - named_selection_display.get_selection()->signal_changed().connect (mem_fun (*this, &Editor::named_selection_display_selection_changed)); + _locations = new EditorLocations (this); Gtk::Label* nlabel; @@ -555,12 +541,9 @@ Editor::Editor () nlabel = manage (new Label (_("Route Groups"))); nlabel->set_angle (-90); the_notebook.append_page (_route_groups->widget (), *nlabel); - - if (!Profile->get_sae()) { - nlabel = manage (new Label (_("Chunks"))); - nlabel->set_angle (-90); - the_notebook.append_page (named_selection_scroller, *nlabel); - } + nlabel = manage (new Label (_("Ranges & Marks"))); + nlabel->set_angle (-90); + the_notebook.append_page (_locations->widget (), *nlabel); the_notebook.set_show_tabs (true); the_notebook.set_scrollable (true); @@ -1080,8 +1063,6 @@ Editor::connect_to_session (Session *t) session_connections.push_back (session->PositionChanged.connect (mem_fun(*this, &Editor::map_position_change))); session_connections.push_back (session->RouteAdded.connect (mem_fun(*this, &Editor::handle_new_route))); session_connections.push_back (session->DurationChanged.connect (mem_fun(*this, &Editor::handle_new_duration))); - session_connections.push_back (session->NamedSelectionAdded.connect (mem_fun(*this, &Editor::handle_new_named_selection))); - session_connections.push_back (session->NamedSelectionRemoved.connect (mem_fun(*this, &Editor::handle_new_named_selection))); session_connections.push_back (session->DirtyChanged.connect (mem_fun(*this, &Editor::update_title))); session_connections.push_back (session->StateSaved.connect (mem_fun(*this, &Editor::update_title_s))); session_connections.push_back (session->AskAboutPlaylistDeletion.connect (mem_fun(*this, &Editor::playlist_deletion_dialog))); @@ -1164,8 +1145,6 @@ Editor::connect_to_session (Session *t) handle_new_duration (); - redisplay_named_selections (); - restore_ruler_visibility (); //tempo_map_changed (Change (0)); session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); @@ -1197,6 +1176,7 @@ Editor::connect_to_session (Session *t) _regions->connect_to_session (session); _snapshots->connect_to_session (session); _routes->connect_to_session (session); + _locations->connect_to_session (session); start_updating (); } @@ -1951,7 +1931,6 @@ Editor::add_selection_context_items (Menu_Helpers::MenuList& edit_items) edit_items.push_back (MenuElem (_("Crop Region to Range"), mem_fun(*this, &Editor::crop_region_to_selection))); edit_items.push_back (MenuElem (_("Fill Range with Region"), mem_fun(*this, &Editor::region_fill_selection))); edit_items.push_back (MenuElem (_("Duplicate Range"), bind (mem_fun(*this, &Editor::duplicate_dialog), false))); - edit_items.push_back (MenuElem (_("Create Chunk from Range"), mem_fun(*this, &Editor::create_named_selection))); edit_items.push_back (SeparatorElem()); edit_items.push_back (MenuElem (_("Consolidate Range"), bind (mem_fun(*this, &Editor::bounce_range_selection), true, false))); @@ -2022,8 +2001,6 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items) cutnpaste_items.push_back (SeparatorElem()); - cutnpaste_items.push_back (MenuElem (_("Insert chunk"), bind (mem_fun(*this, &Editor::paste_named_selection), 1.0f))); - edit_items.push_back (MenuElem (_("Edit"), *cutnpaste_menu)); /* Adding new material */ diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 8376b8cedf..3a41fd735a 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -122,6 +122,7 @@ class EditorGroupTabs; class EditorRoutes; class EditorRouteGroups; class EditorRegions; +class EditorLocations; class EditorSnapshots; /* */ @@ -948,35 +949,6 @@ class Editor : public PublicEditor void end_location_changed (ARDOUR::Location*); - /* named selections */ - - struct NamedSelectionDisplayModelColumns : public Gtk::TreeModel::ColumnRecord { - NamedSelectionDisplayModelColumns() { - add (text); - add (selection); - } - Gtk::TreeModelColumn text; - Gtk::TreeModelColumn selection; - }; - - NamedSelectionDisplayModelColumns named_selection_columns; - Glib::RefPtr named_selection_model; - - Gtkmm2ext::DnDTreeView named_selection_display; - Gtk::ScrolledWindow named_selection_scroller; - - void create_named_selection (); - void paste_named_selection (float times); - void remove_selected_named_selections (); - - void handle_new_named_selection (); - void add_named_selection_to_named_selection_display (ARDOUR::NamedSelection&); - void redisplay_named_selections (); - - bool named_selection_display_button_release (GdkEventButton *ev); - bool named_selection_display_key_release (GdkEventKey *ev); - void named_selection_display_selection_changed (); - /* track views */ TrackViewList track_views; std::pair trackview_by_y_position (double); @@ -1665,6 +1637,7 @@ public: EditorRoutes* _routes; EditorRegions* _regions; EditorSnapshots* _snapshots; + EditorLocations* _locations; /* diskstream/route display management */ Glib::RefPtr rec_enabled_icon; diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 678be375de..25239ef356 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -583,8 +583,6 @@ Editor::register_actions () act = ActionManager::register_action (editor_actions, "crop", _("Crop"), mem_fun(*this, &Editor::crop_region_to_selection)); ActionManager::session_sensitive_actions.push_back (act); - act = ActionManager::register_action (editor_actions, "insert-chunk", _("Insert Chunk"), bind (mem_fun(*this, &Editor::paste_named_selection), 1.0f)); - ActionManager::session_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "start-range", _("Start Range"), mem_fun(*this, &Editor::keyboard_selection_begin)); ActionManager::session_sensitive_actions.push_back (act); diff --git a/gtk2_ardour/editor_locations.cc b/gtk2_ardour/editor_locations.cc new file mode 100644 index 0000000000..7031be410e --- /dev/null +++ b/gtk2_ardour/editor_locations.cc @@ -0,0 +1,45 @@ +/* + Copyright (C) 2009 Paul Davis + + 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 "editor_locations.h" +#include "location_ui.h" + +#include "i18n.h" + +using namespace ARDOUR; +using namespace Gtk; + +EditorLocations::EditorLocations (Editor* e) + : EditorComponent (e) +{ + locations = new LocationUI; +} + +void +EditorLocations::connect_to_session (ARDOUR::Session* s) +{ + EditorComponent::connect_to_session (s); + locations->set_session (s); +} + +Widget& +EditorLocations::widget() +{ + return *locations; +} diff --git a/gtk2_ardour/editor_locations.h b/gtk2_ardour/editor_locations.h new file mode 100644 index 0000000000..3375b338bd --- /dev/null +++ b/gtk2_ardour/editor_locations.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2000-2009 Paul Davis + + 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 __gtk_ardour_editor_locations_h__ +#define __gtk_ardour_editor_locations_h__ + +#include "editor_component.h" + +class LocationUI; + +namespace Gtk { + class Widget; +} + +class EditorLocations : public EditorComponent +{ + public: + EditorLocations (Editor *); + + void connect_to_session (ARDOUR::Session *); + + Gtk::Widget& widget (); + + private: + LocationUI* locations; +}; + + +#endif /* __gtk_ardour_editor_locations_h__ */ diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc index 742af793ad..28d21f63b6 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -360,10 +360,6 @@ Editor::session_going_away () _routes->clear (); _route_groups->clear (); - named_selection_display.set_model (Glib::RefPtr(0)); - named_selection_model->clear (); - named_selection_display.set_model (named_selection_model); - edit_point_clock_connection_a.disconnect(); edit_point_clock_connection_b.disconnect(); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 001e56da35..0dfaecf4fd 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -44,7 +44,6 @@ #include "ardour/audio_diskstream.h" #include "ardour/utils.h" #include "ardour/location.h" -#include "ardour/named_selection.h" #include "ardour/audio_track.h" #include "ardour/audioplaylist.h" #include "ardour/region_factory.h" @@ -4344,62 +4343,6 @@ Editor::paste_internal (nframes64_t position, float times) } } -void -Editor::paste_named_selection (float times) -{ - TrackSelection::iterator t; - - Glib::RefPtr selected = named_selection_display.get_selection(); - - if (selected->count_selected_rows() != 1 || selection->tracks.empty()) { - return; - } - - TreeModel::iterator i = selected->get_selected(); - NamedSelection* ns = (*i)[named_selection_columns.selection]; - - list >::iterator chunk; - list >::iterator tmp; - - chunk = ns->playlists.begin(); - - begin_reversible_command (_("paste chunk")); - - sort_track_selection (); - - for (t = selection->tracks.begin(); t != selection->tracks.end(); ++t) { - - RouteTimeAxisView* rtv; - boost::shared_ptr pl; - boost::shared_ptr apl; - - if ((rtv = dynamic_cast (*t)) == 0) { - continue; - } - - if ((pl = rtv->playlist()) == 0) { - continue; - } - - if ((apl = boost::dynamic_pointer_cast (pl)) == 0) { - continue; - } - - tmp = chunk; - ++tmp; - - XMLNode &before = apl->get_state(); - apl->paste (*chunk, get_preferred_edit_position(), times); - session->add_command(new MementoCommand(*apl, &before, &apl->get_state())); - - if (tmp != ns->playlists.end()) { - chunk = tmp; - } - } - - commit_reversible_command(); -} - void Editor::duplicate_some_regions (RegionSelection& regions, float times) { diff --git a/gtk2_ardour/editor_regions.h b/gtk2_ardour/editor_regions.h index 885acca628..5d0ba42425 100644 --- a/gtk2_ardour/editor_regions.h +++ b/gtk2_ardour/editor_regions.h @@ -16,6 +16,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#ifndef __gtk_ardour_editor_regions_h__ +#define __gtk_ardour_editor_regions_h__ #include "editor_component.h" @@ -148,4 +150,4 @@ private: std::list > tmp_region_list; }; - +#endif /* __gtk_ardour_editor_regions_h__ */ diff --git a/gtk2_ardour/location_ui.cc b/gtk2_ardour/location_ui.cc index 6622ce33c3..6c886b0b74 100644 --- a/gtk2_ardour/location_ui.cc +++ b/gtk2_ardour/location_ui.cc @@ -620,21 +620,14 @@ LocationEditRow::focus_name() { LocationUI::LocationUI () - : ArdourDialog ("locations dialog"), - add_location_button (_("Add New Location")), - add_range_button (_("Add New Range")) + : session (0) + , add_location_button (_("Add New Location")) + , add_range_button (_("Add New Range")) { i_am_the_modifier = 0; - set_title (_("Locations")); - set_wmclass(X_("ardour_locations"), "Ardour"); - - set_name ("LocationWindow"); - - get_vbox()->pack_start (location_hpacker); - location_vpacker.set_spacing (5); - + location_vpacker.pack_start (loop_edit_row, false, false); location_vpacker.pack_start (punch_edit_row, false, false); @@ -681,28 +674,20 @@ LocationUI::LocationUI () loc_range_panes.pack2(range_frame, true, false); location_vpacker.pack_start (loc_range_panes, true, true); - location_hpacker.pack_start (location_vpacker, true, true); + pack_start (location_vpacker, true, true); add_location_button.signal_clicked().connect (mem_fun(*this, &LocationUI::add_new_location)); add_range_button.signal_clicked().connect (mem_fun(*this, &LocationUI::add_new_range)); - - //add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_RELEASE_MASK); - - + + show_all (); } LocationUI::~LocationUI() { } -void LocationUI::on_show() -{ - ArdourDialog::on_show(); - refresh_location_list(); -} - - -gint LocationUI::do_location_remove (ARDOUR::Location *loc) +gint +LocationUI::do_location_remove (ARDOUR::Location *loc) { /* this is handled internally by Locations, but there's no point saving state etc. when we know the marker @@ -723,24 +708,23 @@ gint LocationUI::do_location_remove (ARDOUR::Location *loc) return FALSE; } -void LocationUI::location_remove_requested (ARDOUR::Location *loc) +void +LocationUI::location_remove_requested (ARDOUR::Location *loc) { // must do this to prevent problems when destroying // the effective sender of this event - Glib::signal_idle().connect (bind (mem_fun(*this, &LocationUI::do_location_remove), loc)); + Glib::signal_idle().connect (bind (mem_fun(*this, &LocationUI::do_location_remove), loc)); } -void LocationUI::location_redraw_ranges () +void +LocationUI::location_redraw_ranges () { - range_rows.hide(); range_rows.show(); - } - void LocationUI::location_added (Location* location) { @@ -896,6 +880,8 @@ LocationUI::refresh_location_list () loc_children.clear(); range_children.clear(); + cerr << "about to map locations with session = " << session << endl; + if (session) { session->locations()->apply (*this, &LocationUI::map_locations); } @@ -903,9 +889,9 @@ LocationUI::refresh_location_list () } void -LocationUI::set_session(ARDOUR::Session* sess) +LocationUI::set_session(ARDOUR::Session* s) { - ArdourDialog::set_session (sess); + session = s; if (session) { session->locations()->changed.connect (mem_fun(*this, &LocationUI::refresh_location_list)); @@ -922,8 +908,6 @@ LocationUI::session_gone() { ENSURE_GUI_THREAD(mem_fun(*this, &LocationUI::session_gone)); - hide_all(); - using namespace Box_Helpers; BoxList & loc_children = location_rows.children(); BoxList & range_children = range_rows.children(); @@ -936,13 +920,53 @@ LocationUI::session_gone() punch_edit_row.set_session (0); punch_edit_row.set_location (0); +} - ArdourDialog::session_gone (); +/*------------------------*/ + +LocationUIWindow::LocationUIWindow () + : ArdourDialog ("locations dialog") +{ + set_title (_("Locations")); + set_wmclass(X_("ardour_locations"), "Ardour"); + set_name ("LocationWindow"); + + get_vbox()->pack_start (_ui); +} + +LocationUIWindow::~LocationUIWindow() +{ +} + +void +LocationUIWindow::on_show() +{ + cerr << "Show loc list\n"; + _ui.refresh_location_list(); + ArdourDialog::on_show(); } bool -LocationUI::on_delete_event (GdkEventAny*) +LocationUIWindow::on_delete_event (GdkEventAny*) { hide (); return true; } + +void +LocationUIWindow::set_session (Session *s) +{ + cerr << "Setting session in LUW, with s = " << s << "\n"; + + ArdourDialog::set_session (s); + _ui.set_session (s); + + s->GoingAway.connect (mem_fun (*this, &LocationUIWindow::session_gone)); +} + +void +LocationUIWindow::session_gone () +{ + hide_all(); + ArdourDialog::session_gone (); +} diff --git a/gtk2_ardour/location_ui.h b/gtk2_ardour/location_ui.h index 30bb7ec13b..56d6505434 100644 --- a/gtk2_ardour/location_ui.h +++ b/gtk2_ardour/location_ui.h @@ -26,10 +26,13 @@ #include #include #include +#include +#include #include "ardour/location.h" #include "ardour_dialog.h" +#include "audio_clock.h" namespace ARDOUR { class LocationStack; @@ -137,25 +140,28 @@ class LocationEditRow : public Gtk::HBox }; - -class LocationUI : public ArdourDialog +class LocationUI : public Gtk::HBox { public: LocationUI (); ~LocationUI (); + + virtual void set_session (ARDOUR::Session *); - void set_session (ARDOUR::Session *); + void add_new_location(); + void add_new_range(); - void on_show(); + void refresh_location_list (); + void refresh_location_list_s (ARDOUR::Change); private: + ARDOUR::Session* session; ARDOUR::LocationStack* locations; ARDOUR::Location *newest_location; void session_gone(); Gtk::VBox location_vpacker; - Gtk::HBox location_hpacker; LocationEditRow loop_edit_row; LocationEditRow punch_edit_row; @@ -174,7 +180,6 @@ class LocationUI : public ArdourDialog Gtk::ScrolledWindow range_rows_scroller; Gtk::VBox range_rows; - /* When any location changes it start or end points, it sends a signal that is caught by one of these functions @@ -188,17 +193,26 @@ class LocationUI : public ArdourDialog guint32 i_am_the_modifier; - void add_new_location(); - void add_new_range(); - - void refresh_location_list (); - void refresh_location_list_s (ARDOUR::Change); void location_removed (ARDOUR::Location *); void location_added (ARDOUR::Location *); void map_locations (ARDOUR::Locations::LocationList&); +}; + +class LocationUIWindow : public ArdourDialog +{ + public: + LocationUIWindow (); + ~LocationUIWindow (); + + void on_show(); + void set_session (ARDOUR::Session *); + + LocationUI& ui() { return _ui; } protected: + LocationUI _ui; bool on_delete_event (GdkEventAny*); + void session_gone(); }; #endif // __ardour_location_ui_h__ diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index 40c7fd48be..2166267092 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -82,6 +82,7 @@ gtk2_ardour_sources = [ 'editor_hscroller.cc', 'editor_keyboard.cc', 'editor_keys.cc', + 'editor_locations.cc', 'editor_markers.cc', 'editor_mixer.cc', 'editor_mouse.cc', @@ -92,7 +93,6 @@ gtk2_ardour_sources = [ 'editor_rulers.cc', 'editor_scrub.cc', 'editor_selection.cc', - 'editor_selection_list.cc', 'editor_snapshots.cc', 'editor_summary.cc', 'editor_tempodisplay.cc', diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index b8144d6e3c..f1248b11aa 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -1684,11 +1684,14 @@ TempoMap::bbt_add (const BBT_Time& start, const BBT_Time& other) const return bbt_add (start, other, metric); } +/** + * add the BBT interval @param increment to @param start and return the result + */ BBT_Time -TempoMap::bbt_add (const BBT_Time& start, const BBT_Time& other, const TempoMetric& metric) const +TempoMap::bbt_add (const BBT_Time& start, const BBT_Time& increment, const TempoMetric& metric) const { BBT_Time result = start; - BBT_Time op = other; + BBT_Time op = increment; /* argument is const, but we need to modify it */ uint32_t ticks = result.ticks + op.ticks; if (ticks >= Meter::ticks_per_beat) { @@ -1780,11 +1783,14 @@ TempoMap::bbt_add (const BBT_Time& start, const BBT_Time& other, const TempoMetr return result; } +/** + * subtract the BBT interval @param decrement from @param start and return the result + */ BBT_Time -TempoMap::bbt_subtract (const BBT_Time& start, const BBT_Time& other) const +TempoMap::bbt_subtract (const BBT_Time& start, const BBT_Time& decrement) const { BBT_Time result = start; - BBT_Time op = other; + BBT_Time op = decrement; /* argument is const, but we need to modify it */ if (op.ticks > result.ticks) { /* subtract an extra beat later; meanwhile set ticks to the right "carry" value */ -- cgit v1.2.3