change Timecode::BBT_Time to use Temporal namespace, plus a couple of other minor changes to enable compilation

This still uses the tempo map object in libs/ardour, not the new one in libs/temporal, and isn't likely to be functional
(though it could be)
This commit is contained in:
Paul Davis 2020-07-23 17:46:49 -06:00
parent 9abf90c9d5
commit f4490f54c5
40 changed files with 356 additions and 184 deletions

View file

@ -1177,7 +1177,7 @@ void
AudioClock::set_bbt (samplepos_t when, samplecnt_t offset, bool /*force*/)
{
char buf[64];
Timecode::BBT_Time BBT;
Temporal::BBT_Time BBT;
bool negative = false;
if (_off || when >= _limit_pos || when < -_limit_pos) {
@ -1206,7 +1206,7 @@ AudioClock::set_bbt (samplepos_t when, samplecnt_t offset, bool /*force*/)
}
const double divisions = tmap.meter_section_at_sample (offset).divisions_per_bar();
Timecode::BBT_Time sub_bbt;
Temporal::BBT_Time sub_bbt;
if (negative) {
BBT = tmap.bbt_at_beat (tmap.beat_at_sample (offset));
@ -1225,7 +1225,7 @@ AudioClock::set_bbt (samplepos_t when, samplecnt_t offset, bool /*force*/)
} else {
BBT.beats--;
}
BBT.ticks = Timecode::BBT_Time::ticks_per_beat - (sub_bbt.ticks - BBT.ticks);
BBT.ticks = Temporal::ticks_per_beat - (sub_bbt.ticks - BBT.ticks);
} else {
BBT.ticks -= sub_bbt.ticks;
}
@ -1832,7 +1832,7 @@ samplepos_t
AudioClock::get_sample_step (Field field, samplepos_t pos, int dir)
{
samplecnt_t f = 0;
Timecode::BBT_Time BBT;
Temporal::BBT_Time BBT;
switch (field) {
case Timecode_Hours:
f = (samplecnt_t) floor (3600.0 * _session->sample_rate());
@ -1934,7 +1934,7 @@ AudioClock::bbt_validate_edit (string & str)
return false;
}
if (any.bbt.ticks > Timecode::BBT_Time::ticks_per_beat) {
if (any.bbt.ticks > Temporal::ticks_per_beat) {
return false;
}
@ -2094,7 +2094,7 @@ AudioClock::sample_duration_from_bbt_string (samplepos_t pos, const string& str)
return 0;
}
Timecode::BBT_Time bbt;
Temporal::BBT_Time bbt;
if (sscanf (str.c_str(), BBT_SCANF_FORMAT, &bbt.bars, &bbt.beats, &bbt.ticks) != 3) {
return 0;

View file

@ -504,7 +504,7 @@ AutomationLine::ContiguousControlPoints::compute_x_bounds (PublicEditor& e)
const samplepos_t pos = e.pixel_to_sample(before_x);
const Meter& meter = map.meter_at_sample (pos);
const samplecnt_t len = ceil (meter.samples_per_bar (map.tempo_at_sample (pos), e.session()->sample_rate())
/ (Timecode::BBT_Time::ticks_per_beat * meter.divisions_per_bar()) );
/ (Temporal::ticks_per_beat * meter.divisions_per_bar()) );
const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len);
before_x += one_tick_in_pixels;
@ -520,7 +520,7 @@ AutomationLine::ContiguousControlPoints::compute_x_bounds (PublicEditor& e)
const samplepos_t pos = e.pixel_to_sample(after_x);
const Meter& meter = map.meter_at_sample (pos);
const samplecnt_t len = ceil (meter.samples_per_bar (map.tempo_at_sample (pos), e.session()->sample_rate())
/ (Timecode::BBT_Time::ticks_per_beat * meter.divisions_per_bar()));
/ (Temporal::ticks_per_beat * meter.divisions_per_bar()));
const double one_tick_in_pixels = e.sample_to_pixel_unrounded (len);
after_x -= one_tick_in_pixels;

View file

@ -291,7 +291,7 @@ Editor::import_smf_tempo_map (Evoral::SMF const & smf, samplepos_t pos)
Tempo tempo (t->tempo(), 32.0 / (double) t->notes_per_note);
Meter meter (t->numerator, t->denominator);
Timecode::BBT_Time bbt; /* 1|1|0 which is correct for the no-meter case */
Temporal::BBT_Time bbt; /* 1|1|0 which is correct for the no-meter case */
if (have_initial_meter) {
new_map.add_tempo (tempo, t->time_pulses/ (double)smf.ppqn() / 4.0, 0, MusicTime);

View file

@ -3142,7 +3142,7 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move)
} else {
_editor->begin_reversible_command (_("copy meter mark"));
Timecode::BBT_Time bbt = _real_section->bbt();
Temporal::BBT_Time bbt = _real_section->bbt();
/* we can't add a meter where one currently exists */
if (_real_section->sample() < adjusted_current_sample (event, false)) {

View file

@ -1509,7 +1509,7 @@ Editor::toggle_marker_lock_style ()
MeterSection* msp = &mm->meter();
const Meter meter (msp->divisions_per_bar(), msp->note_divisor());
const Timecode::BBT_Time bbt (msp->bbt());
const Temporal::BBT_Time bbt (msp->bbt());
const PositionLockStyle pls = (msp->position_lock_style() == AudioTime) ? MusicTime : AudioTime;
_session->tempo_map().replace_meter (*msp, meter, bbt, msp->sample(), pls);

View file

@ -603,7 +603,7 @@ EditorRegions::clock_format_changed ()
void
EditorRegions::format_position (samplepos_t pos, char* buf, size_t bufsize, bool onoff)
{
Timecode::BBT_Time bbt;
Temporal::BBT_Time bbt;
Timecode::Time timecode;
if (pos < 0) {
@ -772,7 +772,7 @@ EditorRegions::populate_row_length (boost::shared_ptr<Region> region, TreeModel:
if (ARDOUR_UI::instance ()->primary_clock->mode () == AudioClock::BBT) {
TempoMap& map (_session->tempo_map ());
Timecode::BBT_Time bbt = map.bbt_at_beat (map.beat_at_sample (region->last_sample ()) - map.beat_at_sample (region->first_sample ()));
Temporal::BBT_Time bbt = map.bbt_at_beat (map.beat_at_sample (region->last_sample ()) - map.beat_at_sample (region->first_sample ()));
snprintf (buf, sizeof (buf), "%03d|%02d|%04d", bbt.bars, bbt.beats, bbt.ticks);
} else {
format_position (region->length (), buf, sizeof (buf));

View file

@ -977,7 +977,9 @@ Editor::compute_bbt_ruler_scale (samplepos_t lower, samplepos_t upper)
return;
}
Timecode::BBT_Time lower_beat, upper_beat; // the beats at each end of the ruler
std::vector<TempoMap::BBTPoint>::const_iterator i;
Temporal::BBT_Time lower_beat, upper_beat; // the beats at each end of the ruler
double floor_lower_beat = floor(std::max (0.0, _session->tempo_map().beat_at_sample (lower)));
if (floor_lower_beat < 0.0) {
@ -1083,7 +1085,7 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
char buf[64];
gint n = 0;
samplepos_t pos;
Timecode::BBT_Time next_beat;
Temporal::BBT_Time next_beat;
uint32_t beats = 0;
uint32_t tick = 0;
uint32_t skip;
@ -1362,11 +1364,11 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
}
/* Add the tick marks */
skip = Timecode::BBT_Time::ticks_per_beat / bbt_beat_subdivision;
skip = Temporal::ticks_per_beat / bbt_beat_subdivision;
tick = skip; // the first non-beat tick
t = 0;
while (tick < Timecode::BBT_Time::ticks_per_beat && (n < bbt_nmarks)) {
while (tick < Temporal::ticks_per_beat && (n < bbt_nmarks)) {
next_beat.beats = (*i).beat;
next_beat.bars = (*i).bar;
@ -1401,6 +1403,181 @@ Editor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, gdouble l
break;
case bbt_show_thirtyseconds:
beats = distance (grid.begin(), grid.end());
bbt_nmarks = (beats + 2) * bbt_beat_subdivision;
bbt_position_of_helper = lower + (3 * Editor::get_current_zoom ());
mark.label = "";
mark.position = lower;
mark.style = ArdourCanvas::Ruler::Mark::Micro;
marks.push_back (mark);
for (n = 1, i = grid.begin(); n < bbt_nmarks && i != grid.end(); ++i) {
if ((*i).sample < lower && (bbt_bar_helper_on)) {
snprintf (buf, sizeof(buf), "<%" PRIu32 "|%" PRIu32, (*i).bar, (*i).beat);
edit_last_mark_label (marks, buf);
helper_active = true;
} else {
if ((*i).is_bar()) {
mark.style = ArdourCanvas::Ruler::Mark::Major;
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
} else {
mark.style = ArdourCanvas::Ruler::Mark::Minor;
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).beat);
}
if (((*i).sample < bbt_position_of_helper) && helper_active) {
buf[0] = '\0';
}
mark.label = buf;
mark.position = (*i).sample;
marks.push_back (mark);
n++;
}
/* Add the tick marks */
skip = Temporal::ticks_per_beat / bbt_beat_subdivision;
next_beat.beats = (*i).beat;
next_beat.bars = (*i).bar;
tick = skip; // the first non-beat tick
t = 0;
while (tick < Temporal::ticks_per_beat && (n < bbt_nmarks)) {
next_beat.ticks = tick;
pos = _session->tempo_map().sample_at_bbt (next_beat);
if (t % bbt_accent_modulo == (bbt_accent_modulo - 1)) {
i_am_accented = true;
}
if (pos > bbt_position_of_helper) {
snprintf (buf, sizeof(buf), "%" PRIu32, tick);
} else {
buf[0] = '\0';
}
mark.label = buf;
mark.position = pos;
if ((bbt_beat_subdivision > 4) && i_am_accented) {
mark.style = ArdourCanvas::Ruler::Mark::Minor;
} else {
mark.style = ArdourCanvas::Ruler::Mark::Micro;
}
i_am_accented = false;
marks.push_back (mark);
tick += skip;
++t;
++n;
}
}
break;
case bbt_show_many:
bbt_nmarks = 1;
snprintf (buf, sizeof(buf), "cannot handle %" PRIu32 " bars", bbt_bars);
mark.style = ArdourCanvas::Ruler::Mark::Major;
mark.label = buf;
mark.position = lower;
marks.push_back (mark);
break;
case bbt_show_64:
bbt_nmarks = (gint) (bbt_bars / 64) + 1;
for (n = 0, i = grid.begin(); i != grid.end() && n < bbt_nmarks; i++) {
if ((*i).is_bar()) {
if ((*i).bar % 64 == 1) {
if ((*i).bar % 256 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
mark.style = ArdourCanvas::Ruler::Mark::Major;
} else {
buf[0] = '\0';
if ((*i).bar % 256 == 129) {
mark.style = ArdourCanvas::Ruler::Mark::Minor;
} else {
mark.style = ArdourCanvas::Ruler::Mark::Micro;
}
}
mark.label = buf;
mark.position = (*i).sample;
marks.push_back (mark);
++n;
}
}
}
break;
case bbt_show_16:
bbt_nmarks = (bbt_bars / 16) + 1;
for (n = 0, i = grid.begin(); i != grid.end() && n < bbt_nmarks; i++) {
if ((*i).is_bar()) {
if ((*i).bar % 16 == 1) {
if ((*i).bar % 64 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
mark.style = ArdourCanvas::Ruler::Mark::Major;
} else {
buf[0] = '\0';
if ((*i).bar % 64 == 33) {
mark.style = ArdourCanvas::Ruler::Mark::Minor;
} else {
mark.style = ArdourCanvas::Ruler::Mark::Micro;
}
}
mark.label = buf;
mark.position = (*i).sample;
marks.push_back (mark);
++n;
}
}
}
break;
case bbt_show_4:
bbt_nmarks = (bbt_bars / 4) + 1;
for (n = 0, i = grid.begin(); i != grid.end() && n < bbt_nmarks; ++i) {
if ((*i).is_bar()) {
if ((*i).bar % 4 == 1) {
if ((*i).bar % 16 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
mark.style = ArdourCanvas::Ruler::Mark::Major;
} else {
buf[0] = '\0';
if ((*i).bar % 16 == 9) {
mark.style = ArdourCanvas::Ruler::Mark::Minor;
} else {
mark.style = ArdourCanvas::Ruler::Mark::Micro;
}
}
mark.label = buf;
mark.position = (*i).sample;
marks.push_back (mark);
++n;
}
}
}
break;
case bbt_show_1:
// default:
bbt_nmarks = bbt_bars + 2;
for (n = 0, i = grid.begin(); i != grid.end() && n < bbt_nmarks; ++i) {
if ((*i).is_bar()) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bbt().bars);
mark.style = ArdourCanvas::Ruler::Mark::Major;
mark.label = buf;
mark.position = (*i).sample;
marks.push_back (mark);
++n;
}
}
break;
}
}

View file

@ -590,7 +590,7 @@ EditorSources::clock_format_changed ()
void
EditorSources::format_position (samplepos_t pos, char* buf, size_t bufsize, bool onoff)
{
Timecode::BBT_Time bbt;
Temporal::BBT_Time bbt;
Timecode::Time timecode;
if (pos < 0) {

View file

@ -449,7 +449,7 @@ Editor::mouse_add_new_meter_event (samplepos_t sample)
double note_type = meter_dialog.get_note_type ();
Timecode::BBT_Time requested;
Temporal::BBT_Time requested;
meter_dialog.get_bbt_time (requested);
const double al_sample = map.sample_at_bbt (requested);
@ -507,7 +507,7 @@ Editor::edit_meter_section (MeterSection* section)
double const note_type = meter_dialog.get_note_type ();
const Meter meter (bpb, note_type);
Timecode::BBT_Time when;
Temporal::BBT_Time when;
meter_dialog.get_bbt_time (when);
const samplepos_t sample = _session->tempo_map().sample_at_bbt (when);
const PositionLockStyle pls = (meter_dialog.get_lock_style() == AudioTime) ? AudioTime : MusicTime;
@ -540,7 +540,7 @@ Editor::edit_tempo_section (TempoSection* section)
bpm = max (0.01, bpm);
const Tempo tempo (bpm, nt, end_bpm);
Timecode::BBT_Time when;
Temporal::BBT_Time when;
tempo_dialog.get_bbt_time (when);
begin_reversible_command (_("replace tempo mark"));

View file

@ -301,10 +301,11 @@ ExportTimespanSelector::bbt_str (samplepos_t samples) const
}
std::ostringstream oss;
Timecode::BBT_Time time;
Temporal::BBT_Time time;
_session->bbt_time (samples, time);
print_padded (oss, time);
time.print_padded (oss);
return oss.str ();
}

View file

@ -48,21 +48,21 @@ using namespace Gtk;
using namespace Gtkmm2ext;
using namespace Glib;
using namespace ARDOUR;
using Timecode::BBT_Time;
using Temporal::BBT_Time;
static map<int,std::string> note_length_map;
static map<int32_t,std::string> note_length_map;
static void
fill_note_length_map ()
{
note_length_map.insert (make_pair<int,string> (BBT_Time::ticks_per_beat, _("Whole")));
note_length_map.insert (make_pair<int,string> (BBT_Time::ticks_per_beat/2, _("Half")));
note_length_map.insert (make_pair<int,string> (BBT_Time::ticks_per_beat/3, _("Triplet")));
note_length_map.insert (make_pair<int,string> (BBT_Time::ticks_per_beat/4, _("Quarter")));
note_length_map.insert (make_pair<int,string> (BBT_Time::ticks_per_beat/8, _("Eighth")));
note_length_map.insert (make_pair<int,string> (BBT_Time::ticks_per_beat/16, _("Sixteenth")));
note_length_map.insert (make_pair<int,string> (BBT_Time::ticks_per_beat/32, _("Thirty-second")));
note_length_map.insert (make_pair<int,string> (BBT_Time::ticks_per_beat/64, _("Sixty-fourth")));
note_length_map.insert (make_pair<int32_t,string> (Temporal::ticks_per_beat/1, _("Whole")));
note_length_map.insert (make_pair<int32_t,string> (Temporal::ticks_per_beat/2, _("Half")));
note_length_map.insert (make_pair<int32_t,string> (Temporal::ticks_per_beat/3, _("Triplet")));
note_length_map.insert (make_pair<int32_t,string> (Temporal::ticks_per_beat/4, _("Quarter")));
note_length_map.insert (make_pair<int32_t,string> (Temporal::ticks_per_beat/8, _("Eighth")));
note_length_map.insert (make_pair<int32_t,string> (Temporal::ticks_per_beat/16, _("Sixteenth")));
note_length_map.insert (make_pair<int32_t,string> (Temporal::ticks_per_beat/32, _("Thirty-second")));
note_length_map.insert (make_pair<int32_t,string> (Temporal::ticks_per_beat/64, _("Sixty-fourth")));
}
MidiListEditor::MidiListEditor (Session* s, boost::shared_ptr<MidiRegion> r, boost::shared_ptr<MidiTrack> tr)
@ -638,7 +638,7 @@ MidiListEditor::edited (const std::string& path, const std::string& text)
if (text.find ('.') == string::npos && text.find (',') == string::npos) {
/* integral => units are ticks */
fval = fval / BBT_Time::ticks_per_beat;
fval = fval / Temporal::ticks_per_beat;
} else {
/* non-integral => beats, so use as-is */
}
@ -666,7 +666,7 @@ MidiListEditor::edited (const std::string& path, const std::string& text)
}
if (x != note_length_map.end()) {
fval = x->first / BBT_Time::ticks_per_beat;
fval = x->first / Temporal::ticks_per_beat;
}
} else {
@ -687,7 +687,7 @@ MidiListEditor::edited (const std::string& path, const std::string& text)
if (x != note_length_map.end()) {
/* convert to beats */
fval = (double) x->first / BBT_Time::ticks_per_beat;
fval = (double) x->first / Temporal::ticks_per_beat;
}
}
}
@ -775,7 +775,7 @@ MidiListEditor::redisplay_model ()
row[columns.note] = (*i)->note();
row[columns.velocity] = (*i)->velocity();
Timecode::BBT_Time bbt (_session->tempo_map().bbt_at_sample (region->position() - region->start() + conv.to ((*i)->time())));
Temporal::BBT_Time bbt (_session->tempo_map().bbt_at_sample (region->position() - region->start() + conv.to ((*i)->time())));
ss.str ("");
ss << bbt;

View file

@ -273,7 +273,7 @@ MiniTimeline::format_time (samplepos_t when)
case AudioClock::BBT:
{
char buf[64];
Timecode::BBT_Time BBT = _session->tempo_map().bbt_at_sample (when);
Temporal::BBT_Time BBT = _session->tempo_map().bbt_at_sample (when);
snprintf (buf, sizeof (buf), "%03" PRIu32 BBT_BAR_CHAR "%02" PRIu32 BBT_BAR_CHAR "%04" PRIu32,
BBT.bars, BBT.beats, BBT.ticks);
_layout->set_text (buf);

View file

@ -79,7 +79,7 @@ QuantizeDialog::QuantizeDialog (PublicEditor& e)
, swing_adjustment (100.0, -130.0, 130.0, 1.0, 10.0)
, swing_spinner (swing_adjustment)
, swing_button (_("Swing"))
, threshold_adjustment (0.0, -Timecode::BBT_Time::ticks_per_beat, Timecode::BBT_Time::ticks_per_beat, 1.0, 10.0)
, threshold_adjustment (0.0, -Temporal::ticks_per_beat, Temporal::ticks_per_beat, 1.0, 10.0)
, threshold_spinner (threshold_adjustment)
, threshold_label (_("Threshold (ticks)"))
, snap_start_button (_("Snap note start"))

View file

@ -56,7 +56,7 @@ TempoDialog::TempoDialog (TempoMap& map, samplepos_t sample, const string&)
, tap_tempo_button (_("Tap tempo"))
{
Tempo tempo (map.tempo_at_sample (sample));
Timecode::BBT_Time when (map.bbt_at_sample (sample));
Temporal::BBT_Time when (map.bbt_at_sample (sample));
init (when, tempo.note_types_per_minute(), tempo.end_note_types_per_minute(), tempo.note_type(), TempoSection::Constant, true, MusicTime);
}
@ -75,13 +75,13 @@ TempoDialog::TempoDialog (TempoMap& map, TempoSection& section, const string&)
, pulse_selector_label (_("Pulse:"), ALIGN_LEFT, ALIGN_CENTER)
, tap_tempo_button (_("Tap tempo"))
{
Timecode::BBT_Time when (map.bbt_at_sample (section.sample()));
Temporal::BBT_Time when (map.bbt_at_sample (section.sample()));
init (when, section.note_types_per_minute(), section.end_note_types_per_minute(), section.note_type(), section.type()
, section.initial() || section.locked_to_meter(), section.position_lock_style());
}
void
TempoDialog::init (const Timecode::BBT_Time& when, double bpm, double end_bpm, double note_type, TempoSection::Type type, bool initial, PositionLockStyle style)
TempoDialog::init (const Temporal::BBT_Time& when, double bpm, double end_bpm, double note_type, TempoSection::Type type, bool initial, PositionLockStyle style)
{
vector<string> strings;
NoteTypes::iterator x;
@ -314,7 +314,7 @@ TempoDialog::bpm_button_release (GdkEventButton*)
bool
TempoDialog::entry_key_release (GdkEventKey*)
{
Timecode::BBT_Time bbt;
Temporal::BBT_Time bbt;
get_bbt_time (bbt);
if (_section && is_user_input_valid()) {
@ -343,7 +343,7 @@ TempoDialog::get_end_bpm ()
}
bool
TempoDialog::get_bbt_time (Timecode::BBT_Time& requested)
TempoDialog::get_bbt_time (Temporal::BBT_Time& requested)
{
if (sscanf (when_bar_entry.get_text().c_str(), "%" PRIu32, &requested.bars) != 1) {
return false;
@ -491,7 +491,7 @@ MeterDialog::MeterDialog (TempoMap& map, samplepos_t sample, const string&)
: ArdourDialog (_("New Meter"))
{
sample = map.round_to_bar(sample, RoundNearest).sample;
Timecode::BBT_Time when (map.bbt_at_sample (sample));
Temporal::BBT_Time when (map.bbt_at_sample (sample));
Meter meter (map.meter_at_sample (sample));
init (when, meter.divisions_per_bar(), meter.note_divisor(), false, MusicTime);
@ -500,13 +500,13 @@ MeterDialog::MeterDialog (TempoMap& map, samplepos_t sample, const string&)
MeterDialog::MeterDialog (TempoMap& map, MeterSection& section, const string&)
: ArdourDialog (_("Edit Meter"))
{
Timecode::BBT_Time when (map.bbt_at_sample (section.sample()));
Temporal::BBT_Time when (map.bbt_at_sample (section.sample()));
init (when, section.divisions_per_bar(), section.note_divisor(), section.initial(), section.position_lock_style());
}
void
MeterDialog::init (const Timecode::BBT_Time& when, double bpb, double divisor, bool initial, PositionLockStyle style)
MeterDialog::init (const Temporal::BBT_Time& when, double bpb, double divisor, bool initial, PositionLockStyle style)
{
char buf[64];
vector<string> strings;
@ -728,7 +728,7 @@ MeterDialog::get_lock_style ()
}
bool
MeterDialog::get_bbt_time (Timecode::BBT_Time& requested)
MeterDialog::get_bbt_time (Temporal::BBT_Time& requested)
{
if (sscanf (when_bar_entry.get_text().c_str(), "%" PRIu32, &requested.bars) != 1) {
return false;

View file

@ -49,12 +49,12 @@ public:
double get_bpm ();
double get_end_bpm ();
double get_note_type ();
bool get_bbt_time (Timecode::BBT_Time&);
bool get_bbt_time (Temporal::BBT_Time&);
ARDOUR::TempoSection::Type get_tempo_type ();
ARDOUR::PositionLockStyle get_lock_style ();
private:
void init (const Timecode::BBT_Time& start, double bpm, double end_bpm, double note_type, ARDOUR::TempoSection::Type type, bool movable, ARDOUR::PositionLockStyle style);
void init (const Temporal::BBT_Time& start, double bpm, double end_bpm, double note_type, ARDOUR::TempoSection::Type type, bool movable, ARDOUR::PositionLockStyle style);
bool is_user_input_valid() const;
void bpm_changed ();
bool bpm_button_press (GdkEventButton* );
@ -113,10 +113,10 @@ public:
double get_bpb ();
double get_note_type ();
ARDOUR::PositionLockStyle get_lock_style ();
bool get_bbt_time (Timecode::BBT_Time&);
bool get_bbt_time (Temporal::BBT_Time&);
private:
void init (const Timecode::BBT_Time&, double, double, bool, ARDOUR::PositionLockStyle style);
void init (const Temporal::BBT_Time&, double, double, bool, ARDOUR::PositionLockStyle style);
bool is_user_input_valid() const;
bool entry_key_press (GdkEventKey* );
bool entry_key_release (GdkEventKey* );

View file

@ -100,7 +100,7 @@ VerboseCursor::set_time (samplepos_t sample)
{
char buf[128];
Timecode::Time timecode;
Timecode::BBT_Time bbt;
Temporal::BBT_Time bbt;
if (_editor->_session == 0) {
return;
@ -142,8 +142,8 @@ VerboseCursor::set_duration (samplepos_t start, samplepos_t end)
{
char buf[128];
Timecode::Time timecode;
Timecode::BBT_Time sbbt;
Timecode::BBT_Time ebbt;
Temporal::BBT_Time sbbt;
Temporal::BBT_Time ebbt;
Meter meter_at_start (_editor->_session->tempo_map().meter_at_sample (start));
if (_editor->_session == 0) {
@ -173,7 +173,7 @@ VerboseCursor::set_duration (samplepos_t start, samplepos_t end)
ticks -= sbbt.ticks;
if (ticks < 0) {
ticks += int (Timecode::BBT_Time::ticks_per_beat);
ticks += int (Temporal::ticks_per_beat);
--beats;
}

View file

@ -780,7 +780,7 @@ public:
void sync_time_vars();
void bbt_time (samplepos_t when, Timecode::BBT_Time&);
void bbt_time (samplepos_t when, Temporal::BBT_Time&);
void timecode_to_sample(Timecode::Time& timecode, samplepos_t& sample, bool use_offset, bool use_subframes) const;
void sample_to_timecode(samplepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const;
void timecode_time (Timecode::Time &);

View file

@ -54,8 +54,8 @@ class Meter;
class TempoMap;
// Find a better place for these
LIBARDOUR_API bool bbt_time_to_string (const Timecode::BBT_Time& bbt, std::string& str);
LIBARDOUR_API bool string_to_bbt_time (const std::string& str, Timecode::BBT_Time& bbt);
LIBARDOUR_API bool bbt_time_to_string (const Temporal::BBT_Time& bbt, std::string& str);
LIBARDOUR_API bool string_to_bbt_time (const std::string& str, Temporal::BBT_Time& bbt);
/** Tempo, the speed at which musical time progresses (BPM). */
class LIBARDOUR_API Tempo {
@ -185,7 +185,7 @@ private:
/** A section of timeline with a certain Meter. */
class LIBARDOUR_API MeterSection : public MetricSection, public Meter {
public:
MeterSection (double pulse, double minute, double beat, const Timecode::BBT_Time& bbt, double bpb, double note_type, PositionLockStyle pls, samplecnt_t sr)
MeterSection (double pulse, double minute, double beat, const Temporal::BBT_Time& bbt, double bpb, double note_type, PositionLockStyle pls, samplecnt_t sr)
: MetricSection (pulse, minute, pls, false, sr), Meter (bpb, note_type), _bbt (bbt), _beat (beat) {}
MeterSection (const XMLNode&, const samplecnt_t sample_rate);
@ -194,17 +194,17 @@ class LIBARDOUR_API MeterSection : public MetricSection, public Meter {
XMLNode& get_state() const;
void set_beat (std::pair<double, Timecode::BBT_Time>& w) {
void set_beat (std::pair<double, Temporal::BBT_Time>& w) {
_beat = w.first;
_bbt = w.second;
}
const Timecode::BBT_Time& bbt() const { return _bbt; }
const Temporal::BBT_Time& bbt() const { return _bbt; }
const double& beat () const { return _beat; }
void set_beat (double beat) { _beat = beat; }
private:
Timecode::BBT_Time _bbt;
Temporal::BBT_Time _bbt;
double _beat;
};
@ -254,7 +254,7 @@ class LIBARDOUR_API TempoSection : public MetricSection, public Tempo {
double pulse_at_sample (const samplepos_t sample) const;
samplepos_t sample_at_pulse (const double& pulse) const;
Timecode::BBT_Time legacy_bbt () { return _legacy_bbt; }
Temporal::BBT_Time legacy_bbt () { return _legacy_bbt; }
private:
@ -287,7 +287,7 @@ class LIBARDOUR_API TempoSection : public MetricSection, public Tempo {
bool _active;
bool _locked_to_meter;
bool _clamped;
Timecode::BBT_Time _legacy_bbt;
Temporal::BBT_Time _legacy_bbt;
};
typedef std::list<MetricSection*> Metrics;
@ -360,8 +360,8 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
uint32_t b, uint32_t e, double qnote)
: meter (m), tempo (t), sample (f), bar (b), beat (e), qn (qnote) {}
Timecode::BBT_Time bbt() const { return Timecode::BBT_Time (bar, beat, 0); }
operator Timecode::BBT_Time() const { return bbt(); }
Temporal::BBT_Time bbt() const { return Temporal::BBT_Time (bar, beat, 0); }
operator Temporal::BBT_Time() const { return bbt(); }
operator samplepos_t() const { return sample; }
bool is_bar() const { return beat == 1; }
};
@ -410,14 +410,14 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
* adding an audio-locked meter will add a meter-locked tempo section at the meter position.
* the meter-locked tempo tempo will be the Tempo at the beat
*/
MeterSection* add_meter (const Meter& meter, const Timecode::BBT_Time& where, samplepos_t sample, PositionLockStyle pls);
MeterSection* add_meter (const Meter& meter, const Temporal::BBT_Time& where, samplepos_t sample, PositionLockStyle pls);
void remove_tempo (const TempoSection&, bool send_signal);
void remove_meter (const MeterSection&, bool send_signal);
void replace_tempo (TempoSection&, const Tempo&, const double& pulse, const samplepos_t sample, PositionLockStyle pls);
void replace_meter (const MeterSection&, const Meter&, const Timecode::BBT_Time& where, samplepos_t sample, PositionLockStyle pls);
void replace_meter (const MeterSection&, const Meter&, const Temporal::BBT_Time& where, samplepos_t sample, PositionLockStyle pls);
MusicSample round_to_bar (samplepos_t sample, RoundMode dir);
MusicSample round_to_beat (samplepos_t sample, RoundMode dir);
@ -431,7 +431,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
void dump (std::ostream&) const;
void clear ();
TempoMetric metric_at (Timecode::BBT_Time bbt) const;
TempoMetric metric_at (Temporal::BBT_Time bbt) const;
/** Return the TempoMetric at sample @p t, and point @p last to the latest
* metric change <= t, if it is non-NULL.
@ -470,19 +470,19 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
/* bbt - it's nearly always better to use meter-based beat (above)
unless tick resolution is desirable.
*/
Timecode::BBT_Time bbt_at_sample (samplepos_t when) const;
Timecode::BBT_Time bbt_at_sample_rt (samplepos_t when) const;
samplepos_t sample_at_bbt (const Timecode::BBT_Time&);
Temporal::BBT_Time bbt_at_sample (samplepos_t when);
Temporal::BBT_Time bbt_at_sample_rt (samplepos_t when) const;
samplepos_t sample_at_bbt (const Temporal::BBT_Time&);
double beat_at_bbt (const Timecode::BBT_Time& bbt);
Timecode::BBT_Time bbt_at_beat (const double& beats);
double beat_at_bbt (const Temporal::BBT_Time& bbt);
Temporal::BBT_Time bbt_at_beat (const double& beats);
double quarter_note_at_bbt (const Timecode::BBT_Time& bbt);
double quarter_note_at_bbt_rt (const Timecode::BBT_Time& bbt);
Timecode::BBT_Time bbt_at_quarter_note (const double& quarter_note);
double quarter_note_at_bbt (const Temporal::BBT_Time& bbt);
double quarter_note_at_bbt_rt (const Temporal::BBT_Time& bbt);
Temporal::BBT_Time bbt_at_quarter_note (const double& quarter_note);
samplecnt_t bbt_duration_at (samplepos_t, const Timecode::BBT_Time&, int dir);
samplepos_t samplepos_plus_bbt (samplepos_t pos, Timecode::BBT_Time b) const;
samplecnt_t bbt_duration_at (samplepos_t, const Temporal::BBT_Time&, int dir);
samplepos_t samplepos_plus_bbt (samplepos_t pos, Temporal::BBT_Time b) const;
/* TEMPO-SENSITIVE FUNCTIONS
@ -526,8 +526,8 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
void gui_stretch_tempo_end (TempoSection* tempo, const samplepos_t sample, const samplepos_t end_sample);
bool gui_twist_tempi (TempoSection* first, const Tempo& bpm, const samplepos_t sample, const samplepos_t end_sample);
std::pair<double, samplepos_t> predict_tempo_position (TempoSection* section, const Timecode::BBT_Time& bbt);
bool can_solve_bbt (TempoSection* section, const Timecode::BBT_Time& bbt);
std::pair<double, samplepos_t> predict_tempo_position (TempoSection* section, const Temporal::BBT_Time& bbt);
bool can_solve_bbt (TempoSection* section, const Temporal::BBT_Time& bbt);
PBD::Signal1<void,const PBD::PropertyChange&> MetricPositionChanged;
void fix_legacy_session();
@ -557,14 +557,14 @@ private:
Tempo tempo_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
double pulse_at_tempo_locked (const Metrics& metrics, const Tempo& tempo) const;
Timecode::BBT_Time bbt_at_minute_locked (const Metrics& metrics, const double& minute) const;
double minute_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time&) const;
Temporal::BBT_Time bbt_at_minute_locked (const Metrics& metrics, const double& minute) const;
double minute_at_bbt_locked (const Metrics& metrics, const Temporal::BBT_Time&) const;
double beat_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time& bbt) const ;
Timecode::BBT_Time bbt_at_beat_locked (const Metrics& metrics, const double& beats) const;
double beat_at_bbt_locked (const Metrics& metrics, const Temporal::BBT_Time& bbt) const ;
Temporal::BBT_Time bbt_at_beat_locked (const Metrics& metrics, const double& beats) const;
double pulse_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time& bbt) const;
Timecode::BBT_Time bbt_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
double pulse_at_bbt_locked (const Metrics& metrics, const Temporal::BBT_Time& bbt) const;
Temporal::BBT_Time bbt_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
double minutes_between_quarter_notes_locked (const Metrics& metrics, const double start_qn, const double end_qn) const;
double quarter_notes_between_samples_locked (const Metrics& metrics, const samplecnt_t start, const samplecnt_t end) const;
@ -582,7 +582,7 @@ private:
bool solve_map_minute (Metrics& metrics, TempoSection* section, const double& minute);
bool solve_map_pulse (Metrics& metrics, TempoSection* section, const double& pulse);
bool solve_map_minute (Metrics& metrics, MeterSection* section, const double& minute);
bool solve_map_bbt (Metrics& metrics, MeterSection* section, const Timecode::BBT_Time& bbt);
bool solve_map_bbt (Metrics& metrics, MeterSection* section, const Temporal::BBT_Time& bbt);
double exact_beat_at_sample_locked (const Metrics& metrics, const samplepos_t sample, const int32_t sub_num) const;
double exact_qn_at_sample_locked (const Metrics& metrics, const samplepos_t sample, const int32_t sub_num) const;
@ -618,7 +618,7 @@ private:
TempoSection* add_tempo_locked (const Tempo&, double pulse, double minute
, PositionLockStyle pls, bool recompute, bool locked_to_meter = false, bool clamped = false);
MeterSection* add_meter_locked (const Meter&, const Timecode::BBT_Time& where, samplepos_t sample, PositionLockStyle pls, bool recompute);
MeterSection* add_meter_locked (const Meter&, const Temporal::BBT_Time& where, samplepos_t sample, PositionLockStyle pls, bool recompute);
bool remove_tempo_locked (const TempoSection&);
bool remove_meter_locked (const MeterSection&);

View file

@ -284,7 +284,7 @@ class AnyTime {
Type type;
Timecode::Time timecode;
Timecode::BBT_Time bbt;
Temporal::BBT_Time bbt;
union {
samplecnt_t samples;
@ -375,11 +375,11 @@ struct AudioRange {
};
struct MusicRange {
Timecode::BBT_Time start;
Timecode::BBT_Time end;
Temporal::BBT_Time start;
Temporal::BBT_Time end;
uint32_t id;
MusicRange (Timecode::BBT_Time& s, Timecode::BBT_Time& e, uint32_t i)
MusicRange (Temporal::BBT_Time& s, Temporal::BBT_Time& e, uint32_t i)
: start (s), end (e), id (i) {}
bool operator== (const MusicRange& other) const {

View file

@ -1634,8 +1634,8 @@ AUPlugin::get_musical_time_location_callback (UInt32* outDeltaSampleOffsetToNe
DEBUG_TRACE (DEBUG::AudioUnitProcess, "AU calls ardour music time location callback\n");
TempoMetric metric = tmap.metric_at (transport_sample);
Timecode::BBT_Time bbt = _session.tempo_map().bbt_at_sample (transport_sample);
TempoMetric metric = tmap.metric_at (transport_sample + input_offset);
Temporal::BBT_Time bbt = _session.tempo_map().bbt_at_sample (transport_sample);
if (outDeltaSampleOffsetToNextBeat) {
if (bbt.ticks == 0) {
@ -1720,7 +1720,7 @@ AUPlugin::get_transport_state_callback (Boolean* outIsPlaying,
TempoMap& tmap (_session.tempo_map());
Timecode::BBT_Time bbt;
Temporal::BBT_Time bbt;
if (outCycleStartBeat) {
*outCycleStartBeat = tmap.quarter_note_at_sample (loc->start());

View file

@ -506,12 +506,12 @@ LuaBindings::common (lua_State* L)
luabridge::getGlobalNamespace (L)
.beginNamespace ("Timecode")
.beginClass <Timecode::BBT_Time> ("BBT_TIME")
.beginClass <Temporal::BBT_Time> ("BBT_TIME")
.addConstructor <void (*) (uint32_t, uint32_t, uint32_t)> ()
.addData ("bars", &Timecode::BBT_Time::bars)
.addData ("beats", &Timecode::BBT_Time::beats)
.addData ("ticks", &Timecode::BBT_Time::ticks)
//.addStaticData ("ticks_per_beat", &Timecode::BBT_Time::ticks_per_beat, false)
.addData ("bars", &Temporal::BBT_Time::bars)
.addData ("beats", &Temporal::BBT_Time::beats)
.addData ("ticks", &Temporal::BBT_Time::ticks)
// .addStaticData ("ticks_per_beat", &Temporal::ticks_per_beat, false)
.endClass ()
.beginClass <Timecode::Time> ("Time")

View file

@ -2573,7 +2573,7 @@ static bool
write_position(LV2_Atom_Forge* forge,
LV2_Evbuf* buf,
const TempoMetric& t,
Timecode::BBT_Time& bbt,
Temporal::BBT_Time& bbt,
double speed,
double time_scale,
double bpm,
@ -2592,8 +2592,7 @@ write_position(LV2_Atom_Forge* forge,
lv2_atom_forge_key(forge, urids.time_speed);
lv2_atom_forge_float(forge, speed);
lv2_atom_forge_key(forge, urids.time_barBeat);
lv2_atom_forge_float(forge, bbt.beats - 1 +
(bbt.ticks / Timecode::BBT_Time::ticks_per_beat));
lv2_atom_forge_float(forge, bbt.beats - 1 + (bbt.ticks / (float) Temporal::ticks_per_beat));
lv2_atom_forge_key(forge, urids.time_bar);
lv2_atom_forge_long(forge, bbt.bars - 1);
lv2_atom_forge_key(forge, urids.time_beatUnit);
@ -2611,8 +2610,7 @@ write_position(LV2_Atom_Forge* forge,
lv2_atom_forge_property_head(forge, urids.time_speed, 0);
lv2_atom_forge_float(forge, speed);
lv2_atom_forge_property_head(forge, urids.time_barBeat, 0);
lv2_atom_forge_float(forge, bbt.beats - 1 +
(bbt.ticks / Timecode::BBT_Time::ticks_per_beat));
lv2_atom_forge_float(forge, bbt.beats - 1 + (bbt.ticks / (float) Temporal::ticks_per_beat));
lv2_atom_forge_property_head(forge, urids.time_bar, 0);
lv2_atom_forge_long(forge, bbt.bars - 1);
lv2_atom_forge_property_head(forge, urids.time_beatUnit, 0);
@ -2737,12 +2735,13 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
if (valid && (flags & PORT_INPUT)) {
if ((flags & PORT_POSITION)) {
Timecode::BBT_Time bbt (tmap.bbt_at_sample (start0));
Temporal::BBT_Time bbt (tmap.bbt_at_sample (start0));
double time_scale = Port::speed_ratio ();
double bpm = tmap.tempo_at_sample (start0).note_types_per_minute();
double beatpos = (bbt.bars - 1) * tmetric.meter().divisions_per_bar()
+ (bbt.beats - 1)
+ (bbt.ticks / Timecode::BBT_Time::ticks_per_beat);
+ (bbt.beats - 1)
+ (bbt.ticks / Temporal::ticks_per_beat);
beatpos *= tmetric.meter().note_divisor() / 4.0;
if (start != _next_cycle_start ||
speed != _next_cycle_speed ||
@ -2781,7 +2780,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
} else {
assert (metric);
tmetric.set_metric(metric);
Timecode::BBT_Time bbt;
Temporal::BBT_Time bbt;
bbt = tmap.bbt_at_sample (metric->sample());
double bpm = tmap.tempo_at_sample (start0 /*XXX metric->sample() */).note_types_per_minute();
write_position(&_impl->forge, _ev_buffers[port_index],
@ -3088,12 +3087,14 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
* Note: for no-midi plugins, we only ever send information at cycle-start,
* so it needs to be realative to that.
*/
TempoMetric t = tmap.metric_at (start0);
TempoMetric t = tmap.metric_at(start);
_current_bpm = tmap.tempo_at_sample (start0).note_types_per_minute();
Timecode::BBT_Time bbt (tmap.bbt_at_sample (start0));
Temporal::BBT_Time bbt (tmap.bbt_at_sample (start0));
double beatpos = (bbt.bars - 1) * t.meter().divisions_per_bar()
+ (bbt.beats - 1)
+ (bbt.ticks / Timecode::BBT_Time::ticks_per_beat);
+ (bbt.beats - 1)
+ (bbt.ticks / Temporal::ticks_per_beat);
beatpos *= tmetric.meter().note_divisor() / 4.0;
_next_cycle_beat = beatpos + nframes * speed * _current_bpm / (60.f * _session.sample_rate());
}

View file

@ -1392,7 +1392,7 @@ Region::set_state (const XMLNode& node, int version)
int
Region::_set_state (const XMLNode& node, int /*version*/, PropertyChange& what_changed, bool send)
{
Timecode::BBT_Time bbt_time;
Temporal::BBT_Time bbt_time;
Stateful::save_extra_xml (node);

View file

@ -47,7 +47,7 @@ using namespace PBD;
/* BBT TIME*/
void
Session::bbt_time (samplepos_t when, Timecode::BBT_Time& bbt)
Session::bbt_time (samplepos_t when, Temporal::BBT_Time& bbt)
{
bbt = _tempo_map->bbt_at_sample (when);
}

View file

@ -198,7 +198,7 @@ intptr_t Session::vst_callback (
newflags |= (kVstTimeSigValid);
}
if ((value & (kVstPpqPosValid)) || (value & (kVstBarsValid))) {
Timecode::BBT_Time bbt;
Temporal::BBT_Time bbt;
try {
bbt = session->tempo_map().bbt_at_sample_rt (now);

View file

@ -49,7 +49,7 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
using Timecode::BBT_Time;
using Temporal::BBT_Time;
/* _default tempo is 4/4 qtr=120 */
@ -1134,7 +1134,7 @@ TempoMap::add_tempo_locked (const Tempo& tempo, double pulse, double minute
}
MeterSection*
TempoMap::add_meter (const Meter& meter, const Timecode::BBT_Time& where, samplepos_t sample, PositionLockStyle pls)
TempoMap::add_meter (const Meter& meter, const Temporal::BBT_Time& where, samplepos_t sample, PositionLockStyle pls)
{
MeterSection* m = 0;
{
@ -1998,7 +1998,7 @@ TempoMap::minute_at_pulse_locked (const Metrics& metrics, const double& pulse) c
*
*/
double
TempoMap::beat_at_bbt (const Timecode::BBT_Time& bbt)
TempoMap::beat_at_bbt (const Temporal::BBT_Time& bbt)
{
Glib::Threads::RWLock::ReaderLock lm (lock);
return beat_at_bbt_locked (_metrics, bbt);
@ -2006,7 +2006,7 @@ TempoMap::beat_at_bbt (const Timecode::BBT_Time& bbt)
double
TempoMap::beat_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time& bbt) const
TempoMap::beat_at_bbt_locked (const Metrics& metrics, const Temporal::BBT_Time& bbt) const
{
/* CALLER HOLDS READ LOCK */
@ -2034,7 +2034,7 @@ TempoMap::beat_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time&
const double remaining_bars = bbt.bars - prev_m->bbt().bars;
const double remaining_bars_in_beats = remaining_bars * prev_m->divisions_per_bar();
const double ret = remaining_bars_in_beats + prev_m->beat() + (bbt.beats - 1) + (bbt.ticks / BBT_Time::ticks_per_beat);
const double ret = remaining_bars_in_beats + prev_m->beat() + (bbt.beats - 1) + (bbt.ticks / Temporal::ticks_per_beat);
return ret;
}
@ -2044,14 +2044,14 @@ TempoMap::beat_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time&
* @return The BBT time (meter-based) at the supplied meter-based beat.
*
*/
Timecode::BBT_Time
Temporal::BBT_Time
TempoMap::bbt_at_beat (const double& beat)
{
Glib::Threads::RWLock::ReaderLock lm (lock);
return bbt_at_beat_locked (_metrics, beat);
}
Timecode::BBT_Time
Temporal::BBT_Time
TempoMap::bbt_at_beat_locked (const Metrics& metrics, const double& b) const
{
/* CALLER HOLDS READ LOCK */
@ -2079,7 +2079,7 @@ TempoMap::bbt_at_beat_locked (const Metrics& metrics, const double& b) const
const uint32_t bars_in_ms = (uint32_t) floor (beats_in_ms / prev_m->divisions_per_bar());
const uint32_t total_bars = bars_in_ms + (prev_m->bbt().bars - 1);
const double remaining_beats = beats_in_ms - (bars_in_ms * prev_m->divisions_per_bar());
const double remaining_ticks = (remaining_beats - floor (remaining_beats)) * BBT_Time::ticks_per_beat;
const double remaining_ticks = (remaining_beats - floor (remaining_beats)) * Temporal::ticks_per_beat;
BBT_Time ret;
@ -2091,9 +2091,9 @@ TempoMap::bbt_at_beat_locked (const Metrics& metrics, const double& b) const
++ret.bars;
++ret.beats;
if (ret.ticks >= BBT_Time::ticks_per_beat) {
if (ret.ticks >= Temporal::ticks_per_beat) {
++ret.beats;
ret.ticks -= BBT_Time::ticks_per_beat;
ret.ticks -= Temporal::ticks_per_beat;
}
if (ret.beats >= prev_m->divisions_per_bar() + 1) {
@ -2113,7 +2113,7 @@ TempoMap::bbt_at_beat_locked (const Metrics& metrics, const double& b) const
* while the input uses meter, the output does not.
*/
double
TempoMap::quarter_note_at_bbt (const Timecode::BBT_Time& bbt)
TempoMap::quarter_note_at_bbt (const Temporal::BBT_Time& bbt)
{
Glib::Threads::RWLock::ReaderLock lm (lock);
@ -2121,7 +2121,7 @@ TempoMap::quarter_note_at_bbt (const Timecode::BBT_Time& bbt)
}
double
TempoMap::quarter_note_at_bbt_rt (const Timecode::BBT_Time& bbt)
TempoMap::quarter_note_at_bbt_rt (const Temporal::BBT_Time& bbt)
{
Glib::Threads::RWLock::ReaderLock lm (lock, Glib::Threads::TRY_LOCK);
@ -2133,7 +2133,7 @@ TempoMap::quarter_note_at_bbt_rt (const Timecode::BBT_Time& bbt)
}
double
TempoMap::pulse_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time& bbt) const
TempoMap::pulse_at_bbt_locked (const Metrics& metrics, const Temporal::BBT_Time& bbt) const
{
/* CALLER HOLDS READ LOCK */
@ -2160,7 +2160,7 @@ TempoMap::pulse_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time&
const double remaining_bars = bbt.bars - prev_m->bbt().bars;
const double remaining_pulses = remaining_bars * prev_m->divisions_per_bar() / prev_m->note_divisor();
const double ret = remaining_pulses + prev_m->pulse() + (((bbt.beats - 1) + (bbt.ticks / BBT_Time::ticks_per_beat)) / prev_m->note_divisor());
const double ret = remaining_pulses + prev_m->pulse() + (((bbt.beats - 1) + (bbt.ticks / Temporal::ticks_per_beat)) / prev_m->note_divisor());
return ret;
}
@ -2172,7 +2172,7 @@ TempoMap::pulse_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time&
* quarter-notes ignore meter and are based on pulse (the musical unit of MetricSection).
*
*/
Timecode::BBT_Time
Temporal::BBT_Time
TempoMap::bbt_at_quarter_note (const double& qn)
{
Glib::Threads::RWLock::ReaderLock lm (lock);
@ -2189,7 +2189,7 @@ TempoMap::bbt_at_quarter_note (const double& qn)
* it is equivalent to four quarter notes.
* while the output uses meter, the input does not.
*/
Timecode::BBT_Time
Temporal::BBT_Time
TempoMap::bbt_at_pulse_locked (const Metrics& metrics, const double& pulse) const
{
MeterSection* prev_m = 0;
@ -2219,7 +2219,7 @@ TempoMap::bbt_at_pulse_locked (const Metrics& metrics, const double& pulse) cons
const uint32_t bars_in_ms = (uint32_t) floor (beats_in_ms / prev_m->divisions_per_bar());
const uint32_t total_bars = bars_in_ms + (prev_m->bbt().bars - 1);
const double remaining_beats = beats_in_ms - (bars_in_ms * prev_m->divisions_per_bar());
const double remaining_ticks = (remaining_beats - floor (remaining_beats)) * BBT_Time::ticks_per_beat;
const double remaining_ticks = (remaining_beats - floor (remaining_beats)) * Temporal::ticks_per_beat;
BBT_Time ret;
@ -2231,9 +2231,9 @@ TempoMap::bbt_at_pulse_locked (const Metrics& metrics, const double& pulse) cons
++ret.bars;
++ret.beats;
if (ret.ticks >= BBT_Time::ticks_per_beat) {
if (ret.ticks >= Temporal::ticks_per_beat) {
++ret.beats;
ret.ticks -= BBT_Time::ticks_per_beat;
ret.ticks -= Temporal::ticks_per_beat;
}
if (ret.beats >= prev_m->divisions_per_bar() + 1) {
@ -2284,7 +2284,7 @@ TempoMap::bbt_at_sample_rt (samplepos_t sample) const
return bbt_at_minute_locked (_metrics, minute);
}
Timecode::BBT_Time
Temporal::BBT_Time
TempoMap::bbt_at_minute_locked (const Metrics& metrics, const double& minute) const
{
if (minute < 0) {
@ -2331,7 +2331,7 @@ TempoMap::bbt_at_minute_locked (const Metrics& metrics, const double& minute) co
const uint32_t bars_in_ms = (uint32_t) floor (beats_in_ms / prev_m->divisions_per_bar());
const uint32_t total_bars = bars_in_ms + (prev_m->bbt().bars - 1);
const double remaining_beats = beats_in_ms - (bars_in_ms * prev_m->divisions_per_bar());
const double remaining_ticks = (remaining_beats - floor (remaining_beats)) * BBT_Time::ticks_per_beat;
const double remaining_ticks = (remaining_beats - floor (remaining_beats)) * Temporal::ticks_per_beat;
BBT_Time ret;
@ -2343,9 +2343,9 @@ TempoMap::bbt_at_minute_locked (const Metrics& metrics, const double& minute) co
++ret.bars;
++ret.beats;
if (ret.ticks >= BBT_Time::ticks_per_beat) {
if (ret.ticks >= Temporal::ticks_per_beat) {
++ret.beats;
ret.ticks -= BBT_Time::ticks_per_beat;
ret.ticks -= Temporal::ticks_per_beat;
}
if (ret.beats >= prev_m->divisions_per_bar() + 1) {
@ -3298,7 +3298,7 @@ TempoMap::gui_set_meter_position (MeterSection* ms, const samplepos_t sample)
MeterSection* copy = copy_metrics_and_point (_metrics, future_map, ms);
const double beat = beat_at_minute_locked (_metrics, minute_at_sample (sample));
const Timecode::BBT_Time bbt = bbt_at_beat_locked (_metrics, beat);
const Temporal::BBT_Time bbt = bbt_at_beat_locked (_metrics, beat);
if (solve_map_bbt (future_map, copy, bbt)) {
solve_map_bbt (_metrics, ms, bbt);
@ -3846,7 +3846,7 @@ TempoMap::exact_qn_at_sample_locked (const Metrics& metrics, const samplepos_t s
qn = pulse_at_beat_locked (metrics, (floor (beat_at_minute_locked (metrics, minute_at_sample (sample)) + 0.5))) * 4.0;
} else if (sub_num == -1) {
/* snap to bar */
Timecode::BBT_Time bbt = bbt_at_pulse_locked (metrics, qn / 4.0);
Temporal::BBT_Time bbt = bbt_at_pulse_locked (metrics, qn / 4.0);
bbt.beats = 1;
bbt.ticks = 0;
@ -3883,9 +3883,9 @@ TempoMap::bbt_duration_at (samplepos_t pos, const BBT_Time& bbt, int dir)
pos_bbt.bars += bbt.bars;
pos_bbt.ticks += bbt.ticks;
if ((double) pos_bbt.ticks > BBT_Time::ticks_per_beat) {
if ((double) pos_bbt.ticks > Temporal::ticks_per_beat) {
pos_bbt.beats += 1;
pos_bbt.ticks -= BBT_Time::ticks_per_beat;
pos_bbt.ticks -= Temporal::ticks_per_beat;
}
pos_bbt.beats += bbt.beats;
@ -3913,7 +3913,7 @@ TempoMap::bbt_duration_at (samplepos_t pos, const BBT_Time& bbt, int dir)
} else {
pos_bbt.beats--;
}
pos_bbt.ticks = BBT_Time::ticks_per_beat - (bbt.ticks - pos_bbt.ticks);
pos_bbt.ticks = Temporal::ticks_per_beat - (bbt.ticks - pos_bbt.ticks);
} else {
pos_bbt.beats = 1;
pos_bbt.ticks = 0;
@ -3955,11 +3955,11 @@ MusicSample
TempoMap::round_to_quarter_note_subdivision (samplepos_t fr, int sub_num, RoundMode dir)
{
Glib::Threads::RWLock::ReaderLock lm (lock);
uint32_t ticks = (uint32_t) floor (max (0.0, pulse_at_minute_locked (_metrics, minute_at_sample (fr))) * BBT_Time::ticks_per_beat * 4.0);
uint32_t beats = (uint32_t) floor (ticks / BBT_Time::ticks_per_beat);
uint32_t ticks_one_subdivisions_worth = (uint32_t) BBT_Time::ticks_per_beat / sub_num;
uint32_t ticks = (uint32_t) floor (max (0.0, pulse_at_minute_locked (_metrics, minute_at_sample (fr))) * Temporal::ticks_per_beat * 4.0);
uint32_t beats = (uint32_t) floor (ticks / Temporal::ticks_per_beat);
uint32_t ticks_one_subdivisions_worth = (uint32_t) Temporal::ticks_per_beat / sub_num;
ticks -= beats * BBT_Time::ticks_per_beat;
ticks -= beats * Temporal::ticks_per_beat;
if (dir > 0) {
/* round to next (or same iff dir == RoundUpMaybe) */
@ -3985,8 +3985,8 @@ TempoMap::round_to_quarter_note_subdivision (samplepos_t fr, int sub_num, RoundM
* But I'm keeping it around, commened out, until we determine there are no terrible consequences.
*/
#if 0
if (ticks >= BBT_Time::ticks_per_beat) {
ticks -= BBT_Time::ticks_per_beat;
if (ticks >= Temporal::ticks_per_beat) {
ticks -= Temporal::ticks_per_beat;
}
#endif
@ -4003,7 +4003,7 @@ TempoMap::round_to_quarter_note_subdivision (samplepos_t fr, int sub_num, RoundM
}
if (ticks < difference) {
ticks = BBT_Time::ticks_per_beat - ticks;
ticks = Temporal::ticks_per_beat - ticks;
} else {
ticks -= difference;
}
@ -4022,9 +4022,9 @@ TempoMap::round_to_quarter_note_subdivision (samplepos_t fr, int sub_num, RoundM
DEBUG_TRACE (DEBUG::SnapBBT, string_compose ("moved forward to %1\n", ticks));
if (ticks > BBT_Time::ticks_per_beat) {
if (ticks > Temporal::ticks_per_beat) {
++beats;
ticks -= BBT_Time::ticks_per_beat;
ticks -= Temporal::ticks_per_beat;
DEBUG_TRACE (DEBUG::SnapBBT, string_compose ("fold beat to %1\n", beats));
}
@ -4039,7 +4039,7 @@ TempoMap::round_to_quarter_note_subdivision (samplepos_t fr, int sub_num, RoundM
}
/* step back to previous beat */
--beats;
ticks = lrint (BBT_Time::ticks_per_beat - rem);
ticks = lrint (Temporal::ticks_per_beat - rem);
DEBUG_TRACE (DEBUG::SnapBBT, string_compose ("step back beat to %1\n", beats));
} else {
ticks = lrint (ticks - rem);
@ -4051,7 +4051,7 @@ TempoMap::round_to_quarter_note_subdivision (samplepos_t fr, int sub_num, RoundM
}
MusicSample ret (0, 0);
ret.sample = sample_at_minute (minute_at_pulse_locked (_metrics, (beats + (ticks / BBT_Time::ticks_per_beat)) / 4.0));
ret.sample = sample_at_minute (minute_at_pulse_locked (_metrics, (beats + (ticks / Temporal::ticks_per_beat)) / 4.0));
ret.division = sub_num;
return ret;
@ -4535,12 +4535,12 @@ TempoMap::fix_legacy_session ()
if (prev_m) {
pair<double, BBT_Time> start = make_pair (((m->bbt().bars - 1) * prev_m->note_divisor())
+ (m->bbt().beats - 1)
+ (m->bbt().ticks / BBT_Time::ticks_per_beat)
+ (m->bbt().ticks / Temporal::ticks_per_beat)
, m->bbt());
m->set_beat (start);
const double start_beat = ((m->bbt().bars - 1) * prev_m->note_divisor())
+ (m->bbt().beats - 1)
+ (m->bbt().ticks / BBT_Time::ticks_per_beat);
+ (m->bbt().ticks / Temporal::ticks_per_beat);
m->set_pulse (start_beat / prev_m->note_divisor());
}
prev_m = m;
@ -4574,7 +4574,7 @@ TempoMap::fix_legacy_session ()
const double beat = ((t->legacy_bbt().bars - 1) * ((prev_m) ? prev_m->note_divisor() : 4.0))
+ (t->legacy_bbt().beats - 1)
+ (t->legacy_bbt().ticks / BBT_Time::ticks_per_beat);
+ (t->legacy_bbt().ticks / Temporal::ticks_per_beat);
if (prev_m) {
t->set_pulse (beat / prev_m->note_divisor());
} else {
@ -4908,9 +4908,9 @@ TempoMap::samplepos_plus_bbt (samplepos_t pos, BBT_Time op) const
BBT_Time pos_bbt = bbt_at_beat_locked (_metrics, beat_at_minute_locked (_metrics, minute_at_sample (pos)));
pos_bbt.ticks += op.ticks;
if (pos_bbt.ticks >= BBT_Time::ticks_per_beat) {
if (pos_bbt.ticks >= Temporal::ticks_per_beat) {
++pos_bbt.beats;
pos_bbt.ticks -= BBT_Time::ticks_per_beat;
pos_bbt.ticks -= Temporal::ticks_per_beat;
}
pos_bbt.beats += op.beats;
/* the meter in effect will start on the bar */

View file

@ -7,7 +7,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(BBTTest);
using namespace std;
using namespace ARDOUR;
using Timecode::BBT_Time;
using Temporal::BBT_Time;
void
BBTTest::addTest ()

View file

@ -113,7 +113,7 @@ JACKSession::timebase_callback (jack_transport_state_t /*state*/,
jack_position_t* pos,
int /*new_position*/)
{
Timecode::BBT_Time bbt;
Temporal::BBT_Time bbt;
TempoMap& tempo_map (_session->tempo_map());
samplepos_t tf;
@ -136,7 +136,7 @@ JACKSession::timebase_callback (jack_transport_state_t /*state*/,
pos->beats_per_bar = metric.meter().divisions_per_bar();
pos->beat_type = metric.meter().note_divisor();
pos->ticks_per_beat = Timecode::BBT_Time::ticks_per_beat;
pos->ticks_per_beat = Temporal::ticks_per_beat;
pos->beats_per_minute = metric.tempo().note_types_per_minute();
double current_tick = tempo_map.quarter_note_at_bbt_rt (bbt) / 4 * pos->beat_type * pos->ticks_per_beat;

View file

@ -65,7 +65,7 @@ public:
static bool test(const std::string& path);
int open(const std::string& path, int track=1);
// XXX 19200 = 10 * Timecode::BBT_Time::ticks_per_beat
// XXX 19200 = 10 * Temporal::ticks_per_beat
int create(const std::string& path, int track=1, uint16_t ppqn=19200);
void close();

View file

@ -42,13 +42,6 @@ using namespace std;
using namespace MIDI;
using namespace PBD;
/**
* As libtimecode is linked statically to libmidi++ this
* is necessary to pull in all the symbols from libtimecode
* so they are exported for other users of libtimecode.
*/
double tmp = Timecode::BBT_Time::ticks_per_beat;
static std::map<int,string> mmc_cmd_map;
static void build_mmc_cmd_map ()
{

View file

@ -546,7 +546,7 @@ void
BasicUI::jump_by_bars (double bars, LocateTransportDisposition ltd)
{
TempoMap& tmap (session->tempo_map());
Timecode::BBT_Time bbt (tmap.bbt_at_sample (session->transport_sample()));
Temporal::BBT_Time bbt (tmap.bbt_at_sample (session->transport_sample()));
bars += bbt.bars;
if (bars < 0) {

View file

@ -268,7 +268,7 @@ FaderPort8::periodic ()
_timecode = Timecode::timecode_format_time(TC);
char buf[16];
Timecode::BBT_Time BBT = session->tempo_map ().bbt_at_sample (session->transport_sample ());
Temporal::BBT_Time BBT = session->tempo_map ().bbt_at_sample (session->transport_sample ());
snprintf (buf, sizeof (buf),
" %02" PRIu32 "|%02" PRIu32 "|%02" PRIu32 "|%02" PRIu32,
BBT.bars % 100, BBT.beats %100,

View file

@ -560,7 +560,7 @@ TranzportControlProtocol::show_bbt (samplepos_t where)
{
if ((where != last_where) || lcd_isdamaged(1,9,8)) {
char buf[16];
Timecode::BBT_Time bbt;
Temporal::BBT_Time bbt;
session->tempo_map().bbt_time (where, bbt);
sprintf (buf, "%03" PRIu32 "|%02" PRIu32 "|%04" PRIu32, bbt.bars,bbt.beats,bbt.ticks);
last_bars = bbt.bars;

View file

@ -1153,7 +1153,7 @@ MackieControlProtocol::set_state (const XMLNode & node, int version)
string
MackieControlProtocol::format_bbt_timecode (samplepos_t now_sample)
{
Timecode::BBT_Time bbt_time;
Temporal::BBT_Time bbt_time;
session->bbt_time (now_sample, bbt_time);

View file

@ -242,7 +242,7 @@ OSCGlobalObserver::tick ()
_osc.text_message (X_("/position/smpte"), os.str(), addr);
}
if (feedback[5]) { // Bar beat enabled
Timecode::BBT_Time bbt_time;
Temporal::BBT_Time bbt_time;
session->bbt_time (now_sample, bbt_time);

View file

@ -602,7 +602,7 @@ TrackMixLayout::update_clocks ()
}
char buf[16];
Timecode::BBT_Time BBT = session.tempo_map().bbt_at_sample (pos);
Temporal::BBT_Time BBT = session.tempo_map().bbt_at_sample (pos);
#define BBT_BAR_CHAR "|"

View file

@ -288,7 +288,7 @@ TranzportControlProtocol::show_bbt (samplepos_t where)
{
if (where != last_where) {
char buf[16];
Timecode::BBT_Time bbt;
Temporal::BBT_Time bbt;
// When recording or playing back < 1.0 speed do 1 or 2
// FIXME - clean up state machine & break up logic

View file

@ -206,8 +206,8 @@ public:
// For the purposes of "jump-to-next-subdivision", we DO want to advance to the next beat.
// And since the "prev" direction DOES move beats, I assume this code is unintended.
// But I'm keeping it around, until we determine there are no terrible consequences.
// if (ticks >= BBT_Time::ticks_per_beat) {
// ticks -= BBT_Time::ticks_per_beat;
// if (ticks >= Temporal::ticks_per_beat) {
// ticks -= Temporal::ticks_per_beat;
// }
} else if (dir < 0) {

View file

@ -27,7 +27,7 @@ namespace Temporal {
typedef uint64_t superclock_t;
static const superclock_t superclock_ticks_per_second = 508032000; // 2^10 * 3^4 * 5^3 * 7^2
extern superclock_t superclock_ticks_per_second;
static inline superclock_t superclock_to_samples (superclock_t s, int sr) { return int_div_round (s * sr, superclock_ticks_per_second); }
static inline superclock_t samples_to_superclock (int samples, int sr) { return int_div_round (samples * superclock_ticks_per_second, superclock_t (sr)); }

View file

@ -146,7 +146,7 @@ class LIBTEMPORAL_API Tempo : public Rampable {
* It is not required that big_numerator equal superclock_ticks_per_second but since the values in both cases have similar
* desired properties (many, many factors), it doesn't hurt to use the same number.
*/
static const superclock_t big_numerator = superclock_ticks_per_second;
static const superclock_t big_numerator = 508032000; // 2^10 * 3^4 * 5^3 * 7^2
public:
enum Type {