+ samplepos_t start, samplepos_t end, uint32_t bar_mod = 0);
+
+ static const Tempo& default_tempo() { return _default_tempo; }
+ static const Meter& default_meter() { return _default_meter; }
+
+ /* because tempi may be ramped, this is only valid for the instant requested.*/
+ double samples_per_quarter_note_at (const samplepos_t, const samplecnt_t sr) const;
+
+ const TempoSection& tempo_section_at_sample (samplepos_t sample) const;
+ TempoSection& tempo_section_at_sample (samplepos_t sample);
+ const MeterSection& meter_section_at_sample (samplepos_t sample) const;
+ const MeterSection& meter_section_at_beat (double beat) const;
+
+ TempoSection* previous_tempo_section (TempoSection*) const;
+ TempoSection* next_tempo_section (TempoSection*) const;
+
+ /** add a tempo section locked to pls. ignored values will be set in recompute_tempi()
+ * @param pulse pulse position of new section. ignored if pls == AudioTime
+ * @param sample frame position of new section. ignored if pls == MusicTime
+ * @param type type of new tempo section (Ramp, Constant)
+ */
+ TempoSection* add_tempo (const Tempo&, const double& pulse, const samplepos_t sample, PositionLockStyle pls);
+
+ /** add a meter section locked to pls.. ignored values will be set in recompute_meters()
+ * @param meter the Meter to be added
+ * @param where bbt position of new section
+ * @param sample frame position of new section. ignored if pls == MusicTime
+ * note that @sample may also be ignored if it would create an un-solvable map
+ * (previous audio-locked tempi may place the requested beat at an earlier time than sample)
+ * in which case the new meter will be placed at the specified BBT.
+ * @param pls the position lock style
+ *
+ * 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 @beat
+ */
+ MeterSection* add_meter (const Meter& meter, const Timecode::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);
+
+ MusicSample round_to_bar (samplepos_t sample, RoundMode dir);
+ MusicSample round_to_beat (samplepos_t sample, RoundMode dir);
+ MusicSample round_to_quarter_note_subdivision (samplepos_t fr, int sub_num, RoundMode dir);
+
+ void set_length (samplepos_t samples);
+
+ XMLNode& get_state (void);
+ int set_state (const XMLNode&, int version);
+
+ void dump (std::ostream&) const;
+ void clear ();
+
+ TempoMetric metric_at (Timecode::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.
+ */
+ TempoMetric metric_at (samplepos_t, Metrics::const_iterator* last=NULL) const;
+
+ Metrics::const_iterator metrics_end() { return _metrics.end(); }
+
+ void change_existing_tempo_at (samplepos_t, double bpm, double note_type, double end_ntpm);
+ void change_initial_tempo (double ntpm, double note_type, double end_ntpm);
+
+ void insert_time (samplepos_t, samplecnt_t);
+ bool remove_time (samplepos_t where, samplecnt_t amount); //returns true if anything was moved
+
+ int n_tempos () const;
+ int n_meters () const;
+
+ samplecnt_t sample_rate () const { return _sample_rate; }