ensure that all Region methods accepting timepos_t use a const & to avoid copy-construction
This commit is contained in:
parent
c04b9c2429
commit
66bcf20950
@ -159,7 +159,7 @@ public:
|
|||||||
timecnt_t sync_offset (int& dir) const;
|
timecnt_t sync_offset (int& dir) const;
|
||||||
timepos_t sync_position () const;
|
timepos_t sync_position () const;
|
||||||
|
|
||||||
timepos_t adjust_to_sync (timepos_t) const;
|
timepos_t adjust_to_sync (timepos_t const &) const;
|
||||||
|
|
||||||
/* first_sample() is an alias; last_sample() just hides some math */
|
/* first_sample() is an alias; last_sample() just hides some math */
|
||||||
|
|
||||||
@ -244,9 +244,9 @@ public:
|
|||||||
|
|
||||||
void set_length (timecnt_t const &);
|
void set_length (timecnt_t const &);
|
||||||
void set_start (timecnt_t const &);
|
void set_start (timecnt_t const &);
|
||||||
void set_position (timepos_t);
|
void set_position (timepos_t const &);
|
||||||
void set_initial_position (timepos_t);
|
void set_initial_position (timepos_t const &);
|
||||||
void special_set_position (timepos_t);
|
void special_set_position (timepos_t const &);
|
||||||
virtual void update_after_tempo_map_change (bool send_change = true);
|
virtual void update_after_tempo_map_change (bool send_change = true);
|
||||||
void nudge_position (timecnt_t const &);
|
void nudge_position (timecnt_t const &);
|
||||||
|
|
||||||
@ -254,15 +254,15 @@ public:
|
|||||||
void move_to_natural_position ();
|
void move_to_natural_position ();
|
||||||
|
|
||||||
void move_start (timecnt_t const & distance);
|
void move_start (timecnt_t const & distance);
|
||||||
void trim_front (timepos_t new_position);
|
void trim_front (timepos_t const & new_position);
|
||||||
void trim_end (timepos_t new_position);
|
void trim_end (timepos_t const & new_position);
|
||||||
void trim_to (timepos_t pos, timecnt_t const & length);
|
void trim_to (timepos_t const & pos, timecnt_t const & length);
|
||||||
|
|
||||||
/* fades are inherently audio in nature and we specify them in samples */
|
/* fades are inherently audio in nature and we specify them in samples */
|
||||||
virtual void fade_range (samplepos_t, samplepos_t) {}
|
virtual void fade_range (samplepos_t, samplepos_t) {}
|
||||||
|
|
||||||
void cut_front (timepos_t new_position);
|
void cut_front (timepos_t const & new_position);
|
||||||
void cut_end (timepos_t new_position);
|
void cut_end (timepos_t const & new_position);
|
||||||
|
|
||||||
void set_layer (layer_t l); /* ONLY Playlist can call this */
|
void set_layer (layer_t l); /* ONLY Playlist can call this */
|
||||||
void raise ();
|
void raise ();
|
||||||
@ -270,7 +270,7 @@ public:
|
|||||||
void raise_to_top ();
|
void raise_to_top ();
|
||||||
void lower_to_bottom ();
|
void lower_to_bottom ();
|
||||||
|
|
||||||
void set_sync_position (timepos_t n);
|
void set_sync_position (timepos_t const & n);
|
||||||
void clear_sync_position ();
|
void clear_sync_position ();
|
||||||
void set_hidden (bool yn);
|
void set_hidden (bool yn);
|
||||||
void set_muted (bool yn);
|
void set_muted (bool yn);
|
||||||
@ -413,7 +413,7 @@ protected:
|
|||||||
Region (boost::shared_ptr<const Region>, const SourceList&);
|
Region (boost::shared_ptr<const Region>, const SourceList&);
|
||||||
|
|
||||||
/** Constructor for derived types only */
|
/** Constructor for derived types only */
|
||||||
Region (Session& s, timepos_t start, timecnt_t length, const std::string& name, DataType);
|
Region (Session& s, timepos_t const & start, timecnt_t length, const std::string& name, DataType);
|
||||||
|
|
||||||
virtual bool can_trim_start_before_source_start () const {
|
virtual bool can_trim_start_before_source_start () const {
|
||||||
return false;
|
return false;
|
||||||
@ -424,7 +424,7 @@ protected:
|
|||||||
void send_change (const PBD::PropertyChange&);
|
void send_change (const PBD::PropertyChange&);
|
||||||
virtual int _set_state (const XMLNode&, int version, PBD::PropertyChange& what_changed, bool send_signal);
|
virtual int _set_state (const XMLNode&, int version, PBD::PropertyChange& what_changed, bool send_signal);
|
||||||
void post_set (const PBD::PropertyChange&);
|
void post_set (const PBD::PropertyChange&);
|
||||||
virtual void set_position_internal (timepos_t pos);
|
virtual void set_position_internal (timepos_t const & pos);
|
||||||
virtual void set_length_internal (timecnt_t const &);
|
virtual void set_length_internal (timecnt_t const &);
|
||||||
virtual void set_start_internal (timecnt_t const &);
|
virtual void set_start_internal (timecnt_t const &);
|
||||||
bool verify_start_and_length (timecnt_t const &, timecnt_t&);
|
bool verify_start_and_length (timecnt_t const &, timecnt_t&);
|
||||||
@ -469,9 +469,9 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void mid_thaw (const PBD::PropertyChange&);
|
void mid_thaw (const PBD::PropertyChange&);
|
||||||
|
|
||||||
virtual void trim_to_internal (timepos_t position, timecnt_t const & length);
|
virtual void trim_to_internal (timepos_t const & position, timecnt_t const & length);
|
||||||
void modify_front (timepos_t new_position, bool reset_fade);
|
void modify_front (timepos_t const & new_position, bool reset_fade);
|
||||||
void modify_end (timepos_t new_position, bool reset_fade);
|
void modify_end (timepos_t const & new_position, bool reset_fade);
|
||||||
|
|
||||||
void maybe_uncopy ();
|
void maybe_uncopy ();
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ Region::register_properties ()
|
|||||||
, _contents (Properties::contents, other->_contents)
|
, _contents (Properties::contents, other->_contents)
|
||||||
|
|
||||||
/* derived-from-derived constructor (no sources in constructor) */
|
/* derived-from-derived constructor (no sources in constructor) */
|
||||||
Region::Region (Session& s, timepos_t start, timecnt_t length, const string& name, DataType type)
|
Region::Region (Session& s, timepos_t const & start, timecnt_t length, const string& name, DataType type)
|
||||||
: SessionObject(s, name)
|
: SessionObject(s, name)
|
||||||
, _type(type)
|
, _type(type)
|
||||||
, REGION_DEFAULT_STATE(start,length)
|
, REGION_DEFAULT_STATE(start,length)
|
||||||
@ -576,7 +576,7 @@ Region::move_to_natural_position ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Region::special_set_position (timepos_t pos)
|
Region::special_set_position (timepos_t const & pos)
|
||||||
{
|
{
|
||||||
/* this is used when creating a whole file region as
|
/* this is used when creating a whole file region as
|
||||||
* a way to store its "natural" or "captured" position.
|
* a way to store its "natural" or "captured" position.
|
||||||
@ -621,7 +621,7 @@ Region::update_after_tempo_map_change (bool send)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Region::set_position (timepos_t pos)
|
Region::set_position (timepos_t const & pos)
|
||||||
{
|
{
|
||||||
if (!can_move()) {
|
if (!can_move()) {
|
||||||
return;
|
return;
|
||||||
@ -652,7 +652,7 @@ Region::set_position (timepos_t pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Region::set_position_internal (timepos_t pos)
|
Region::set_position_internal (timepos_t const & pos)
|
||||||
{
|
{
|
||||||
/* We emit a change of Properties::position even if the position hasn't changed
|
/* We emit a change of Properties::position even if the position hasn't changed
|
||||||
* (see Region::set_position), so we must always set this up so that
|
* (see Region::set_position), so we must always set this up so that
|
||||||
@ -684,7 +684,7 @@ Region::set_position_internal (timepos_t pos)
|
|||||||
* _last_position to prevent an implied move.
|
* _last_position to prevent an implied move.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Region::set_initial_position (timepos_t pos)
|
Region::set_initial_position (timepos_t const & pos)
|
||||||
{
|
{
|
||||||
if (!can_move()) {
|
if (!can_move()) {
|
||||||
return;
|
return;
|
||||||
@ -838,25 +838,25 @@ Region::move_start (timecnt_t const & distance)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Region::trim_front (timepos_t new_position)
|
Region::trim_front (timepos_t const & new_position)
|
||||||
{
|
{
|
||||||
modify_front (new_position, false);
|
modify_front (new_position, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Region::cut_front (timepos_t new_position)
|
Region::cut_front (timepos_t const & new_position)
|
||||||
{
|
{
|
||||||
modify_front (new_position, true);
|
modify_front (new_position, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Region::cut_end (timepos_t new_endpoint)
|
Region::cut_end (timepos_t const & new_endpoint)
|
||||||
{
|
{
|
||||||
modify_end (new_endpoint, true);
|
modify_end (new_endpoint, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Region::modify_front (timepos_t new_position, bool reset_fade)
|
Region::modify_front (timepos_t const & new_position, bool reset_fade)
|
||||||
{
|
{
|
||||||
if (locked()) {
|
if (locked()) {
|
||||||
return;
|
return;
|
||||||
@ -902,7 +902,7 @@ Region::modify_front (timepos_t new_position, bool reset_fade)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Region::modify_end (timepos_t new_endpoint, bool reset_fade)
|
Region::modify_end (timepos_t const & new_endpoint, bool reset_fade)
|
||||||
{
|
{
|
||||||
if (locked()) {
|
if (locked()) {
|
||||||
return;
|
return;
|
||||||
@ -923,13 +923,13 @@ Region::modify_end (timepos_t new_endpoint, bool reset_fade)
|
|||||||
* a region at 0 of length 10 has an endpoint of 9.
|
* a region at 0 of length 10 has an endpoint of 9.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Region::trim_end (timepos_t new_endpoint)
|
Region::trim_end (timepos_t const & new_endpoint)
|
||||||
{
|
{
|
||||||
modify_end (new_endpoint, false);
|
modify_end (new_endpoint, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Region::trim_to (timepos_t position, timecnt_t const & length)
|
Region::trim_to (timepos_t const & position, timecnt_t const & length)
|
||||||
{
|
{
|
||||||
if (locked()) {
|
if (locked()) {
|
||||||
return;
|
return;
|
||||||
@ -944,7 +944,7 @@ Region::trim_to (timepos_t position, timecnt_t const & length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Region::trim_to_internal (timepos_t position, timecnt_t const & length)
|
Region::trim_to_internal (timepos_t const & position, timecnt_t const & length)
|
||||||
{
|
{
|
||||||
timecnt_t new_start;
|
timecnt_t new_start;
|
||||||
|
|
||||||
@ -1100,7 +1100,7 @@ Region::set_position_locked (bool yn)
|
|||||||
* @param absolute_pos Session time.
|
* @param absolute_pos Session time.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Region::set_sync_position (timepos_t absolute_pos)
|
Region::set_sync_position (timepos_t const & absolute_pos)
|
||||||
{
|
{
|
||||||
/* position within our file */
|
/* position within our file */
|
||||||
const timecnt_t file_pos = nt_start() + nt_position().distance (absolute_pos);
|
const timecnt_t file_pos = nt_start() + nt_position().distance (absolute_pos);
|
||||||
@ -1148,7 +1148,7 @@ Region::sync_offset (int& dir) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
timepos_t
|
timepos_t
|
||||||
Region::adjust_to_sync (timepos_t pos) const
|
Region::adjust_to_sync (timepos_t const & pos) const
|
||||||
{
|
{
|
||||||
int sync_dir;
|
int sync_dir;
|
||||||
timepos_t p = pos;
|
timepos_t p = pos;
|
||||||
|
Loading…
Reference in New Issue
Block a user