Don't use references for constant c-types
authorRobin Gareus <robin@gareus.org>
Sun, 20 Aug 2017 17:02:17 +0000 (19:02 +0200)
committerRobin Gareus <robin@gareus.org>
Sun, 20 Aug 2017 17:02:17 +0000 (19:02 +0200)
This fixes various Lua-scripts: There are no explicit bindings to
turn int64_t, uint64_t into a const reference.

Besides it doesn't make sense to use a reference for constant _t that can
be directly loaded in CPU register or on the stack.

libs/ardour/ardour/tempo.h
libs/ardour/tempo.cc

index 6ae03cb88008e96341995a4668dfb6fcdc19d5aa..78d18dd12202e629fd95d23f25952c0e0f3fa5b5 100644 (file)
@@ -161,7 +161,7 @@ class LIBARDOUR_API MetricSection {
        bool is_tempo () const { return _is_tempo; }
 
        framepos_t frame_at_minute (const double& time) const;
-       double minute_at_frame (const framepos_t& frame) const;
+       double minute_at_frame (const framepos_t frame) const;
 
 protected:
        void add_state_to_node (XMLNode& node) const;
@@ -245,7 +245,7 @@ class LIBARDOUR_API TempoSection : public MetricSection, public Tempo {
        double compute_c_pulse (const double& end_ntpm, const double& end_pulse) const;
        double compute_c_minute (const double& end_ntpm, const double& end_minute) const;
 
-       double pulse_at_frame (const framepos_t& frame) const;
+       double pulse_at_frame (const framepos_t frame) const;
        framepos_t frame_at_pulse (const double& pulse) const;
 
        Timecode::BBT_Time legacy_bbt () { return _legacy_bbt; }
@@ -372,7 +372,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
        static const Meter& default_meter() { return _default_meter; }
 
        /* because tempi may be ramped, this is only valid for the instant requested.*/
-       double frames_per_quarter_note_at (const framepos_t&, const framecnt_t& sr) const;
+       double frames_per_quarter_note_at (const framepos_t, const framecnt_t sr) const;
 
        const TempoSection& tempo_section_at_frame (framepos_t frame) const;
        TempoSection& tempo_section_at_frame (framepos_t frame);
@@ -387,7 +387,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
         * @param frame 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 framepos_t& frame, PositionLockStyle pls);
+       TempoSection* add_tempo (const Tempo&, const double& pulse, const framepos_t frame, PositionLockStyle pls);
 
        /** add a meter section locked to pls.. ignored values will be set in recompute_meters()
         * @param meter the Meter to be added
@@ -406,7 +406,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
        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 framepos_t& frame, PositionLockStyle pls);
+       void replace_tempo (TempoSection&, const Tempo&, const double& pulse, const framepos_t frame, PositionLockStyle pls);
 
        void replace_meter (const MeterSection&, const Meter&, const Timecode::BBT_Time& where, framepos_t frame, PositionLockStyle pls);
 
@@ -453,7 +453,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
           whose location is canonically defined in Evoral::Beats.
        */
 
-       double beat_at_frame (const framecnt_t& frame) const;
+       double beat_at_frame (const framecnt_t frame) const;
        framepos_t frame_at_beat (const double& beat) const;
 
        const Meter& meter_at_frame (framepos_t) const;
@@ -502,16 +502,16 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
        double beat_at_quarter_note (const double beat) const;
 
        /* obtain a musical subdivision via a frame position and magic note divisor.*/
-       double exact_qn_at_frame (const framepos_t& frame, const int32_t sub_num) const;
-       double exact_beat_at_frame (const framepos_t& frame, const int32_t sub_num) const;
+       double exact_qn_at_frame (const framepos_t frame, const int32_t sub_num) const;
+       double exact_beat_at_frame (const framepos_t frame, const int32_t sub_num) const;
 
-       Tempo tempo_at_frame (const framepos_t& frame) const;
+       Tempo tempo_at_frame (const framepos_t frame) const;
        framepos_t frame_at_tempo (const Tempo& tempo) const;
        Tempo tempo_at_quarter_note (const double& beat) const;
        double quarter_note_at_tempo (const Tempo& tempo) const;
 
-       void gui_set_tempo_position (TempoSection*, const framepos_t& frame, const int& sub_num);
-       void gui_set_meter_position (MeterSection*, const framepos_t& frame);
+       void gui_set_tempo_position (TempoSection*, const framepos_t frame, const int& sub_num);
+       void gui_set_meter_position (MeterSection*, const framepos_t frame);
        bool gui_change_tempo (TempoSection*, const Tempo& bpm);
        void gui_stretch_tempo (TempoSection* tempo, const framepos_t frame, const framepos_t end_frame, const double start_qnote, const double end_qnote);
        void gui_stretch_tempo_end (TempoSection* tempo, const framepos_t frame, const framepos_t end_frame);
@@ -568,15 +568,15 @@ private:
        const MeterSection& meter_section_at_beat_locked (const Metrics& metrics, const double& beat) const;
 
        bool check_solved (const Metrics& metrics) const;
-       bool set_active_tempi (const Metrics& metrics, const framepos_t& frame);
+       bool set_active_tempi (const Metrics& metrics, const framepos_t frame);
 
        bool solve_map_minute (Metrics& metrics, TempoSection* section, const double& minute);
        bool solve_map_pulse (Metrics& metrics, TempoSection* section, const double& pulse);
        bool solve_map_minute (Metrics& metrics, MeterSection* section, const double& minute);
        bool solve_map_bbt (Metrics& metrics, MeterSection* section, const Timecode::BBT_Time& bbt);
 
-       double exact_beat_at_frame_locked (const Metrics& metrics, const framepos_t& frame, const int32_t sub_num) const;
-       double exact_qn_at_frame_locked (const Metrics& metrics, const framepos_t& frame, const int32_t sub_num) const;
+       double exact_beat_at_frame_locked (const Metrics& metrics, const framepos_t frame, const int32_t sub_num) const;
+       double exact_qn_at_frame_locked (const Metrics& metrics, const framepos_t frame, const int32_t sub_num) const;
 
        double minute_at_frame (const framepos_t frame) const;
        framepos_t frame_at_minute (const double minute) const;
index 1bddc749e72bd7592a1a5067165d476115ee05d5..3f120eed0015ff3f9dc90e1cf317437fa8c137ff 100644 (file)
@@ -55,7 +55,7 @@ MetricSection::frame_at_minute (const double& time) const
 }
 
 double
-MetricSection::minute_at_frame (const framepos_t& frame) const
+MetricSection::minute_at_frame (const framepos_t frame) const
 {
        return (frame / (double) _sample_rate) / 60.0;
 }
@@ -360,7 +360,7 @@ TempoSection::minute_at_pulse (const double& p) const
  *  for use with musical units whose granularity is coarser than frames (e.g. ticks)
 */
 double
-TempoSection::pulse_at_frame (const framepos_t& f) const
+TempoSection::pulse_at_frame (const framepos_t f) const
 {
        const bool constant = type() == Constant || _c == 0.0 || (initial() && f < frame());
        if (constant) {
@@ -1020,7 +1020,7 @@ TempoMap::do_insert (MetricSection* section)
 }
 /* user supplies the exact pulse if pls == MusicTime */
 TempoSection*
-TempoMap::add_tempo (const Tempo& tempo, const double& pulse, const framepos_t& frame, PositionLockStyle pls)
+TempoMap::add_tempo (const Tempo& tempo, const double& pulse, const framepos_t frame, PositionLockStyle pls)
 {
        if (tempo.note_types_per_minute() <= 0.0) {
                warning << "Cannot add tempo. note types per minute must be greater than zero." << endmsg;
@@ -1042,7 +1042,7 @@ TempoMap::add_tempo (const Tempo& tempo, const double& pulse, const framepos_t&
 }
 
 void
-TempoMap::replace_tempo (TempoSection& ts, const Tempo& tempo, const double& pulse, const framepos_t& frame, PositionLockStyle pls)
+TempoMap::replace_tempo (TempoSection& ts, const Tempo& tempo, const double& pulse, const framepos_t frame, PositionLockStyle pls)
 {
        if (tempo.note_types_per_minute() <= 0.0) {
                warning << "Cannot replace tempo. note types per minute must be greater than zero." << endmsg;
@@ -1598,7 +1598,7 @@ TempoMap::metric_at (BBT_Time bbt) const
  * This function uses both tempo and meter.
  */
 double
-TempoMap::beat_at_frame (const framecnt_t& frame) const
+TempoMap::beat_at_frame (const framecnt_t frame) const
 {
        Glib::Threads::RWLock::ReaderLock lm (lock);
 
@@ -1695,7 +1695,7 @@ TempoMap::minute_at_beat_locked (const Metrics& metrics, const double& beat) con
  *
  */
 Tempo
-TempoMap::tempo_at_frame (const framepos_t& frame) const
+TempoMap::tempo_at_frame (const framepos_t frame) const
 {
        Glib::Threads::RWLock::ReaderLock lm (lock);
 
@@ -2589,7 +2589,7 @@ TempoMap::check_solved (const Metrics& metrics) const
 }
 
 bool
-TempoMap::set_active_tempi (const Metrics& metrics, const framepos_t& frame)
+TempoMap::set_active_tempi (const Metrics& metrics, const framepos_t frame)
 {
        for (Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) {
                TempoSection* t;
@@ -3179,7 +3179,7 @@ TempoMap::predict_tempo_position (TempoSection* section, const BBT_Time& bbt)
  * if sub_num is zero, the musical position will be taken from the supplied frame.
  */
 void
-TempoMap::gui_set_tempo_position (TempoSection* ts, const framepos_t& frame, const int& sub_num)
+TempoMap::gui_set_tempo_position (TempoSection* ts, const framepos_t frame, const int& sub_num)
 {
        Metrics future_map;
 
@@ -3251,7 +3251,7 @@ TempoMap::gui_set_tempo_position (TempoSection* ts, const framepos_t& frame, con
  * leaving the meter position unchanged.
  */
 void
-TempoMap::gui_set_meter_position (MeterSection* ms, const framepos_t& frame)
+TempoMap::gui_set_meter_position (MeterSection* ms, const framepos_t frame)
 {
        Metrics future_map;
 
@@ -3763,7 +3763,7 @@ TempoMap::music_origin ()
  * This function is sensitive to tempo and meter.
  */
 double
-TempoMap::exact_beat_at_frame (const framepos_t& frame, const int32_t sub_num) const
+TempoMap::exact_beat_at_frame (const framepos_t frame, const int32_t sub_num) const
 {
        Glib::Threads::RWLock::ReaderLock lm (lock);
 
@@ -3771,7 +3771,7 @@ TempoMap::exact_beat_at_frame (const framepos_t& frame, const int32_t sub_num) c
 }
 
 double
-TempoMap::exact_beat_at_frame_locked (const Metrics& metrics, const framepos_t& frame, const int32_t divisions) const
+TempoMap::exact_beat_at_frame_locked (const Metrics& metrics, const framepos_t frame, const int32_t divisions) const
 {
        return beat_at_pulse_locked (_metrics, exact_qn_at_frame_locked (metrics, frame, divisions) / 4.0);
 }
@@ -3799,7 +3799,7 @@ TempoMap::exact_beat_at_frame_locked (const Metrics& metrics, const framepos_t&
  * This function is tempo-sensitive.
  */
 double
-TempoMap::exact_qn_at_frame (const framepos_t& frame, const int32_t sub_num) const
+TempoMap::exact_qn_at_frame (const framepos_t frame, const int32_t sub_num) const
 {
        Glib::Threads::RWLock::ReaderLock lm (lock);
 
@@ -3807,7 +3807,7 @@ TempoMap::exact_qn_at_frame (const framepos_t& frame, const int32_t sub_num) con
 }
 
 double
-TempoMap::exact_qn_at_frame_locked (const Metrics& metrics, const framepos_t& frame, const int32_t sub_num) const
+TempoMap::exact_qn_at_frame_locked (const Metrics& metrics, const framepos_t frame, const int32_t sub_num) const
 {
        double qn = pulse_at_minute_locked (metrics, minute_at_frame (frame)) * 4.0;
 
@@ -4340,7 +4340,7 @@ TempoMap::next_tempo_section_locked (const Metrics& metrics, TempoSection* ts) c
    do that stuff based on the beat_at_frame and frame_at_beat api
 */
 double
-TempoMap::frames_per_quarter_note_at (const framepos_t& frame, const framecnt_t& sr) const
+TempoMap::frames_per_quarter_note_at (const framepos_t frame, const framecnt_t sr) const
 {
        Glib::Threads::RWLock::ReaderLock lm (lock);