summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-01-03 19:03:13 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-01-03 19:03:13 +0000
commitbc003a539bd03257504188f6ab8daa85a5e168cc (patch)
tree26f19991066b543cf627db2068b491fa016ce30e
parent2a200bdc0ead3d2a2a0481db44b0bc080529aa69 (diff)
save 4 bytes per Bar|Beat point in the tempo map
git-svn-id: svn://localhost/ardour2/branches/3.0@11147 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/editor_rulers.cc8
-rw-r--r--gtk2_ardour/tempo_lines.cc2
-rw-r--r--libs/ardour/ardour/tempo.h5
-rw-r--r--libs/ardour/session_click.cc15
-rw-r--r--libs/ardour/tempo.cc8
5 files changed, 19 insertions, 19 deletions
diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc
index 1d5dac091b..d97debbc66 100644
--- a/gtk2_ardour/editor_rulers.cc
+++ b/gtk2_ardour/editor_rulers.cc
@@ -1628,7 +1628,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
bbt_nmarks = (gint) (bbt_bars / 64) + 1;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
for (n = 0, i = current_bbt_points_begin; i != current_bbt_points_end && n < bbt_nmarks; i++) {
- if ((*i).type == TempoMap::Bar) {
+ if ((*i).beat == 1) {
if ((*i).bar % 64 == 1) {
if ((*i).bar % 256 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
@@ -1653,7 +1653,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
bbt_nmarks = (bbt_bars / 16) + 1;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
for (n = 0, i = current_bbt_points_begin; i != current_bbt_points_end && n < bbt_nmarks; i++) {
- if ((*i).type == TempoMap::Bar) {
+ if ((*i).beat == 1) {
if ((*i).bar % 16 == 1) {
if ((*i).bar % 64 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
@@ -1678,7 +1678,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
bbt_nmarks = (bbt_bars / 4) + 1;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks);
for (n = 0, i = current_bbt_points_begin; i != current_bbt_points_end && n < bbt_nmarks; ++i) {
- if ((*i).type == TempoMap::Bar) {
+ if ((*i).beat == 1) {
if ((*i).bar % 4 == 1) {
if ((*i).bar % 16 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
@@ -1704,7 +1704,7 @@ Editor::metric_get_bbt (GtkCustomRulerMark **marks, gdouble lower, gdouble /*upp
bbt_nmarks = bbt_bars + 2;
*marks = (GtkCustomRulerMark *) g_malloc (sizeof(GtkCustomRulerMark) * bbt_nmarks );
for (n = 0, i = current_bbt_points_begin; i != current_bbt_points_end && n < bbt_nmarks; i++) {
- if ((*i).type == TempoMap::Bar) {
+ if ((*i).beat == 1) {
if ((*i).bar % 4 == 1) {
snprintf (buf, sizeof(buf), "%" PRIu32, (*i).bar);
(*marks)[n].style = GtkCustomRulerMarkMajor;
diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc
index 1ee73c7280..9d590780ce 100644
--- a/gtk2_ardour/tempo_lines.cc
+++ b/gtk2_ardour/tempo_lines.cc
@@ -133,7 +133,7 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
for (i = begin; i != end; ++i) {
- if ((*i).type == ARDOUR::TempoMap::Bar) {
+ if ((*i).beat == 1) {
color = ARDOUR_UI::config()->canvasvar_MeasureLineBar.get();
} else {
if (beat_density > 2.0) {
diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h
index ff21d880f2..0ca3b71ec7 100644
--- a/libs/ardour/ardour/tempo.h
+++ b/libs/ardour/ardour/tempo.h
@@ -203,7 +203,6 @@ class TempoMap : public PBD::StatefulDestructible
};
struct BBTPoint {
- BBTPointType type;
framepos_t frame;
const Meter* meter;
const Tempo* tempo;
@@ -215,8 +214,8 @@ class TempoMap : public PBD::StatefulDestructible
operator framepos_t() const { return frame; }
BBTPoint (const Meter& m, const Tempo& t, framepos_t f,
- BBTPointType ty, uint32_t b, uint32_t e)
- : type (ty), frame (f), meter (&m), tempo (&t), bar (b), beat (e) {}
+ uint32_t b, uint32_t e)
+ : frame (f), meter (&m), tempo (&t), bar (b), beat (e) {}
};
typedef std::vector<BBTPoint> BBTPointList;
diff --git a/libs/ardour/session_click.cc b/libs/ardour/session_click.cc
index 083f8055f9..1fbf255448 100644
--- a/libs/ardour/session_click.cc
+++ b/libs/ardour/session_click.cc
@@ -67,19 +67,20 @@ Session::click (framepos_t start, framecnt_t nframes)
}
for (TempoMap::BBTPointList::const_iterator i = points_begin; i != points_end; ++i) {
- switch ((*i).type) {
- case TempoMap::Beat:
- if (click_emphasis_data == 0 || (click_emphasis_data && (*i).beat != 1)) {
- clicks.push_back (new Click ((*i).frame, click_length, click_data));
+ switch ((*i).beat) {
+ case 1:
+ if (click_emphasis_data) {
+ clicks.push_back (new Click ((*i).frame, click_emphasis_length, click_emphasis_data));
}
break;
- case TempoMap::Bar:
- if (click_emphasis_data) {
- clicks.push_back (new Click ((*i).frame, click_emphasis_length, click_emphasis_data));
+ default:
+ if (click_emphasis_data == 0 || (click_emphasis_data && (*i).beat != 1)) {
+ clicks.push_back (new Click ((*i).frame, click_length, click_data));
}
break;
}
+
}
run_clicks:
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index 0dd5634f95..177a89b2eb 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -857,7 +857,7 @@ TempoMap::recompute_map (bool reassign_tempo_bbt, framepos_t end)
++next_metric; // skip tempo (or meter)
DEBUG_TRACE (DEBUG::TempoMath, string_compose ("Add first bar at 1|1 @ %2\n", current.bars, current_frame));
- _map.push_back (BBTPoint (*meter, *tempo,(framepos_t) llrint(current_frame), Bar, 1, 1));
+ _map.push_back (BBTPoint (*meter, *tempo,(framepos_t) llrint(current_frame), 1, 1));
while (current_frame < end) {
@@ -961,10 +961,10 @@ TempoMap::recompute_map (bool reassign_tempo_bbt, framepos_t end)
if (current.beats == 1) {
DEBUG_TRACE (DEBUG::TempoMath, string_compose ("Add Bar at %1|1 @ %2\n", current.bars, current_frame));
- _map.push_back (BBTPoint (*meter, *tempo,(framepos_t) llrint(current_frame), Bar, current.bars, 1));
+ _map.push_back (BBTPoint (*meter, *tempo,(framepos_t) llrint(current_frame), current.bars, 1));
} else {
DEBUG_TRACE (DEBUG::TempoMath, string_compose ("Add Beat at %1|%2 @ %3\n", current.bars, current.beats, current_frame));
- _map.push_back (BBTPoint (*meter, *tempo, (framepos_t) llrint(current_frame), Beat, current.bars, current.beats));
+ _map.push_back (BBTPoint (*meter, *tempo, (framepos_t) llrint(current_frame), current.bars, current.beats));
}
}
}
@@ -1120,7 +1120,7 @@ TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, i
while (wi != _map.end() && bars < bbt.bars) {
++wi;
- if ((*wi).type == Bar) {
+ if ((*wi).beat == 1) {
++bars;
}
}