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 (valid && (flags & PORT_INPUT)) {
|
||||||
if ((flags & PORT_POSITION)) {
|
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 bpm = metric.tempo().note_types_per_minute();
|
||||||
double time_scale = Port::speed_ratio ();
|
double time_scale = Port::speed_ratio ();
|
||||||
double beatpos = (bbt.bars - 1) * metric.meter().divisions_per_bar()
|
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.
|
* so it needs to be realative to that.
|
||||||
*/
|
*/
|
||||||
_current_bpm = metric.tempo().note_types_per_minute();
|
_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()
|
double beatpos = (bbt.bars - 1) * metric.divisions_per_bar()
|
||||||
+ (bbt.beats - 1)
|
+ (bbt.beats - 1)
|
||||||
+ (bbt.ticks / Temporal::ticks_per_beat);
|
+ (bbt.ticks / Temporal::ticks_per_beat);
|
||||||
|
|
|
@ -533,7 +533,7 @@ Session::start_transport (bool after_loop)
|
||||||
|
|
||||||
const double num = tempometric.divisions_per_bar ();
|
const double num = tempometric.divisions_per_bar ();
|
||||||
/* XXX possible optimization: get meter and BBT time in one call */
|
/* 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();
|
const double bar_fract = (double) bbt.beats / tempometric.divisions_per_bar();
|
||||||
|
|
||||||
_count_in_samples = tempometric.samples_per_bar (_current_sample_rate);
|
_count_in_samples = tempometric.samples_per_bar (_current_sample_rate);
|
||||||
|
|
|
@ -203,7 +203,7 @@ intptr_t Session::vst_callback (
|
||||||
Temporal::BBT_Time bbt;
|
Temporal::BBT_Time bbt;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
bbt = tmap->bbt_at (now);
|
bbt = tmap->bbt_at (timepos_t (now));
|
||||||
bbt.beats = 1;
|
bbt.beats = 1;
|
||||||
bbt.ticks = 0;
|
bbt.ticks = 0;
|
||||||
/* exact quarter note */
|
/* exact quarter note */
|
||||||
|
|
|
@ -636,7 +636,7 @@ VST3Plugin::connect_and_run (BufferSet& bufs,
|
||||||
{
|
{
|
||||||
TempoMap::SharedPtr tmap (TempoMap::use());
|
TempoMap::SharedPtr tmap (TempoMap::use());
|
||||||
const TempoMetric& metric (tmap->metric_at (start));
|
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.tempo = metric.tempo().quarter_notes_per_minute ();
|
||||||
context.timeSigNumerator = metric.meter().divisions_per_bar ();
|
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));
|
TempoMetric metric (tempo_map->metric_at (tf));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
bbt = tempo_map->bbt_at (tf);
|
bbt = tempo_map->bbt_at (timepos_t (tf));
|
||||||
|
|
||||||
pos->bar = bbt.bars;
|
pos->bar = bbt.bars;
|
||||||
pos->beat = bbt.beats;
|
pos->beat = bbt.beats;
|
||||||
|
|
|
@ -549,7 +549,7 @@ void
|
||||||
BasicUI::jump_by_bars (int bars, LocateTransportDisposition ltd)
|
BasicUI::jump_by_bars (int bars, LocateTransportDisposition ltd)
|
||||||
{
|
{
|
||||||
TempoMap::SharedPtr tmap (TempoMap::use());
|
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;
|
bars += bbt.bars;
|
||||||
if (bars < 0) {
|
if (bars < 0) {
|
||||||
|
|
|
@ -268,7 +268,7 @@ FaderPort8::periodic ()
|
||||||
_timecode = Timecode::timecode_format_time(TC);
|
_timecode = Timecode::timecode_format_time(TC);
|
||||||
|
|
||||||
char buf[16];
|
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),
|
snprintf (buf, sizeof (buf),
|
||||||
" %02" PRIu32 "|%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32,
|
" %02" PRIu32 "|%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32,
|
||||||
BBT.bars % 100, BBT.beats %100,
|
BBT.bars % 100, BBT.beats %100,
|
||||||
|
|
|
@ -603,7 +603,7 @@ TrackMixLayout::update_clocks ()
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf[16];
|
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 "|"
|
#define BBT_BAR_CHAR "|"
|
||||||
|
|
||||||
|
|
|
@ -573,8 +573,14 @@ MeterPoint::get_state () const
|
||||||
}
|
}
|
||||||
|
|
||||||
Temporal::BBT_Time
|
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();
|
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));
|
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 */
|
/* 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 */
|
/* 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 */
|
/* meter changes must be on bar */
|
||||||
|
|
||||||
bbt = metric.bbt_at (sc);
|
bbt = metric.bbt_at (time);
|
||||||
bbt = metric.round_to_bar (bbt);
|
bbt = metric.round_to_bar (bbt);
|
||||||
|
|
||||||
/* compute beat position */
|
/* compute beat position */
|
||||||
|
@ -1509,7 +1515,7 @@ TempoMap::bbt_at (timepos_t const & pos) const
|
||||||
Temporal::BBT_Time
|
Temporal::BBT_Time
|
||||||
TempoMap::bbt_at (superclock_t s) const
|
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
|
Temporal::BBT_Time
|
||||||
|
@ -1691,7 +1697,7 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
|
||||||
|
|
||||||
/* determine the BBT at start */
|
/* 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));
|
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);
|
step = metric.superclocks_per_grid_at (start);
|
||||||
start += step;
|
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));
|
DEBUG_TRACE (DEBUG::Grid, string_compose ("step for note type was %1, now @ %2\n", step, start));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1966,7 +1972,7 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
|
||||||
}
|
}
|
||||||
|
|
||||||
start += step;
|
start += step;
|
||||||
bbt = metric.bbt_at (start);
|
bbt = metric.bbt_at (timepos_t::from_superclock (start));
|
||||||
|
|
||||||
} while (start < end);
|
} while (start < end);
|
||||||
|
|
||||||
|
@ -2197,7 +2203,7 @@ TempoMap::bbt_walk (BBT_Time const & bbt, BBT_Offset const & o) const
|
||||||
pos += metric.superclocks_per_bar ();
|
pos += metric.superclocks_per_bar ();
|
||||||
}
|
}
|
||||||
|
|
||||||
return metric.bbt_at (pos);
|
return metric.bbt_at (timepos_t::from_superclock (pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
Temporal::Beats
|
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());
|
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;
|
superclock_t superclock_at (BBT_Time const &) const;
|
||||||
|
|
||||||
samplepos_t samples_per_bar (samplecnt_t sr) 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);
|
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;
|
BBT_Time bbt_at (timepos_t const &) const;
|
||||||
|
|
||||||
Beats quarters_at (BBT_Time 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);
|
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 */
|
/* parsing legacy tempo maps */
|
||||||
|
|
||||||
struct LegacyTempoState
|
struct LegacyTempoState
|
||||||
|
|
|
@ -648,7 +648,7 @@ timepos_t::earlier (Temporal::BBT_Offset const & offset) const
|
||||||
TempoMap::SharedPtr tm (TempoMap::use());
|
TempoMap::SharedPtr tm (TempoMap::use());
|
||||||
|
|
||||||
if (is_superclock()) {
|
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));
|
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());
|
TempoMap::SharedPtr tm (TempoMap::use());
|
||||||
|
|
||||||
if (is_superclock()) {
|
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 {
|
} else {
|
||||||
v = build (true, tm->bbtwalk_to_quarters (beats(), -offset).to_ticks());
|
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()) {
|
if (is_beats()) {
|
||||||
v = build (true, tm->bbtwalk_to_quarters (beats(), offset).to_ticks());
|
v = build (true, tm->bbtwalk_to_quarters (beats(), offset).to_ticks());
|
||||||
} else {
|
} 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;
|
return *this;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user