Tempo rampo - tempo tick lines no longer assume constant tempo.
This commit is contained in:
parent
a7df009de7
commit
15f8f371c3
|
@ -74,8 +74,17 @@ TempoLines::draw_ticks (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
|
||||||
/* draw line with alpha corresponding to coarsest level */
|
/* draw line with alpha corresponding to coarsest level */
|
||||||
const uint8_t a = max(8, (int)rint(UINT_RGBA_A(base) / (0.8 * log2(level))));
|
const uint8_t a = max(8, (int)rint(UINT_RGBA_A(base) / (0.8 * log2(level))));
|
||||||
const uint32_t c = UINT_RGBA_CHANGE_A(base, a);
|
const uint32_t c = UINT_RGBA_CHANGE_A(base, a);
|
||||||
const framepos_t f = grid.begin()->frame + (l * (fpb / (double)divisions));
|
framepos_t f = 0;
|
||||||
//const framepos_t f = frame_at_tick (last_beat_in_ticks + (l * (BBT_Time::ticks_per_beat / (double)divisions)));
|
|
||||||
|
if (grid.begin()->c != 0.0) {
|
||||||
|
const double pulses_per_div = l * (grid.begin()->tempo.note_type() / grid.begin()->meter->note_divisor()) / divisions;
|
||||||
|
const double time_at_pulse = log (((grid.begin()->c * (pulses_per_div / grid.begin()->tempo.note_type())) /
|
||||||
|
grid.begin()->tempo.pulses_per_minute()) + 1) / grid.begin()->c;
|
||||||
|
f = grid.begin()->frame + (framecnt_t) floor ((time_at_pulse * 60.0 * frame_rate) + 0.5);
|
||||||
|
} else {
|
||||||
|
f = grid.begin()->frame + (l * (fpb / (double)divisions));
|
||||||
|
}
|
||||||
|
|
||||||
if (f > leftmost_frame) {
|
if (f > leftmost_frame) {
|
||||||
lines.add (PublicEditor::instance().sample_to_pixel_unrounded (f), 1.0, c);
|
lines.add (PublicEditor::instance().sample_to_pixel_unrounded (f), 1.0, c);
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,12 +307,13 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
|
||||||
framepos_t frame;
|
framepos_t frame;
|
||||||
const MeterSection* meter;
|
const MeterSection* meter;
|
||||||
const Tempo tempo;
|
const Tempo tempo;
|
||||||
|
double c;
|
||||||
uint32_t bar;
|
uint32_t bar;
|
||||||
uint32_t beat;
|
uint32_t beat;
|
||||||
|
|
||||||
BBTPoint (const MeterSection& m, const Tempo& t, framepos_t f,
|
BBTPoint (const MeterSection& m, const Tempo& t, framepos_t f,
|
||||||
uint32_t b, uint32_t e)
|
uint32_t b, uint32_t e, double func_c)
|
||||||
: frame (f), meter (&m), tempo (t.beats_per_minute(), t.note_type()), bar (b), beat (e) {}
|
: frame (f), meter (&m), tempo (t.beats_per_minute(), t.note_type()), c (func_c), bar (b), beat (e) {}
|
||||||
|
|
||||||
Timecode::BBT_Time bbt() const { return Timecode::BBT_Time (bar, beat, 0); }
|
Timecode::BBT_Time bbt() const { return Timecode::BBT_Time (bar, beat, 0); }
|
||||||
operator Timecode::BBT_Time() const { return bbt(); }
|
operator Timecode::BBT_Time() const { return bbt(); }
|
||||||
|
@ -458,6 +459,7 @@ private:
|
||||||
|
|
||||||
const MeterSection& meter_section_at_locked (framepos_t frame) const;
|
const MeterSection& meter_section_at_locked (framepos_t frame) const;
|
||||||
const TempoSection& tempo_section_at_locked (framepos_t frame) const;
|
const TempoSection& tempo_section_at_locked (framepos_t frame) const;
|
||||||
|
const Tempo tempo_at_locked (const framepos_t& frame) const;
|
||||||
|
|
||||||
bool check_solved (Metrics& metrics, bool by_frame);
|
bool check_solved (Metrics& metrics, bool by_frame);
|
||||||
bool solve_map (Metrics& metrics, TempoSection* section, const Tempo& bpm, const framepos_t& frame);
|
bool solve_map (Metrics& metrics, TempoSection* section, const Tempo& bpm, const framepos_t& frame);
|
||||||
|
|
|
@ -940,7 +940,6 @@ TempoMap::replace_meter (const MeterSection& ms, const Meter& meter, const BBT_T
|
||||||
{
|
{
|
||||||
Glib::Threads::RWLock::WriterLock lm (lock);
|
Glib::Threads::RWLock::WriterLock lm (lock);
|
||||||
MeterSection& first (first_meter());
|
MeterSection& first (first_meter());
|
||||||
TempoSection& first_t (first_tempo());
|
|
||||||
|
|
||||||
const PositionLockStyle pl = ms.position_lock_style();
|
const PositionLockStyle pl = ms.position_lock_style();
|
||||||
if (ms.pulse() != first.pulse()) {
|
if (ms.pulse() != first.pulse()) {
|
||||||
|
@ -965,7 +964,6 @@ TempoMap::replace_meter (const MeterSection& ms, const Meter& meter, const frame
|
||||||
MeterSection& first (first_meter());
|
MeterSection& first (first_meter());
|
||||||
TempoSection& first_t (first_tempo());
|
TempoSection& first_t (first_tempo());
|
||||||
|
|
||||||
const PositionLockStyle pl = ms.position_lock_style();
|
|
||||||
if (ms.pulse() != first.pulse()) {
|
if (ms.pulse() != first.pulse()) {
|
||||||
remove_meter_locked (ms);
|
remove_meter_locked (ms);
|
||||||
add_meter_locked (meter, frame, true);
|
add_meter_locked (meter, frame, true);
|
||||||
|
@ -1450,6 +1448,7 @@ TempoMap::recompute_tempos (Metrics& metrics)
|
||||||
prev_ts = t;
|
prev_ts = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
prev_ts->set_c_func (0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tempos must be positioned correctly */
|
/* tempos must be positioned correctly */
|
||||||
|
@ -2551,7 +2550,7 @@ TempoMap::get_grid (vector<TempoMap::BBTPoint>& points,
|
||||||
MeterSection const meter = meter_section_at_locked (pos);
|
MeterSection const meter = meter_section_at_locked (pos);
|
||||||
BBT_Time const bbt = beats_to_bbt (cnt);
|
BBT_Time const bbt = beats_to_bbt (cnt);
|
||||||
|
|
||||||
points.push_back (BBTPoint (meter, Tempo (tempo.beats_per_minute(), tempo.note_type()), pos, bbt.bars, bbt.beats));
|
points.push_back (BBTPoint (meter, tempo_at_locked (pos), pos, bbt.bars, bbt.beats, tempo.get_c_func()));
|
||||||
++cnt;
|
++cnt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2630,6 +2629,12 @@ const Tempo
|
||||||
TempoMap::tempo_at (const framepos_t& frame) const
|
TempoMap::tempo_at (const framepos_t& frame) const
|
||||||
{
|
{
|
||||||
Glib::Threads::RWLock::ReaderLock lm (lock);
|
Glib::Threads::RWLock::ReaderLock lm (lock);
|
||||||
|
return tempo_at_locked (frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Tempo
|
||||||
|
TempoMap::tempo_at_locked (const framepos_t& frame) const
|
||||||
|
{
|
||||||
//frameoffset_t const frame_off = frame_offset_at (_metrics, frame);
|
//frameoffset_t const frame_off = frame_offset_at (_metrics, frame);
|
||||||
TempoSection* prev_ts = 0;
|
TempoSection* prev_ts = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user