Calculate clamped tempo stretch ratios using the correct (musical) domain
This commit is contained in:
@@ -3628,7 +3628,7 @@ BBTRulerDrag::motion (GdkEvent* event, bool first_move)
|
||||
|
||||
if (ArdourKeyboard::indicates_constraint (event->button.state)) {
|
||||
/* adjust previous tempo to match pointer frame */
|
||||
_editor->session()->tempo_map().gui_stretch_tempo (_tempo, map.frame_at_quarter_note (_grab_qn), pf);
|
||||
_editor->session()->tempo_map().gui_stretch_tempo (_tempo, map.frame_at_quarter_note (_grab_qn), pf, _grab_qn, map.quarter_note_at_frame (pf));
|
||||
}
|
||||
|
||||
ostringstream sstr;
|
||||
|
||||
@@ -513,7 +513,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
|
||||
void gui_set_tempo_position (TempoSection*, const framepos_t& frame, const int& sub_num);
|
||||
void gui_set_meter_position (MeterSection*, const framepos_t& frame);
|
||||
bool gui_change_tempo (TempoSection*, const Tempo& bpm);
|
||||
void gui_stretch_tempo (TempoSection* tempo, const framepos_t frame, const framepos_t end_frame);
|
||||
void gui_stretch_tempo (TempoSection* tempo, const framepos_t frame, const framepos_t end_frame, const double start_qnote, const double end_qnote);
|
||||
void gui_stretch_tempo_end (TempoSection* tempo, const framepos_t frame, const framepos_t end_frame);
|
||||
bool gui_twist_tempi (TempoSection* first, const Tempo& bpm, const framepos_t frame, const framepos_t end_frame);
|
||||
|
||||
|
||||
@@ -3351,7 +3351,7 @@ TempoMap::gui_change_tempo (TempoSection* ts, const Tempo& bpm)
|
||||
}
|
||||
|
||||
void
|
||||
TempoMap::gui_stretch_tempo (TempoSection* ts, const framepos_t frame, const framepos_t end_frame)
|
||||
TempoMap::gui_stretch_tempo (TempoSection* ts, const framepos_t frame, const framepos_t end_frame, const double start_qnote, const double end_qnote)
|
||||
{
|
||||
/*
|
||||
Ts (future prev_t) Tnext
|
||||
@@ -3388,14 +3388,14 @@ TempoMap::gui_stretch_tempo (TempoSection* ts, const framepos_t frame, const fra
|
||||
*/
|
||||
double contribution = 0.0;
|
||||
if (next_t && prev_to_prev_t && prev_to_prev_t->type() == TempoSection::Ramp) {
|
||||
contribution = (prev_t->frame() - prev_to_prev_t->frame()) / (double) (next_t->frame() - prev_to_prev_t->frame());
|
||||
contribution = (prev_t->pulse() - prev_to_prev_t->pulse()) / (double) (next_t->pulse() - prev_to_prev_t->pulse());
|
||||
}
|
||||
framepos_t const fr_off = (end_frame - frame);
|
||||
const frameoffset_t prev_t_frame_contribution = fr_off - (contribution * (double) fr_off);
|
||||
framepos_t const fr_off = end_frame - frame;
|
||||
frameoffset_t const prev_t_frame_contribution = fr_off - (contribution * (double) fr_off);
|
||||
|
||||
if (frame > prev_to_prev_t->frame() + min_dframe && (frame + prev_t_frame_contribution) > prev_to_prev_t->frame() + min_dframe) {
|
||||
new_bpm = prev_t->note_types_per_minute() * ((frame - prev_to_prev_t->frame())
|
||||
/ (double) ((frame + prev_t_frame_contribution) - prev_to_prev_t->frame()));
|
||||
new_bpm = prev_t->note_types_per_minute() * ((start_qnote - (prev_to_prev_t->pulse() * 4.0))
|
||||
/ (end_qnote - (prev_to_prev_t->pulse() * 4.0)));
|
||||
} else {
|
||||
new_bpm = prev_t->note_types_per_minute();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user