void
MeterMarkerDrag::motion (GdkEvent* event, bool first_move)
{
- if (!_marker->meter().movable()) {
- //return;
- }
-
if (first_move) {
// create a dummy marker to catch events, then hide it.
if (!_real_section->active()) {
return;
}
+
if (first_move) {
// mvc drag - create a dummy marker to catch events, hide it.
} else if (use_snap) {
map.round_bbt (bbt, _editor->get_grid_beat_divisions (0), RoundNearest);
}
- double const pulse = map.predict_tempo_pulse (_real_section, map.frame_time (bbt));
+ double const pulse = map.predict_tempo_pulse (_real_section, bbt);
_real_section = map.add_tempo (_marker->tempo(), pulse, 0, _real_section->type(), MusicTime);
} else {
if (use_snap && _editor->snap_type() == SnapToBar) {
if (_real_section->position_lock_style() == MusicTime) {
- const double pulse = map.predict_tempo_pulse (_real_section, pf);
+ const double pulse = map.predict_tempo_pulse (_real_section, when);
when = map.pulse_to_bbt (pulse);
if (use_snap && _editor->snap_type() == SnapToBar) {
map.round_bbt (when, -1, (pf > _real_section->frame()) ? RoundUpMaybe : RoundDownMaybe);
begin_reversible_command (_("replace tempo mark"));
XMLNode &before = _session->tempo_map().get_state();
- framepos_t const f = _session->tempo_map().predict_tempo_frame (section, when);
- double const p = _session->tempo_map().predict_tempo_pulse (section, f);
- _session->tempo_map().replace_tempo (*section, Tempo (bpm, nt), p, f, tempo_dialog.get_tempo_type(), tempo_dialog.get_lock_style());
+ if (tempo_dialog.get_lock_style() == AudioTime) {
+ framepos_t const f = _session->tempo_map().predict_tempo_frame (section, when);
+ _session->tempo_map().replace_tempo (*section, Tempo (bpm, nt), 0.0, f, tempo_dialog.get_tempo_type(), AudioTime);
+ } else {
+ double const p = _session->tempo_map().predict_tempo_pulse (section, when);
+ _session->tempo_map().replace_tempo (*section, Tempo (bpm, nt), p, 0, tempo_dialog.get_tempo_type(), MusicTime);
+ }
XMLNode &after = _session->tempo_map().get_state();
_session->add_command (new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
void remove_meter (const MeterSection&, bool send_signal);
framepos_t predict_tempo_frame (TempoSection* section, const Timecode::BBT_Time& bbt);
- double predict_tempo_pulse (TempoSection* section, const framepos_t& frame);
+ double predict_tempo_pulse (TempoSection* section, const Timecode::BBT_Time& bbt);
void replace_tempo (const TempoSection&, const Tempo&, const double& pulse, const framepos_t& frame
, TempoSection::Type type, PositionLockStyle pls);
}
double
-TempoMap::predict_tempo_pulse (TempoSection* section, const framepos_t& frame)
+TempoMap::predict_tempo_pulse (TempoSection* section, const BBT_Time& bbt)
{
Glib::Threads::RWLock::ReaderLock lm (lock);
Metrics future_map;
double ret = 0.0;
TempoSection* tempo_copy = copy_metrics_and_point (_metrics, future_map, section);
+ const double beat = bbt_to_beats_locked (future_map, bbt);
- if (solve_map_frame (future_map, tempo_copy, frame)) {
+ if (solve_map_pulse (future_map, tempo_copy, pulse_at_beat_locked (future_map, beat))) {
ret = tempo_copy->pulse();
} else {
ret = section->pulse();