X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fbeats_frames_converter.h;h=e331b8411d825285c9400f157afbb7cfe39e0e0b;hb=43f7813b248686bfa89600f91dccd83017dfe669;hp=7134ea2fe98fdaf5be728cd312c4260c0f344d26;hpb=bb9cc45cd22af67ac275a5e73accbe14fee664d8;p=ardour.git diff --git a/libs/ardour/ardour/beats_frames_converter.h b/libs/ardour/ardour/beats_frames_converter.h index 7134ea2fe9..e331b8411d 100644 --- a/libs/ardour/ardour/beats_frames_converter.h +++ b/libs/ardour/ardour/beats_frames_converter.h @@ -1,6 +1,6 @@ /* Copyright (C) 2009 Paul Davis - Author: Dave Robillard + Author: David Robillard This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,24 +27,24 @@ namespace ARDOUR { -class Session; +class TempoMap; -class BeatsFramesConverter : public Evoral::TimeConverter { +/** 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 { public: - BeatsFramesConverter(Session& session, sframes_t origin) - : _session(session) - , _origin(origin) + BeatsFramesConverter (TempoMap& tempo_map, framepos_t origin) + : Evoral::TimeConverter (origin) + , _tempo_map(tempo_map) {} - sframes_t to(double beats) const; - double from(sframes_t frames) const; - - sframes_t origin() const { return _origin; } - void set_origin(sframes_t origin) { _origin = origin; } + framepos_t to (double beats) const; + double from (framepos_t frames) const; private: - Session& _session; - sframes_t _origin; + TempoMap& _tempo_map; }; } /* namespace ARDOUR */