remove public ::bbt_at (INTEGER) methods, because of superclock_t/samplepos_t confusion
libtemporal still needs ::bbt_at (superclock_t) fairly often so retain it as a private method, but public interfaces take either Beats or timepos_t
This commit is contained in:
parent
53e411c011
commit
8bada4b5e1
|
@ -2736,7 +2736,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
|
|||
|
||||
if (valid && (flags & PORT_INPUT)) {
|
||||
if ((flags & PORT_POSITION)) {
|
||||
Temporal::BBT_Time bbt (metric.bbt_at (samples_to_superclock (start0, AudioEngine::instance()->sample_rate())));
|
||||
Temporal::BBT_Time bbt (metric.bbt_at (timepos_t (start0)));
|
||||
double bpm = metric.tempo().note_types_per_minute();
|
||||
double time_scale = Port::speed_ratio ();
|
||||
double beatpos = (bbt.bars - 1) * metric.meter().divisions_per_bar()
|
||||
|
@ -3118,7 +3118,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
|
|||
* so it needs to be realative to that.
|
||||
*/
|
||||
_current_bpm = metric.tempo().note_types_per_minute();
|
||||
Temporal::BBT_Time bbt (metric.bbt_at (start0));
|
||||
Temporal::BBT_Time bbt (metric.bbt_at (timepos_t (start0)));
|
||||
double beatpos = (bbt.bars - 1) * metric.divisions_per_bar()
|
||||
+ (bbt.beats - 1)
|
||||
+ (bbt.ticks / Temporal::ticks_per_beat);
|
||||
|
|
|
@ -533,7 +533,7 @@ Session::start_transport (bool after_loop)
|
|||
|
||||
const double num = tempometric.divisions_per_bar ();
|
||||
/* XXX possible optimization: get meter and BBT time in one call */
|
||||
const Temporal::BBT_Time bbt = tmap->bbt_at (_transport_sample);
|
||||
const Temporal::BBT_Time bbt = tmap->bbt_at (timepos_t (_transport_sample));
|
||||
const double bar_fract = (double) bbt.beats / tempometric.divisions_per_bar();
|
||||
|
||||
_count_in_samples = tempometric.samples_per_bar (_current_sample_rate);
|
||||
|
|
|
@ -203,7 +203,7 @@ intptr_t Session::vst_callback (
|
|||
Temporal::BBT_Time bbt;
|
||||
|
||||
try {
|
||||
bbt = tmap->bbt_at (now);
|
||||
bbt = tmap->bbt_at (timepos_t (now));
|
||||
bbt.beats = 1;
|
||||
bbt.ticks = 0;
|
||||
/* exact quarter note */
|
||||
|
|
|
@ -636,7 +636,7 @@ VST3Plugin::connect_and_run (BufferSet& bufs,
|
|||
{
|
||||
TempoMap::SharedPtr tmap (TempoMap::use());
|
||||
const TempoMetric& metric (tmap->metric_at (start));
|
||||
const BBT_Time& bbt (metric.bbt_at (start));
|
||||
const BBT_Time& bbt (metric.bbt_at (timepos_t (start)));
|
||||
|
||||
context.tempo = metric.tempo().quarter_notes_per_minute ();
|
||||
context.timeSigNumerator = metric.meter().divisions_per_bar ();
|
||||
|
|
|
@ -129,7 +129,7 @@ JACKSession::timebase_callback (jack_transport_state_t /*state*/,
|
|||
TempoMetric metric (tempo_map->metric_at (tf));
|
||||
|
||||
try {
|
||||
bbt = tempo_map->bbt_at (tf);
|
||||
bbt = tempo_map->bbt_at (timepos_t (tf));
|
||||
|
||||
pos->bar = bbt.bars;
|
||||
pos->beat = bbt.beats;
|
||||
|
|
|
@ -549,7 +549,7 @@ void
|
|||
BasicUI::jump_by_bars (int bars, LocateTransportDisposition ltd)
|
||||
{
|
||||
TempoMap::SharedPtr tmap (TempoMap::use());
|
||||
Temporal::BBT_Time bbt (tmap->bbt_at (session->transport_sample()));
|
||||
Temporal::BBT_Time bbt (tmap->bbt_at (timepos_t (session->transport_sample())));
|
||||
|
||||
bars += bbt.bars;
|
||||
if (bars < 0) {
|
||||
|
|
|
@ -268,7 +268,7 @@ FaderPort8::periodic ()
|
|||
_timecode = Timecode::timecode_format_time(TC);
|
||||
|
||||
char buf[16];
|
||||
Temporal::BBT_Time BBT = Temporal::TempoMap::use()->bbt_at (session->transport_sample ());
|
||||
Temporal::BBT_Time BBT = Temporal::TempoMap::use()->bbt_at (timepos_t (session->transport_sample ()));
|
||||
snprintf (buf, sizeof (buf),
|
||||
" %02" PRIu32 "|%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32,
|
||||
BBT.bars % 100, BBT.beats %100,
|
||||
|
|
|
@ -603,7 +603,7 @@ TrackMixLayout::update_clocks ()
|
|||
}
|
||||
|
||||
char buf[16];
|
||||
Temporal::BBT_Time BBT = Temporal::TempoMap::use()->bbt_at (pos);
|
||||
Temporal::BBT_Time BBT = Temporal::TempoMap::use()->bbt_at (timepos_t (pos));
|
||||
|
||||
#define BBT_BAR_CHAR "|"
|
||||
|
||||
|
|
|
@ -573,8 +573,14 @@ MeterPoint::get_state () const
|
|||
}
|
||||
|
||||
Temporal::BBT_Time
|
||||
TempoMetric::bbt_at (superclock_t sc) const
|
||||
TempoMetric::bbt_at (timepos_t const & pos) const
|
||||
{
|
||||
if (pos.is_beats()) {
|
||||
return bbt_at (pos.beats());
|
||||
}
|
||||
|
||||
superclock_t sc = pos.superclocks();
|
||||
|
||||
const Beats dq = _tempo->quarters_at_superclock (sc) - _meter->beats();
|
||||
|
||||
DEBUG_TRACE (DEBUG::TemporalMap, string_compose ("qn @ %1 = %2, meter @ %3 , delta %4\n", sc, _tempo->quarters_at_superclock (sc), _meter->beats(), dq));
|
||||
|
@ -1207,7 +1213,7 @@ TempoMap::move_meter (MeterPoint const & mp, timepos_t const & when, bool push)
|
|||
|
||||
/* compute the BBT at the given superclock position, given the prior TempoMetric */
|
||||
|
||||
bbt = metric.bbt_at (sc);
|
||||
bbt = metric.bbt_at (timepos_t::from_superclock (sc));
|
||||
|
||||
/* meter changes must fall on a bar change */
|
||||
|
||||
|
@ -1460,7 +1466,7 @@ TempoMap::set_meter (Meter const & m, timepos_t const & time)
|
|||
|
||||
/* meter changes must be on bar */
|
||||
|
||||
bbt = metric.bbt_at (sc);
|
||||
bbt = metric.bbt_at (time);
|
||||
bbt = metric.round_to_bar (bbt);
|
||||
|
||||
/* compute beat position */
|
||||
|
@ -1509,7 +1515,7 @@ TempoMap::bbt_at (timepos_t const & pos) const
|
|||
Temporal::BBT_Time
|
||||
TempoMap::bbt_at (superclock_t s) const
|
||||
{
|
||||
return metric_at (s).bbt_at (s);
|
||||
return metric_at (s).bbt_at (timepos_t::from_superclock (s));
|
||||
}
|
||||
|
||||
Temporal::BBT_Time
|
||||
|
@ -1691,7 +1697,7 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
|
|||
|
||||
/* determine the BBT at start */
|
||||
|
||||
BBT_Time bbt = metric.bbt_at (start);
|
||||
BBT_Time bbt = metric.bbt_at (timepos_t::from_superclock (start));
|
||||
|
||||
DEBUG_TRACE (DEBUG::Grid, string_compose ("start %1 is %2\n", start, bbt));
|
||||
|
||||
|
@ -1835,7 +1841,7 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
|
|||
|
||||
step = metric.superclocks_per_grid_at (start);
|
||||
start += step;
|
||||
bbt = metric.bbt_at (start);
|
||||
bbt = metric.bbt_at (timepos_t::from_superclock (start));
|
||||
DEBUG_TRACE (DEBUG::Grid, string_compose ("step for note type was %1, now @ %2\n", step, start));
|
||||
|
||||
} else {
|
||||
|
@ -1966,7 +1972,7 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
|
|||
}
|
||||
|
||||
start += step;
|
||||
bbt = metric.bbt_at (start);
|
||||
bbt = metric.bbt_at (timepos_t::from_superclock (start));
|
||||
|
||||
} while (start < end);
|
||||
|
||||
|
@ -2197,7 +2203,7 @@ TempoMap::bbt_walk (BBT_Time const & bbt, BBT_Offset const & o) const
|
|||
pos += metric.superclocks_per_bar ();
|
||||
}
|
||||
|
||||
return metric.bbt_at (pos);
|
||||
return metric.bbt_at (timepos_t::from_superclock (pos));
|
||||
}
|
||||
|
||||
Temporal::Beats
|
||||
|
|
|
@ -497,7 +497,7 @@ class LIBTEMPORAL_API TempoMetric {
|
|||
return int_div_round (superclocks_per_note_type_at_superclock (sc) * _tempo->note_type(), (int64_t) _meter->note_value());
|
||||
}
|
||||
|
||||
BBT_Time bbt_at (superclock_t sc) const;
|
||||
BBT_Time bbt_at (timepos_t const &) const;
|
||||
superclock_t superclock_at (BBT_Time const &) const;
|
||||
|
||||
samplepos_t samples_per_bar (samplecnt_t sr) const {
|
||||
|
@ -757,8 +757,6 @@ class LIBTEMPORAL_API TempoMap : public PBD::StatefulDestructible
|
|||
return metric_at (bbt).meter().round_to_bar (bbt);
|
||||
}
|
||||
|
||||
BBT_Time bbt_at (superclock_t sc) const;
|
||||
BBT_Time bbt_at (Beats const &) const;
|
||||
BBT_Time bbt_at (timepos_t const &) const;
|
||||
|
||||
Beats quarters_at (BBT_Time const &) const;
|
||||
|
@ -850,6 +848,9 @@ class LIBTEMPORAL_API TempoMap : public PBD::StatefulDestructible
|
|||
|
||||
void copy_points (TempoMap const & other);
|
||||
|
||||
BBT_Time bbt_at (Beats const &) const;
|
||||
BBT_Time bbt_at (superclock_t sc) const;
|
||||
|
||||
/* parsing legacy tempo maps */
|
||||
|
||||
struct LegacyTempoState
|
||||
|
|
|
@ -648,7 +648,7 @@ timepos_t::earlier (Temporal::BBT_Offset const & offset) const
|
|||
TempoMap::SharedPtr tm (TempoMap::use());
|
||||
|
||||
if (is_superclock()) {
|
||||
return timepos_t (tm->superclock_at (tm->bbt_walk (tm->bbt_at (superclocks()), -offset)));
|
||||
return timepos_t (tm->superclock_at (tm->bbt_walk (tm->bbt_at (*this), -offset)));
|
||||
}
|
||||
|
||||
return timepos_t (tm->bbtwalk_to_quarters (beats(), -offset));
|
||||
|
@ -747,7 +747,7 @@ timepos_t::shift_earlier (Temporal::BBT_Offset const & offset)
|
|||
TempoMap::SharedPtr tm (TempoMap::use());
|
||||
|
||||
if (is_superclock()) {
|
||||
v = build (false, (tm->superclock_at (tm->bbt_walk (tm->bbt_at (superclocks()), -offset))));
|
||||
v = build (false, (tm->superclock_at (tm->bbt_walk (tm->bbt_at (*this), -offset))));
|
||||
} else {
|
||||
v = build (true, tm->bbtwalk_to_quarters (beats(), -offset).to_ticks());
|
||||
}
|
||||
|
@ -764,7 +764,7 @@ timepos_t::operator+= (Temporal::BBT_Offset const & offset)
|
|||
if (is_beats()) {
|
||||
v = build (true, tm->bbtwalk_to_quarters (beats(), offset).to_ticks());
|
||||
} else {
|
||||
v = build (false, tm->superclock_at (tm->bbt_walk (tm->bbt_at (superclocks()), offset)));
|
||||
v = build (false, tm->superclock_at (tm->bbt_walk (tm->bbt_at (*this), offset)));
|
||||
}
|
||||
|
||||
return *this;
|
||||
|
|
Loading…
Reference in New Issue
Block a user