Tempo ramps - switch MusicLocked tempos to beat-based dragging. fix various bugs wrt future-snapped tempo drags
This commit is contained in:
parent
a2797f4d38
commit
354567e5a7
@ -2157,6 +2157,8 @@ Editor::snap_musical() const
|
||||
case SnapToBeatDiv4:
|
||||
case SnapToBeatDiv3:
|
||||
case SnapToBeatDiv2:
|
||||
case SnapToBeat:
|
||||
case SnapToBar:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
|
@ -3317,18 +3317,29 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
|
||||
}
|
||||
|
||||
framepos_t pf;
|
||||
double beat = 0.0;
|
||||
|
||||
if (!_editor->snap_musical()) {
|
||||
pf = adjusted_current_frame (event);
|
||||
} else {
|
||||
pf = adjusted_current_frame (event);
|
||||
pf = adjusted_current_frame (event, false);
|
||||
Timecode::BBT_Time when;
|
||||
_editor->session()->tempo_map().bbt_time (pf, when);
|
||||
if (_editor->snap_type() == SnapToBar) {
|
||||
_editor->session()->tempo_map().round_bbt (when, -1);
|
||||
if (_real_section->position_lock_style() == MusicTime) {
|
||||
if (_editor->snap_type() == SnapToBar) {
|
||||
_editor->session()->tempo_map().round_bbt (when, -1);
|
||||
} else {
|
||||
_editor->session()->tempo_map().round_bbt (when, _editor->get_grid_beat_divisions (0));
|
||||
}
|
||||
beat = _editor->session()->tempo_map().bbt_to_beats (when);
|
||||
} else {
|
||||
_editor->session()->tempo_map().round_bbt (when, _editor->get_grid_beat_divisions (0));
|
||||
if (_editor->snap_type() == SnapToBar) {
|
||||
_editor->session()->tempo_map().round_bbt (when, -1);
|
||||
} else {
|
||||
_editor->session()->tempo_map().round_bbt (when, _editor->get_grid_beat_divisions (0));
|
||||
}
|
||||
pf = _editor->session()->tempo_map().predict_tempo_frame (_real_section, Tempo (_real_section->beats_per_minute(), _real_section->note_type()), when);
|
||||
}
|
||||
pf = _editor->session()->tempo_map().predict_tempo_frame (_real_section, Tempo (_real_section->beats_per_minute(), _real_section->note_type()), when);
|
||||
}
|
||||
Tempo const tp = _marker->tempo();
|
||||
|
||||
@ -3340,17 +3351,14 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
|
||||
show_verbose_cursor_text (strs.str());
|
||||
} else if (_movable) {
|
||||
|
||||
_marker->set_position (pf);
|
||||
/* just here for a check/laugh
|
||||
if (_real_section->position_lock_style() == MusicTime) {
|
||||
const double baf = _editor->session()->tempo_map().beat_at_frame (pf);
|
||||
_editor->session()->tempo_map().gui_move_tempo_beat (_real_section, tp, baf);
|
||||
} else {
|
||||
*/
|
||||
_editor->session()->tempo_map().gui_move_tempo_frame (_real_section, tp, pf);
|
||||
//}
|
||||
if (_real_section->position_lock_style() == MusicTime) {
|
||||
_editor->session()->tempo_map().gui_move_tempo_beat (_real_section, tp, beat);
|
||||
} else {
|
||||
_editor->session()->tempo_map().gui_move_tempo_frame (_real_section, tp, pf);
|
||||
}
|
||||
show_verbose_cursor_time (pf);
|
||||
}
|
||||
_marker->set_position (pf);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1146,7 +1146,7 @@ TempoMap::gui_move_tempo_beat (TempoSection* ts, const Tempo& bpm, const double
|
||||
Glib::Threads::RWLock::WriterLock lm (lock);
|
||||
TempoSection* new_section = copy_metrics_and_point (future_map, ts);
|
||||
if (solve_map (future_map, new_section, bpm, pulse_at_beat_locked (future_map, beat))) {
|
||||
solve_map (_metrics, ts, bpm, beat);
|
||||
solve_map (_metrics, ts, bpm, pulse_at_beat_locked (_metrics, beat));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2492,16 +2492,14 @@ TempoMap::round_bbt (BBT_Time& when, const int32_t& sub_num)
|
||||
return;
|
||||
} else if (sub_num == 0) {
|
||||
const double bpb = meter_section_at (bbt_to_beats_locked (_metrics, when)).divisions_per_bar();
|
||||
if (when.ticks > BBT_Time::ticks_per_beat / 2) {
|
||||
if ((double) when.ticks > BBT_Time::ticks_per_beat / 2.0) {
|
||||
++when.beats;
|
||||
while ((double) when.beats > bpb) {
|
||||
++when.bars;
|
||||
when.beats -= (uint32_t) floor (bpb);
|
||||
}
|
||||
when.ticks = 0;
|
||||
} else {
|
||||
when.ticks = 0;
|
||||
}
|
||||
when.ticks = 0;
|
||||
return;
|
||||
}
|
||||
const uint32_t ticks_one_subdivisions_worth = BBT_Time::ticks_per_beat / sub_num;
|
||||
|
Loading…
Reference in New Issue
Block a user