major internal plugin & processor API change:
[ardour.git] / libs / ardour / ardour / beats_frames_converter.h
index e76588ccaafa120af54232bf06f82501c29f7c68..4b7169bfe7edc7b5cbe36300d49696e80e0d079b 100644 (file)
     $Id: midiregion.h 733 2006-08-01 17:19:38Z drobilla $
 */
 
+#include "evoral/Beats.hpp"
 #include "evoral/TimeConverter.hpp"
+
+#include "ardour/libardour_visibility.h"
 #include "ardour/types.h"
 
 #ifndef __ardour_beats_frames_converter_h__
@@ -29,22 +32,42 @@ namespace ARDOUR {
 
 class TempoMap;
 
-/** 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.
  */
-class BeatsFramesConverter : public Evoral::TimeConverter<double,framepos_t> {
+class LIBARDOUR_API DoubleBeatsFramesConverter
+       : public Evoral::TimeConverter<double,framepos_t> {
 public:
-       BeatsFramesConverter (const TempoMap& tempo_map, framepos_t origin)
+       DoubleBeatsFramesConverter (TempoMap& tempo_map, framepos_t origin)
                : Evoral::TimeConverter<double, framepos_t> (origin)
                , _tempo_map(tempo_map)
        {}
 
-       framepos_t to (double beats)        const;
-       double     from (framepos_t frames) const;
+       framepos_t          to (double beats) const;
+       double from (framepos_t frames) const;
 
 private:
-       const TempoMap& _tempo_map;
+       TempoMap& _tempo_map;
 };
 
 } /* namespace ARDOUR */