Tempo ramps - multiple audio-locked meters are go.
- more or less
This commit is contained in:
parent
b341e6cfaa
commit
094aa816df
@ -1262,10 +1262,11 @@ TempoMap::recompute_meters (Metrics& metrics)
|
||||
double pulse = 0.0;
|
||||
pair<double, BBT_Time> b_bbt;
|
||||
if (meter->movable()) {
|
||||
const double beats = ((pulse_at_frame_locked (metrics, meter->frame()) - prev_m->pulse()) * prev_m->note_divisor()) - prev_m->beat();
|
||||
b_bbt = make_pair (ceil (beats), BBT_Time (accumulated_bars + 1, 1, 0));
|
||||
const double true_pulse = prev_m->pulse() + (ceil (beats) - prev_m->beat()) / prev_m->note_divisor();
|
||||
double beats = ((pulse_at_frame_locked (metrics, meter->frame()) - prev_m->pulse()) * prev_m->note_divisor()) - prev_m->beat();
|
||||
double ceil_beats = beats + prev_m->divisions_per_bar() - 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));
|
||||
pulse = true_pulse - pulse_off;
|
||||
} else {
|
||||
b_bbt = make_pair (0.0, BBT_Time (1, 1, 0));
|
||||
@ -2014,16 +2015,15 @@ TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const Meter& mt,
|
||||
if (m == section){
|
||||
/*
|
||||
here we set the beat for this frame.
|
||||
we're going to set it 'incorrectly' to the next integer and use this difference
|
||||
to find the meter's pulse.
|
||||
(meters should fall on integral beats to keep us sane)
|
||||
XXX do it to the bar, you fool, not the beat! - and don't forget to recompute_meters that way too.
|
||||
we set it 'incorrectly' to the next bar's beat
|
||||
and use this difference to find the meter's pulse.
|
||||
*/
|
||||
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();
|
||||
b_bbt = make_pair (ceil (beats), BBT_Time (accumulated_bars + 1, 1, 0));
|
||||
double ceil_beats = beats + prev_ms->divisions_per_bar() - 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 pulse_off = true_pulse - ((beats - prev_ms->beat()) / prev_ms->note_divisor());
|
||||
pulse = true_pulse - pulse_off;
|
||||
@ -2044,10 +2044,11 @@ TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const Meter& mt,
|
||||
double pulse = 0.0;
|
||||
pair<double, BBT_Time> b_bbt;
|
||||
if (m->movable()) {
|
||||
const double beats = ((pulse_at_frame_locked (imaginary, m->frame()) - prev_ms->pulse()) * prev_ms->note_divisor()) - prev_ms->beat();
|
||||
double beats = ((pulse_at_frame_locked (imaginary, m->frame()) - prev_ms->pulse()) * prev_ms->note_divisor()) - prev_ms->beat();
|
||||
double ceil_beats = beats + prev_ms->divisions_per_bar() - 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 - ((beats - prev_ms->beat()) / prev_ms->note_divisor());
|
||||
b_bbt = make_pair (ceil (beats), BBT_Time (accumulated_bars + 1, 1, 0));
|
||||
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));
|
||||
pulse = true_pulse - pulse_off;
|
||||
} else {
|
||||
b_bbt = make_pair (0.0, BBT_Time (1, 1, 0));
|
||||
@ -2102,11 +2103,20 @@ TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const Meter& mt,
|
||||
m->set_frame (frame_at_pulse_locked (imaginary, pulse));
|
||||
m->set_pulse (pulse);
|
||||
} else {
|
||||
if (!m->movable()) {
|
||||
pair<double, BBT_Time> b_bbt = make_pair (0.0, BBT_Time (1, 1, 0));
|
||||
m->set_beat (b_bbt);
|
||||
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 + prev_ms->divisions_per_bar() - 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));
|
||||
pulse = true_pulse - pulse_off;
|
||||
} else {
|
||||
b_bbt = make_pair (0.0, BBT_Time (1, 1, 0));
|
||||
pulse = 0.0;
|
||||
}
|
||||
const double pulse = prev_ms->pulse() + (m->beat() - prev_ms->beat()) / prev_ms->note_divisor();
|
||||
m->set_beat (b_bbt);
|
||||
m->set_pulse (pulse);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user