Tempo ramps - calculate bars correctly when setting meter position.
This commit is contained in:
parent
2c25913d26
commit
324e51c734
@ -1257,7 +1257,7 @@ TempoMap::recompute_meters (Metrics& metrics)
|
||||
if (prev_m) {
|
||||
double beats_in_m;
|
||||
if (meter->position_lock_style() == MusicTime) {
|
||||
beats_in_m = (meter->pulse() - prev_m->pulse()) * prev_m->note_divisor();
|
||||
beats_in_m = meter->beat() - prev_m->beat();
|
||||
} else {
|
||||
beats_in_m = ((pulse_at_frame_locked (metrics, meter->frame()) - prev_m->pulse()) * prev_m->note_divisor()) - prev_m->beat();
|
||||
}
|
||||
@ -1267,8 +1267,8 @@ TempoMap::recompute_meters (Metrics& metrics)
|
||||
double pulse = 0.0;
|
||||
pair<double, BBT_Time> b_bbt;
|
||||
if (meter->movable()) {
|
||||
double beats = ((pulse_at_frame_locked (metrics, meter->frame()) - prev_m->pulse()) * prev_m->note_divisor()) - prev_m->beat();
|
||||
double ceil_beats = beats - fmod (beats, prev_m->divisions_per_bar());
|
||||
const double beats = ((pulse_at_frame_locked (metrics, meter->frame()) - prev_m->pulse()) * prev_m->note_divisor()) - prev_m->beat();
|
||||
const double ceil_beats = beats - fmod (beats, prev_m->divisions_per_bar());
|
||||
const double true_pulse = prev_m->pulse() + (ceil_beats - prev_m->beat()) / prev_m->note_divisor();
|
||||
const double pulse_off = true_pulse - ((beats - prev_m->beat()) / prev_m->note_divisor());
|
||||
b_bbt = make_pair (ceil_beats, BBT_Time (accumulated_bars + 1, 1, 0));
|
||||
@ -2016,7 +2016,7 @@ TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const Meter& mt,
|
||||
if (prev_ms) {
|
||||
double beats_in_m;
|
||||
if (m->position_lock_style() == MusicTime) {
|
||||
beats_in_m = (m->pulse() - prev_ms->pulse()) * prev_ms->note_divisor();
|
||||
beats_in_m = m->beat() - prev_ms->beat();
|
||||
} else {
|
||||
beats_in_m = ((pulse_at_frame_locked (imaginary, frame) - prev_ms->pulse()) * prev_ms->note_divisor()) - prev_ms->beat();
|
||||
}
|
||||
@ -2031,10 +2031,12 @@ TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const Meter& mt,
|
||||
double pulse = 0.0;
|
||||
pair<double, BBT_Time> b_bbt;
|
||||
if (m->movable()) {
|
||||
double beats = ((pulse_at_frame_locked (imaginary, frame) - prev_ms->pulse()) * prev_ms->note_divisor()) - prev_ms->beat();
|
||||
double ceil_beats = beats - fmod (beats, prev_ms->divisions_per_bar());
|
||||
b_bbt = make_pair (ceil_beats, BBT_Time (accumulated_bars + 1, 1, 0));
|
||||
const double true_pulse = prev_ms->pulse() + ((ceil (beats) - prev_ms->beat()) / prev_ms->note_divisor());
|
||||
const double beats = ((pulse_at_frame_locked (imaginary, frame) - prev_ms->pulse()) * prev_ms->note_divisor()) - prev_ms->beat();
|
||||
const double ceil_beats = beats - fmod (beats, prev_ms->divisions_per_bar());
|
||||
const int32_t bars = (ceil_beats + 1) / prev_ms->divisions_per_bar();
|
||||
|
||||
b_bbt = make_pair (ceil_beats, BBT_Time (bars + 1, 1, 0));
|
||||
const double true_pulse = prev_ms->pulse() + ((ceil_beats - prev_ms->beat()) / prev_ms->note_divisor());
|
||||
const double pulse_off = true_pulse - ((beats - prev_ms->beat()) / prev_ms->note_divisor());
|
||||
pulse = true_pulse - pulse_off;
|
||||
} else {
|
||||
@ -2054,8 +2056,8 @@ TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const Meter& mt,
|
||||
double pulse = 0.0;
|
||||
pair<double, BBT_Time> b_bbt;
|
||||
if (m->movable()) {
|
||||
double beats = ((pulse_at_frame_locked (imaginary, m->frame()) - prev_ms->pulse()) * prev_ms->note_divisor()) - prev_ms->beat();
|
||||
double ceil_beats = beats - fmod (beats , prev_ms->divisions_per_bar());
|
||||
const double beats = ((pulse_at_frame_locked (imaginary, m->frame()) - prev_ms->pulse()) * prev_ms->note_divisor()) - prev_ms->beat();
|
||||
const double ceil_beats = beats - fmod (beats , prev_ms->divisions_per_bar());
|
||||
const double true_pulse = prev_ms->pulse() + (m->beat() - prev_ms->beat()) / prev_ms->note_divisor();
|
||||
const double pulse_off = true_pulse - ((ceil_beats - prev_ms->beat()) / prev_ms->note_divisor());
|
||||
b_bbt = make_pair (ceil_beats, BBT_Time (accumulated_bars + 1, 1, 0));
|
||||
@ -2098,7 +2100,7 @@ TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const Meter& mt,
|
||||
if (prev_ms) {
|
||||
double beats_in_m;
|
||||
if (m->position_lock_style() == MusicTime) {
|
||||
beats_in_m = (m->pulse() - prev_ms->pulse()) * prev_ms->note_divisor();
|
||||
beats_in_m = m->beat() - prev_ms->beat();
|
||||
} else {
|
||||
beats_in_m = ((pulse_at_frame_locked (imaginary, m->frame()) - prev_ms->pulse()) * prev_ms->note_divisor()) - prev_ms->beat();
|
||||
}
|
||||
@ -2107,7 +2109,9 @@ TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const Meter& mt,
|
||||
}
|
||||
if (m == section){
|
||||
section->set_frame (frame_at_pulse_locked (imaginary, pulse));
|
||||
pair<double, BBT_Time> b_bbt = make_pair (accumulated_beats, BBT_Time (accumulated_bars + 1, 1, 0));
|
||||
const double beats = ((pulse - prev_ms->pulse()) * prev_ms->note_divisor()) - prev_ms->beat();
|
||||
const int32_t bars = (beats + 1) / prev_ms->divisions_per_bar();
|
||||
pair<double, BBT_Time> b_bbt = make_pair (beats, BBT_Time (bars + 1, 1, 0));
|
||||
section->set_beat (b_bbt);
|
||||
prev_ms = section;
|
||||
continue;
|
||||
@ -2121,8 +2125,8 @@ TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const Meter& mt,
|
||||
double pulse = 0.0;
|
||||
pair<double, BBT_Time> b_bbt;
|
||||
if (m->movable()) {
|
||||
double beats = ((pulse_at_frame_locked (imaginary, m->frame()) - prev_ms->pulse()) * prev_ms->note_divisor()) - prev_ms->beat();
|
||||
double ceil_beats = beats - fmod (beats , prev_ms->divisions_per_bar());
|
||||
const double beats = ((pulse_at_frame_locked (imaginary, m->frame()) - prev_ms->pulse()) * prev_ms->note_divisor()) - prev_ms->beat();
|
||||
const double ceil_beats = beats - fmod (beats, prev_ms->divisions_per_bar());
|
||||
const double true_pulse = prev_ms->pulse() + (m->beat() - prev_ms->beat()) / prev_ms->note_divisor();
|
||||
const double pulse_off = true_pulse - ((ceil_beats - prev_ms->beat()) / prev_ms->note_divisor());
|
||||
b_bbt = make_pair (ceil_beats, BBT_Time (accumulated_bars + 1, 1, 0));
|
||||
|
Loading…
Reference in New Issue
Block a user