- for (Metrics::iterator i = metrics.begin(); i != metrics.end(); ++i) {
- MeterSection* ms;
-
- if ((ms = dynamic_cast<MeterSection *> (*i)) != 0) {
- meter = ms;
- break;
- }
- }
-
- assert(meter);
-
- for (Metrics::iterator i = metrics.begin(); i != metrics.end(); ++i) {
- TempoSection* ts;
-
- if ((ts = dynamic_cast<TempoSection *> (*i)) != 0) {
- tempo = ts;
- break;
- }
- }
-
- assert(tempo);
-
- /* assumes that the first meter & tempo are at frame zero */
- current_frame = 0;
- meter->set_frame (0);
- tempo->set_frame (0);
-
- /* assumes that the first meter & tempo are at 1|1|0 */
- current.bars = 1;
- current.beats = 1;
- current.ticks = 0;
- if (reassign_tempo_bbt) {
-
- MeterSection* rmeter = meter;
-
- DEBUG_TRACE (DEBUG::TempoMath, "\tUpdating tempo marks BBT time from bar offset\n");
-
- for (Metrics::iterator i = metrics.begin(); i != metrics.end(); ++i) {
-
- TempoSection* ts;
- MeterSection* ms;
-
- if ((ts = dynamic_cast<TempoSection*>(*i)) != 0) {
-
- /* reassign the BBT time of this tempo section
- * based on its bar offset position.
- */
-
- ts->update_bbt_time_from_bar_offset (*rmeter);
-
- } else if ((ms = dynamic_cast<MeterSection*>(*i)) != 0) {
- rmeter = ms;
- } else {
- fatal << _("programming error: unhandled MetricSection type") << endmsg;
- abort(); /*NOTREACHED*/
- }
- }
- }
-
- DEBUG_TRACE (DEBUG::TempoMath, string_compose ("start with meter = %1 tempo = %2\n", *((Meter*)meter), *((Tempo*)tempo)));
-
- next_metric = metrics.begin();
- ++next_metric; // skip meter (or tempo)
- ++next_metric; // skip tempo (or meter)
-
- DEBUG_TRACE (DEBUG::TempoMath, string_compose ("Add first bar at 1|1 @ %2\n", current.bars, current_frame));
-