mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 20:26:30 +01:00
Tempo ramps - one approach to audio-locked meters.
- audio-locked meters retain their 'home' bar position unless altered by another metric. this is an alternative to a more strict model which isn't quite so flexible.
This commit is contained in:
parent
4f8fa6787a
commit
b24ce3fbe9
2 changed files with 23 additions and 14 deletions
|
|
@ -3197,7 +3197,6 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move)
|
||||||
}
|
}
|
||||||
|
|
||||||
framepos_t const pf = adjusted_current_frame (event, false);
|
framepos_t const pf = adjusted_current_frame (event, false);
|
||||||
_marker->set_position (pf);
|
|
||||||
if (_marker->meter().position_lock_style() == MusicTime) {
|
if (_marker->meter().position_lock_style() == MusicTime) {
|
||||||
TempoMap& map (_editor->session()->tempo_map());
|
TempoMap& map (_editor->session()->tempo_map());
|
||||||
Timecode::BBT_Time bbt;
|
Timecode::BBT_Time bbt;
|
||||||
|
|
@ -3210,7 +3209,7 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move)
|
||||||
_editor->session()->tempo_map().gui_move_meter (_real_section, pf);
|
_editor->session()->tempo_map().gui_move_meter (_real_section, pf);
|
||||||
}
|
}
|
||||||
_marker->set_position (pf);
|
_marker->set_position (pf);
|
||||||
show_verbose_cursor_time (pf);
|
show_verbose_cursor_time (_real_section->frame());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -1288,10 +1288,16 @@ TempoMap::recompute_meters (Metrics& metrics)
|
||||||
if (meter->movable()) {
|
if (meter->movable()) {
|
||||||
const double beats = ((pulse_at_frame_locked (metrics, meter->frame()) - prev_m->pulse()) * prev_m->note_divisor());
|
const double beats = ((pulse_at_frame_locked (metrics, meter->frame()) - prev_m->pulse()) * prev_m->note_divisor());
|
||||||
const double floor_beats = beats - fmod (beats, prev_m->divisions_per_bar());
|
const double floor_beats = beats - fmod (beats, prev_m->divisions_per_bar());
|
||||||
b_bbt = make_pair (floor_beats + prev_m->beat(), BBT_Time ((floor_beats / prev_m->divisions_per_bar()) + prev_m->bbt().bars, 1, 0));
|
if (floor_beats + prev_m->beat() < meter->beat()) {
|
||||||
const double true_pulse = prev_m->pulse() + (floor_beats / prev_m->note_divisor());
|
/* tempo change caused a change in beat (bar). */
|
||||||
const double pulse_off = true_pulse - (beats / prev_m->note_divisor()) - prev_m->pulse();
|
b_bbt = make_pair (floor_beats + prev_m->beat(), BBT_Time ((floor_beats / prev_m->divisions_per_bar()) + prev_m->bbt().bars, 1, 0));
|
||||||
pulse = true_pulse - pulse_off;
|
const double true_pulse = prev_m->pulse() + (floor_beats / prev_m->note_divisor());
|
||||||
|
const double pulse_off = true_pulse - (beats / prev_m->note_divisor()) - prev_m->pulse();
|
||||||
|
pulse = true_pulse - pulse_off;
|
||||||
|
} else {
|
||||||
|
b_bbt = make_pair (meter->beat(), meter->bbt());
|
||||||
|
pulse = pulse_at_frame_locked (metrics, meter->frame());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
b_bbt = make_pair (0.0, BBT_Time (1, 1, 0));
|
b_bbt = make_pair (0.0, BBT_Time (1, 1, 0));
|
||||||
}
|
}
|
||||||
|
|
@ -2028,8 +2034,6 @@ TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const framepos_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
section->set_frame (frame);
|
|
||||||
|
|
||||||
for (Metrics::iterator i = imaginary.begin(); i != imaginary.end(); ++i) {
|
for (Metrics::iterator i = imaginary.begin(); i != imaginary.end(); ++i) {
|
||||||
MeterSection* m;
|
MeterSection* m;
|
||||||
if ((m = dynamic_cast<MeterSection*> (*i)) != 0) {
|
if ((m = dynamic_cast<MeterSection*> (*i)) != 0) {
|
||||||
|
|
@ -2037,7 +2041,7 @@ TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const framepos_t
|
||||||
/*
|
/*
|
||||||
here we set the beat for this frame.
|
here we set the beat for this frame.
|
||||||
we set it 'incorrectly' to the next bar's first beat
|
we set it 'incorrectly' to the next bar's first beat
|
||||||
and use the delat to find the meter's pulse.
|
and use the delta to find the meter's pulse.
|
||||||
*/
|
*/
|
||||||
double new_pulse = 0.0;
|
double new_pulse = 0.0;
|
||||||
pair<double, BBT_Time> b_bbt;
|
pair<double, BBT_Time> b_bbt;
|
||||||
|
|
@ -2045,14 +2049,20 @@ TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const framepos_t
|
||||||
if (section->movable()) {
|
if (section->movable()) {
|
||||||
const double beats = ((pulse_at_frame_locked (imaginary, frame) - prev_m->pulse()) * prev_m->note_divisor());
|
const double beats = ((pulse_at_frame_locked (imaginary, frame) - prev_m->pulse()) * prev_m->note_divisor());
|
||||||
const double floor_beats = beats - fmod (beats, prev_m->divisions_per_bar());
|
const double floor_beats = beats - fmod (beats, prev_m->divisions_per_bar());
|
||||||
b_bbt = make_pair (floor_beats + prev_m->beat(), BBT_Time ((floor_beats / prev_m->divisions_per_bar()) + prev_m->bbt().bars, 1, 0));
|
if (floor_beats + prev_m->beat() < section->beat()) {
|
||||||
const double true_pulse = prev_m->pulse() + (floor_beats / prev_m->note_divisor());
|
/* disallow position change if it will alter out beat
|
||||||
const double pulse_off = true_pulse - (beats / prev_m->note_divisor()) - prev_m->pulse();
|
we allow tempo changes to do this in recompute_meters().
|
||||||
new_pulse = true_pulse - pulse_off;
|
blocking this is an option, but i'm not convinced that
|
||||||
|
this is what the user would actually want.
|
||||||
|
*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
b_bbt = make_pair (section->beat(), section->bbt());
|
||||||
|
new_pulse = pulse_at_frame_locked (imaginary, frame);
|
||||||
} else {
|
} else {
|
||||||
b_bbt = make_pair (0.0, BBT_Time (1, 1, 0));
|
b_bbt = make_pair (0.0, BBT_Time (1, 1, 0));
|
||||||
}
|
}
|
||||||
|
section->set_frame (frame);
|
||||||
section->set_beat (b_bbt);
|
section->set_beat (b_bbt);
|
||||||
section->set_pulse (new_pulse);
|
section->set_pulse (new_pulse);
|
||||||
prev_m = m;
|
prev_m = m;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue