summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-03-19 23:44:40 +1100
committernick_m <mainsbridge@gmail.com>2016-05-27 23:38:11 +1000
commitb415b59f790f049a73464efc7fdf0f2858e1bde8 (patch)
treebfe28234131383e4b2a7417410134ca21e59086c /gtk2_ardour
parenta47359c38280398acc80494cdc72ce129ae0edc3 (diff)
Tempo ramps - respect tempo note type and meter note divisor correctly.
- tempo and meter position is now pulse-based, although meter still has a beat for convenience.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/audio_clock.cc2
-rw-r--r--gtk2_ardour/editor_drag.cc22
-rw-r--r--gtk2_ardour/editor_rulers.cc4
-rw-r--r--gtk2_ardour/midi_region_view.cc2
-rw-r--r--gtk2_ardour/tempo_dialog.cc4
5 files changed, 16 insertions, 18 deletions
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc
index 4afe4a418d..a32ad42908 100644
--- a/gtk2_ardour/audio_clock.cc
+++ b/gtk2_ardour/audio_clock.cc
@@ -1281,7 +1281,7 @@ AudioClock::set_bbt (framepos_t when, bool /*force*/)
TempoMetric m (_session->tempo_map().metric_at (pos));
- sprintf (buf, "%-5.1f", _session->tempo_map().tempo_at (pos));
+ sprintf (buf, "%-5.1f", _session->tempo_map().tempo_at (pos).beats_per_minute());
_left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%3</span> <span foreground=\"green\">%2</span></span>",
INFO_FONT_SIZE, buf, _("Tempo")));
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index e955b35586..54dcd25ac1 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -3143,7 +3143,7 @@ void
MeterMarkerDrag::motion (GdkEvent* event, bool first_move)
{
if (!_marker->meter().movable()) {
- return;
+ //return;
}
if (first_move) {
@@ -3209,10 +3209,10 @@ MeterMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
//motion (event, false);
- Timecode::BBT_Time when;
+ //Timecode::BBT_Time when;
TempoMap& map (_editor->session()->tempo_map());
- map.bbt_time (_marker->position(), when);
+ //map.bbt_time (_marker->position(), when);
if (_copy == true) {
_editor->begin_reversible_command (_("copy meter mark"));
@@ -3221,7 +3221,7 @@ MeterMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
if (_marker->meter().position_lock_style() == AudioTime) {
map.add_meter (_marker->meter(), _marker->position());
} else {
- map.add_meter (_marker->meter(), map.bbt_to_beats (when), when);
+ map.add_meter (_marker->meter(), _real_section->pulse(), _real_section->bbt());
}
XMLNode &after = map.get_state();
@@ -3233,7 +3233,7 @@ MeterMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
if (_marker->meter().position_lock_style() == AudioTime) {
map.replace_meter (*_real_section, _marker->meter(), _marker->position());
} else {
- map.replace_meter (*_real_section, _marker->meter(), when);
+ map.replace_meter (*_real_section, _marker->meter(), _real_section->bbt());
}
XMLNode &after = map.get_state();
@@ -3366,7 +3366,8 @@ TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
XMLNode &before = map.get_state();
if (_marker->tempo().position_lock_style() == MusicTime) {
- map.add_tempo (_marker->tempo(), _real_section->beat(), _marker->tempo().type());
+ double const beat = map.predict_tempo_beat (_real_section, _marker->tempo(), _real_section->frame());
+ map.add_tempo (_marker->tempo(), beat, _marker->tempo().type());
} else {
map.add_tempo (_marker->tempo(), _real_section->frame(), _marker->tempo().type());
}
@@ -3378,9 +3379,12 @@ TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
} else {
/* we removed it before, so add it back now */
if (_marker->tempo().position_lock_style() == MusicTime) {
- map.replace_tempo (*_real_section, _marker->tempo().beats_per_minute() , _real_section->beat(), _marker->tempo().type());
+ double const beat = map.predict_tempo_beat (_real_section, _marker->tempo(), _real_section->frame());
+ map.replace_tempo (*_real_section, Tempo (_marker->tempo().beats_per_minute(), _marker->tempo().note_type())
+ , beat, _marker->tempo().type());
} else {
- map.replace_tempo (*_real_section, _marker->tempo().beats_per_minute() , _real_section->frame(), _marker->tempo().type());
+ map.replace_tempo (*_real_section, Tempo (_marker->tempo().beats_per_minute(), _marker->tempo().note_type())
+ , _real_section->frame(), _marker->tempo().type());
}
XMLNode &after = map.get_state();
@@ -3401,7 +3405,7 @@ TempoMarkerDrag::aborted (bool moved)
TempoMap& map (_editor->session()->tempo_map());
/* we removed it before, so add it back now */
if (_marker->tempo().position_lock_style() == MusicTime) {
- map.add_tempo (_marker->tempo(), _marker->tempo().beat(), _marker->tempo().type());
+ map.add_tempo (_marker->tempo(), _marker->tempo().pulse(), _marker->tempo().type());
} else {
map.add_tempo (_marker->tempo(), _marker->tempo().frame(), _marker->tempo().type());
}
diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc
index 067c05f593..57ee38069b 100644
--- a/gtk2_ardour/editor_rulers.cc
+++ b/gtk2_ardour/editor_rulers.cc
@@ -1109,15 +1109,11 @@ Editor::compute_bbt_ruler_scale (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
i--;
/* XX ?? */
- /*
if ((*i).beat >= (*grid.begin()).beat) {
bbt_bars = (*i).bar - (*grid.begin()).bar;
} else {
bbt_bars = (*i).bar - (*grid.begin()).bar;
}
- */
- /*XXX totally wrong */
- bbt_bars = (floor (_session->tempo_map().beat_at_frame (upper)) - floor (_session->tempo_map().beat_at_frame (lower))) / 4;
beats = distance (grid.begin(), grid.end()) - bbt_bars;
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index f31735fcd2..1ef0086f92 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -2512,8 +2512,6 @@ MidiRegionView::move_selection(double dx, double dy, double cumulative_dy)
to_play.push_back ((*i)->note());
}
(*i)->move_event(dx, dy);
- Note* canvas_note = dynamic_cast<Note*>(*i);
- canvas_note->set_x1 (snap_to_pixel (canvas_note->x1(), false));
}
if (dy && !_selection.empty() && !_no_sound_notes && UIConfiguration::instance().get_sound_midi_notes()) {
diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc
index 0d982a4085..0cd616a1ff 100644
--- a/gtk2_ardour/tempo_dialog.cc
+++ b/gtk2_ardour/tempo_dialog.cc
@@ -64,7 +64,7 @@ TempoDialog::TempoDialog (TempoMap& map, TempoSection& section, const string&)
, tap_tempo_button (_("Tap tempo"))
{
Timecode::BBT_Time when;
- map.bbt_time (map.frame_at_beat (section.beat()), when);
+ map.bbt_time (section.frame(), when);
init (when, section.beats_per_minute(), section.note_type(), section.type(), section.movable(), section.position_lock_style());
}
@@ -425,7 +425,7 @@ MeterDialog::MeterDialog (TempoMap& map, MeterSection& section, const string&)
: ArdourDialog (_("Edit Meter"))
{
Timecode::BBT_Time when;
- map.bbt_time (map.frame_at_beat (section.beat()), when);
+ map.bbt_time (section.frame(), when);
init (when, section.divisions_per_bar(), section.note_divisor(), section.movable(), section.position_lock_style());
}