OSC: Signal for editor mixer change. (Selected or not)
[ardour.git] / libs / ardour / ardour / tempo.h
index 8227a968a0ef7b5899fdd3e28e27346ef687b7b6..33d9fb937d6af3aa78396ca787cfe95f6ec75deb 100644 (file)
@@ -149,9 +149,6 @@ class LIBARDOUR_API MeterSection : public MetricSection, public Meter {
 
        XMLNode& get_state() const;
 
-       void set_pulse (double w) {
-               MetricSection::set_pulse (w);
-       }
        void set_beat (std::pair<double, Timecode::BBT_Time>& w) {
                _beat = w.first;
                _bbt = w.second;
@@ -333,8 +330,8 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
        /* because tempos may be ramped, this is only valid for the instant requested.*/
        double frames_per_beat_at (const framepos_t&, const framecnt_t& sr) const;
 
-       const TempoSection& tempo_section_at (framepos_t frame) const;
-       const MeterSection& meter_section_at (framepos_t frame) const;
+       const TempoSection& tempo_section_at_frame (framepos_t frame) const;
+       const MeterSection& meter_section_at_frame (framepos_t frame) const;
        const MeterSection& meter_section_at_beat (double beat) const;
 
        /** add a tempo section locked to pls. ignored values will be set in recompute_tempos()
@@ -394,7 +391,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
 
        /* TEMPO- AND METER-SENSITIVE FUNCTIONS
 
-          bbt_time(), beat_at_frame(), frame_at_beat(), frame_time()
+          bbt_at_frame(), frame_at_bbt(), beat_at_frame(), frame_at_beat(), tempo_at_beat()
           and bbt_duration_at()
           are all sensitive to tempo and meter, and will give answers
           that align with the grid formed by tempo and meter sections.
@@ -406,17 +403,24 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
        double beat_at_frame (const framecnt_t& frame) const;
        framecnt_t frame_at_beat (const double& beat) const;
 
+       Tempo tempo_at_frame (const framepos_t& frame) const;
+       framepos_t frame_at_tempo (const Tempo& tempo) const;
+
+       Tempo tempo_at_beat (const double& beat) const;
+
+       const Meter& meter_at_frame (framepos_t) const;
+
+       /* you probably only need to use pulses when moving tempos */
        double pulse_at_beat (const double& beat) const;
        double beat_at_pulse (const double& pulse) const;
 
        double pulse_at_frame (const framecnt_t& frame) const;
        framecnt_t frame_at_pulse (const double& pulse) const;
 
-       const Tempo tempo_at_frame (const framepos_t& frame) const;
-       const Meter& meter_at_frame (framepos_t) const;
-
-       const Timecode::BBT_Time bbt_at_frame (framepos_t when);
-       const framepos_t frame_at_bbt (const Timecode::BBT_Time&);
+       /* bbt - it's nearly always better to use beats.*/
+       Timecode::BBT_Time bbt_at_frame (framepos_t when);
+       Timecode::BBT_Time bbt_at_frame_rt (framepos_t when);
+       framepos_t frame_at_bbt (const Timecode::BBT_Time&);
 
        double beat_at_bbt (const Timecode::BBT_Time& bbt);
        Timecode::BBT_Time bbt_at_beat (const double& beats);
@@ -424,8 +428,6 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
        double pulse_at_bbt (const Timecode::BBT_Time& bbt);
        Timecode::BBT_Time bbt_at_pulse (const double& pulse);
 
-       std::pair<double, framepos_t> predict_tempo_position (TempoSection* section, const Timecode::BBT_Time& bbt);
-
        framecnt_t bbt_duration_at (framepos_t, const Timecode::BBT_Time&, int dir);
 
        /* TEMPO-SENSITIVE FUNCTIONS
@@ -443,25 +445,33 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
        framepos_t framepos_minus_beats (framepos_t, Evoral::Beats) const;
        Evoral::Beats framewalk_to_beats (framepos_t pos, framecnt_t distance) const;
 
-       void gui_move_tempo (TempoSection*, const framepos_t& frame);
+       void gui_move_tempo (TempoSection*, const framepos_t& frame, const int& sub_num);
        void gui_move_meter (MeterSection*, const framepos_t& frame);
        bool gui_change_tempo (TempoSection*, const Tempo& bpm);
        void gui_dilate_tempo (TempoSection* tempo, const framepos_t& frame, const framepos_t& end_frame, const double& pulse);
 
+       std::pair<double, framepos_t> predict_tempo_position (TempoSection* section, const Timecode::BBT_Time& bbt);
        bool can_solve_bbt (TempoSection* section, const Timecode::BBT_Time& bbt);
 
        PBD::Signal0<void> MetricPositionChanged;
        void fix_legacy_session();
 
 private:
+
+       double beat_at_frame_locked (const Metrics& metrics, const framecnt_t& frame) const;
+       framecnt_t frame_at_beat_locked (const Metrics& metrics, const double& beat) const;
+
        double pulse_at_beat_locked (const Metrics& metrics, const double& beat) const;
        double beat_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
 
        double pulse_at_frame_locked (const Metrics& metrics, const framecnt_t& frame) const;
        framecnt_t frame_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
 
-       double beat_at_frame_locked (const Metrics& metrics, const framecnt_t& frame) const;
-       framecnt_t frame_at_beat_locked (const Metrics& metrics, const double& beat) const;
+       Tempo tempo_at_frame_locked (const Metrics& metrics, const framepos_t& frame) const;
+       framepos_t frame_at_tempo_locked (const Metrics& metrics, const Tempo& tempo) const;
+
+       Timecode::BBT_Time bbt_at_frame_locked (const Metrics& metrics, const framepos_t& frame) const;
+       framepos_t frame_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time&) const;
 
        double beat_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time& bbt) const ;
        Timecode::BBT_Time bbt_at_beat_locked (const Metrics& metrics, const double& beats) const;
@@ -469,16 +479,10 @@ private:
        double pulse_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time& bbt) const;
        Timecode::BBT_Time bbt_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
 
-       Timecode::BBT_Time bbt_at_frame_locked (const Metrics& metrics, const framepos_t& frame) const;
-       framepos_t frame_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time&) const;
-
-       const Tempo tempo_at_frame_locked (const Metrics& metrics, const framepos_t& frame) const;
-
-       const TempoSection& tempo_section_at_locked (const Metrics& metrics, framepos_t frame) const;
+       const TempoSection& tempo_section_at_frame_locked (const Metrics& metrics, framepos_t frame) const;
        const TempoSection& tempo_section_at_beat_locked (const Metrics& metrics, const double& beat) const;
-       const TempoSection& tempo_section_at_pulse_locked (const Metrics& metrics, const double& pulse) const;
 
-       const MeterSection& meter_section_at_locked (const Metrics& metrics, framepos_t frame) const;
+       const MeterSection& meter_section_at_frame_locked (const Metrics& metrics, framepos_t frame) const;
        const MeterSection& meter_section_at_beat_locked (const Metrics& metrics, const double& beat) const;
 
        bool check_solved (const Metrics& metrics) const;