-/** Converter between beats and frames. Takes durations in beats or frames
- * and converts them using the tempo at the \a origin supplied to the constructor.
- * Note that this does not covert positions, only durations.
+/** Converter between beats and frames. Takes distances in beats or frames
+ * from some origin (supplied to the constructor in frames), and converts
+ * them to the opposite unit, taking tempo changes into account.
+ */
+class LIBARDOUR_API BeatsFramesConverter
+ : public Evoral::TimeConverter<Evoral::Beats,framepos_t> {
+public:
+ BeatsFramesConverter (TempoMap& tempo_map, framepos_t origin)
+ : Evoral::TimeConverter<Evoral::Beats, framepos_t> (origin)
+ , _tempo_map(tempo_map)
+ {}
+
+ framepos_t to (Evoral::Beats beats) const;
+ Evoral::Beats from (framepos_t frames) const;
+
+private:
+ TempoMap& _tempo_map;
+};
+
+/** Converter between beats and frames. Takes distances in beats or frames
+ * from some origin (supplied to the constructor in frames), and converts
+ * them to the opposite unit, taking tempo changes into account.