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
This commit is contained in:
Paul Davis
2012-01-03 19:03:13 +00:00
parent 2a200bdc0e
commit bc003a539b
5 changed files with 20 additions and 20 deletions

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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));
}
break;
case TempoMap::Bar:
switch ((*i).beat) {
case 1:
if (click_emphasis_data) {
clicks.push_back (new Click ((*i).frame, click_emphasis_length, click_emphasis_data));
}
break;
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:

View File

@@ -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;
}
}