summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-04-29 03:27:08 +1000
committernick_m <mainsbridge@gmail.com>2016-05-27 23:38:15 +1000
commit37ed0f6e9b39f1661688dafea14b22efebe39cab (patch)
tree00f1829324d3869287b34ee044a29defa88c9ee0
parentbfeb105256f3c98eefeb9571fea0afca603ef0c5 (diff)
Tempo ramps - restore correct drag behaviour wrt audio-locked meters and right-click of associalted tempo
-rw-r--r--gtk2_ardour/editor_drag.cc4
-rw-r--r--gtk2_ardour/editor_markers.cc3
-rw-r--r--libs/ardour/tempo.cc52
3 files changed, 35 insertions, 24 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 1db6e25797..f7d85bf5a1 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -3291,7 +3291,7 @@ TempoMarkerDrag::setup_pointer_frame_offset ()
void
TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
{
- if (!_real_section->active()) {
+ if (!_real_section->active() || _real_section->locked_to_meter()) {
return;
}
if (first_move) {
@@ -3443,7 +3443,7 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
void
TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
{
- if (!_real_section->active()) {
+ if (!_real_section->active() || _real_section->locked_to_meter()) {
return;
}
if (!movement_occurred) {
diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc
index 9664d6f65f..e8b37606d6 100644
--- a/gtk2_ardour/editor_markers.cc
+++ b/gtk2_ardour/editor_markers.cc
@@ -815,7 +815,7 @@ Editor::tempo_or_meter_marker_context_menu (GdkEventButton* ev, ArdourCanvas::It
if (!tm->tempo().active()) {
return;
}
- can_remove = tm->tempo().movable ();
+ can_remove = tm->tempo().movable() && !tm->tempo().locked_to_meter();
delete tempo_marker_menu;
build_tempo_marker_menu (tm, can_remove);
tempo_marker_menu->popup (1, ev->time);
@@ -997,7 +997,6 @@ Editor::build_tempo_marker_menu (TempoMarker* loc, bool can_remove)
items.push_back (MenuElem (_("Edit..."), sigc::mem_fun(*this, &Editor::marker_menu_edit)));
items.push_back (MenuElem (_("Remove"), sigc::mem_fun(*this, &Editor::marker_menu_remove)));
-
items.back().set_sensitive (can_remove);
}
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index 234b37cbc0..35facf91e5 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -2084,22 +2084,7 @@ TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const framepos_t
TempoSection* meter_locked_tempo = 0;
if ((meter_locked_tempo = const_cast<TempoSection*>(&tempo_section_at_locked (imaginary, section->frame())))->frame() == section->frame()) {
- if (meter_locked_tempo->locked_to_meter()) {
- std::cout << "locked to meter " << std::endl;
- Metrics future_map;
- TempoSection* new_section = copy_metrics_and_point (future_map, meter_locked_tempo);
-
- new_section->set_frame (frame);
- new_section->set_active (true);
-
- if (solve_map (future_map, new_section, frame)) {
- meter_locked_tempo->set_frame (frame);
- meter_locked_tempo->set_active (true);
- solve_map (imaginary, meter_locked_tempo, frame);
- } else {
- return;
- }
- } else {
+ if (!meter_locked_tempo->locked_to_meter()) {
meter_locked_tempo = 0;
}
}
@@ -2118,16 +2103,41 @@ TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const framepos_t
here we set the frame/pulse corresponding to its musical position.
*/
const double new_pulse = ((section->beat() - prev_m->beat()) / prev_m->note_divisor()) + prev_m->pulse();
- section->set_frame (frame_at_pulse_locked (imaginary, new_pulse));
- section->set_pulse (new_pulse);
+
if (meter_locked_tempo) {
+ Metrics future_map;
+ TempoSection* new_section = copy_metrics_and_point (future_map, meter_locked_tempo);
+
+ new_section->set_active (true);
+
+ if (solve_map (future_map, new_section, section->frame())) {
+ meter_locked_tempo->set_active (true);
+ solve_map (imaginary, meter_locked_tempo, section->frame());
+ section->set_frame (frame_at_pulse_locked (imaginary, new_pulse));
+ section->set_pulse (new_pulse);
+ } else {
+ return;
+ }
meter_locked_tempo->set_frame (section->frame());
/* XX need to fake the pulse and prevent it from changing */
//meter_locked_tempo->set_pulse (pulse_at_frame_locked (imaginary, section->frame()));
}
- break;
+ return;
} else {
- section->set_pulse (pulse_at_frame_locked (imaginary, frame));
+ if (meter_locked_tempo) {
+ Metrics future_map;
+ TempoSection* new_section = copy_metrics_and_point (future_map, meter_locked_tempo);
+
+ new_section->set_active (true);
+
+ if (solve_map (future_map, new_section, frame)) {
+ meter_locked_tempo->set_active (true);
+ solve_map (imaginary, meter_locked_tempo, frame);
+ section->set_pulse (pulse_at_frame_locked (imaginary, frame));
+ } else {
+ return;
+ }
+ }
}
} else {
pair<double, BBT_Time> b_bbt = make_pair (0.0, BBT_Time (1, 1, 0));
@@ -2217,6 +2227,7 @@ TempoMap::copy_metrics_and_point (Metrics& copy, TempoSection* section)
ret->set_c_func (t->c_func());
ret->set_active (t->active());
ret->set_movable (t->movable());
+ ret->set_locked_to_meter (t->locked_to_meter());
copy.push_back (ret);
continue;
}
@@ -2231,6 +2242,7 @@ TempoMap::copy_metrics_and_point (Metrics& copy, TempoSection* section)
cp->set_c_func (t->c_func());
cp->set_active (t->active());
cp->set_movable (t->movable());
+ cp->set_locked_to_meter (t->locked_to_meter());
copy.push_back (cp);
}
if ((m = dynamic_cast<MeterSection *> (*i)) != 0) {