mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-18 04:36:30 +01:00
NO-OP: whitespace
* Remove leading and trailing whitespace.
* use tabs to indent, space to align
/* prefer C-style comments like this,
* always use an asterisk on every line, this
* way small ASCII-graphics are always aligned
* using spaces after the asterisk.
*
* ^
* / \
* / \
* / \
* / \
* / \
* / /\ \
* /__/ \_/\_^__\
* A R D O U R
*
<< NO asterisk, there may be tabs :(
*
*/
This commit is contained in:
parent
9ec031cfce
commit
19a2d384fc
2 changed files with 634 additions and 662 deletions
|
|
@ -53,21 +53,21 @@ class Crossfade;
|
|||
|
||||
namespace Properties {
|
||||
/* fake the type, since regions are handled by SequenceProperty which doesn't
|
||||
care about such things.
|
||||
* care about such things.
|
||||
*/
|
||||
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> regions;
|
||||
}
|
||||
|
||||
class LIBARDOUR_API RegionListProperty : public PBD::SequenceProperty<std::list<boost::shared_ptr<Region> > >
|
||||
{
|
||||
public:
|
||||
public:
|
||||
RegionListProperty (Playlist&);
|
||||
|
||||
RegionListProperty* clone () const;
|
||||
void get_content_as_xml (boost::shared_ptr<Region>, XMLNode &) const;
|
||||
boost::shared_ptr<Region> get_content_from_xml (XMLNode const &) const;
|
||||
|
||||
private:
|
||||
private:
|
||||
RegionListProperty* create () const;
|
||||
|
||||
/* copy construction only by ourselves */
|
||||
|
|
@ -254,10 +254,10 @@ public:
|
|||
|
||||
void set_capture_insertion_in_progress (bool yn);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
friend class Session;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
class RegionReadLock : public Glib::Threads::RWLock::ReaderLock {
|
||||
public:
|
||||
RegionReadLock (Playlist *pl) : Glib::Threads::RWLock::ReaderLock (pl->region_lock) {}
|
||||
|
|
@ -410,12 +410,12 @@ public:
|
|||
*/
|
||||
virtual void pre_uncombine (std::vector<boost::shared_ptr<Region> >&, boost::shared_ptr<Region>) {}
|
||||
|
||||
private:
|
||||
private:
|
||||
friend class RegionReadLock;
|
||||
friend class RegionWriteLock;
|
||||
mutable Glib::Threads::RWLock region_lock;
|
||||
|
||||
private:
|
||||
private:
|
||||
void setup_layering_indices (RegionList const &);
|
||||
void coalesce_and_check_crossfades (std::list<Evoral::Range<samplepos_t> >);
|
||||
boost::shared_ptr<RegionList> find_regions_at (samplepos_t);
|
||||
|
|
|
|||
|
|
@ -63,8 +63,6 @@ struct ShowMeTheList {
|
|||
string name;
|
||||
};
|
||||
|
||||
|
||||
|
||||
void
|
||||
Playlist::make_property_quarks ()
|
||||
{
|
||||
|
|
@ -102,8 +100,8 @@ RegionListProperty::create () const
|
|||
void
|
||||
RegionListProperty::get_content_as_xml (boost::shared_ptr<Region> region, XMLNode & node) const
|
||||
{
|
||||
/* All regions (even those which are deleted) have their state saved by other
|
||||
code, so we can just store ID here.
|
||||
/* All regions (even those which are deleted) have their state
|
||||
* saved by other code, so we can just store ID here.
|
||||
*/
|
||||
|
||||
node.set_property ("id", region->id());
|
||||
|
|
@ -349,10 +347,9 @@ Playlist::~Playlist ()
|
|||
void
|
||||
Playlist::_set_sort_id ()
|
||||
{
|
||||
/*
|
||||
Playlists are given names like <track name>.<id>
|
||||
or <track name>.<edit group name>.<id> where id
|
||||
is an integer. We extract the id and sort by that.
|
||||
/* Playlists are given names like <track name>.<id>
|
||||
* or <track name>.<edit group name>.<id> where id
|
||||
* is an integer. We extract the id and sort by that.
|
||||
*/
|
||||
|
||||
size_t dot_position = _name.val().find_last_of(".");
|
||||
|
|
@ -372,9 +369,9 @@ bool
|
|||
Playlist::set_name (const string& str)
|
||||
{
|
||||
/* in a typical situation, a playlist is being used
|
||||
by one diskstream and also is referenced by the
|
||||
Session. if there are more references than that,
|
||||
then don't change the name.
|
||||
* by one diskstream and also is referenced by the
|
||||
* Session. if there are more references than that,
|
||||
* then don't change the name.
|
||||
*/
|
||||
|
||||
if (_refcnt > 2) {
|
||||
|
|
@ -389,11 +386,11 @@ Playlist::set_name (const string& str)
|
|||
}
|
||||
|
||||
/***********************************************************************
|
||||
CHANGE NOTIFICATION HANDLING
|
||||
|
||||
Notifications must be delayed till the region_lock is released. This
|
||||
is necessary because handlers for the signals may need to acquire
|
||||
the lock (e.g. to read from the playlist).
|
||||
* CHANGE NOTIFICATION HANDLING
|
||||
*
|
||||
* Notifications must be delayed till the region_lock is released. This
|
||||
* is necessary because handlers for the signals may need to acquire
|
||||
* the lock (e.g. to read from the playlist).
|
||||
***********************************************************************/
|
||||
|
||||
void
|
||||
|
|
@ -546,7 +543,7 @@ void
|
|||
Playlist::notify_region_added (boost::shared_ptr<Region> r)
|
||||
{
|
||||
/* the length change might not be true, but we have to act
|
||||
as though it could be.
|
||||
* as though it could be.
|
||||
*/
|
||||
|
||||
if (holding_state()) {
|
||||
|
|
@ -583,9 +580,9 @@ Playlist::flush_notifications (bool from_undo)
|
|||
*/
|
||||
|
||||
/* we have no idea what order the regions ended up in pending
|
||||
bounds (it could be based on selection order, for example).
|
||||
so, to preserve layering in the "most recently moved is higher"
|
||||
model, sort them by existing layer, then timestamp them.
|
||||
* bounds (it could be based on selection order, for example).
|
||||
* so, to preserve layering in the "most recently moved is higher"
|
||||
* model, sort them by existing layer, then timestamp them.
|
||||
*/
|
||||
|
||||
// RegionSortByLayer cmp;
|
||||
|
|
@ -661,8 +658,8 @@ Playlist::clear_pending ()
|
|||
}
|
||||
|
||||
/*************************************************************
|
||||
PLAYLIST OPERATIONS
|
||||
*************************************************************/
|
||||
* PLAYLIST OPERATIONS
|
||||
*************************************************************/
|
||||
|
||||
/** Note: this calls set_layer (..., DBL_MAX) so it will reset the layering index of region */
|
||||
void
|
||||
|
|
@ -692,7 +689,7 @@ Playlist::add_region (boost::shared_ptr<Region> region, samplepos_t position, fl
|
|||
}
|
||||
|
||||
/* note that itimes can be zero if we being asked to just
|
||||
insert a single fraction of the region.
|
||||
* insert a single fraction of the region.
|
||||
*/
|
||||
|
||||
for (int i = 0; i < itimes; ++i) {
|
||||
|
|
@ -918,7 +915,6 @@ static void maybe_add_start_beats (TempoMap const& tm, PropertyList& plist, boos
|
|||
* start and end if cutting == true. Regions that lie entirely within start and end are always
|
||||
* removed.
|
||||
*/
|
||||
|
||||
void
|
||||
Playlist::partition_internal (samplepos_t start, samplepos_t end, bool cutting, RegionList& thawlist)
|
||||
{
|
||||
|
|
@ -935,8 +931,8 @@ Playlist::partition_internal (samplepos_t start, samplepos_t end, bool cutting,
|
|||
|
||||
in_partition = true;
|
||||
|
||||
/* need to work from a copy, because otherwise the regions we add during the process
|
||||
get operated on as well.
|
||||
/* need to work from a copy, because otherwise the regions we add
|
||||
* during the process get operated on as well.
|
||||
*/
|
||||
|
||||
RegionList copy = regions.rlist();
|
||||
|
|
@ -958,8 +954,8 @@ Playlist::partition_internal (samplepos_t start, samplepos_t end, bool cutting,
|
|||
}
|
||||
|
||||
/* coverage will return OverlapStart if the start coincides
|
||||
with the end point. we do not partition such a region,
|
||||
so catch this special case.
|
||||
* with the end point. we do not partition such a region,
|
||||
* so catch this special case.
|
||||
*/
|
||||
|
||||
if (current->first_sample() >= end) {
|
||||
|
|
@ -977,18 +973,16 @@ Playlist::partition_internal (samplepos_t start, samplepos_t end, bool cutting,
|
|||
|
||||
if (overlap == Evoral::OverlapInternal) {
|
||||
/* split: we need 3 new regions, the front, middle and end.
|
||||
cut: we need 2 regions, the front and end.
|
||||
*/
|
||||
|
||||
/*
|
||||
start end
|
||||
---------------*************************------------
|
||||
P1 P2 P3 P4
|
||||
SPLIT:
|
||||
---------------*****++++++++++++++++====------------
|
||||
CUT
|
||||
---------------*****----------------====------------
|
||||
|
||||
* cut: we need 2 regions, the front and end.
|
||||
*
|
||||
*
|
||||
* start end
|
||||
* ---------------*************************------------
|
||||
* P1 P2 P3 P4
|
||||
* SPLIT:
|
||||
* ---------------*****++++++++++++++++====------------
|
||||
* CUT
|
||||
* ---------------*****----------------====------------
|
||||
*/
|
||||
|
||||
if (!cutting) {
|
||||
|
|
@ -1088,19 +1082,17 @@ Playlist::partition_internal (samplepos_t start, samplepos_t end, bool cutting,
|
|||
} else if (overlap == Evoral::OverlapStart) {
|
||||
|
||||
/* split: we need 2 regions: the front and the end.
|
||||
cut: just trim current to skip the cut area
|
||||
*/
|
||||
|
||||
/*
|
||||
start end
|
||||
---------------*************************------------
|
||||
P2 P1 P3 P4
|
||||
|
||||
SPLIT:
|
||||
---------------****+++++++++++++++++++++------------
|
||||
CUT:
|
||||
-------------------*********************------------
|
||||
|
||||
* cut: just trim current to skip the cut area
|
||||
*
|
||||
*
|
||||
* start end
|
||||
* ---------------*************************------------
|
||||
* P2 P1 P3 P4
|
||||
*
|
||||
* SPLIT:
|
||||
* ---------------****+++++++++++++++++++++------------
|
||||
* CUT:
|
||||
* -------------------*********************------------
|
||||
*/
|
||||
|
||||
if (!cutting) {
|
||||
|
|
@ -1133,19 +1125,19 @@ Playlist::partition_internal (samplepos_t start, samplepos_t end, bool cutting,
|
|||
} else if (overlap == Evoral::OverlapExternal) {
|
||||
|
||||
/* split: no split required.
|
||||
cut: remove the region.
|
||||
*/
|
||||
|
||||
/*
|
||||
start end
|
||||
---------------*************************------------
|
||||
P2 P1 P3 P4
|
||||
|
||||
SPLIT:
|
||||
---------------*************************------------
|
||||
CUT:
|
||||
----------------------------------------------------
|
||||
|
||||
* cut: remove the region.
|
||||
*
|
||||
*
|
||||
* start end
|
||||
* ---------------*************************------------
|
||||
* P2 P1 P3 P4
|
||||
*
|
||||
*
|
||||
* SPLIT:
|
||||
* ---------------*************************------------
|
||||
* CUT:
|
||||
* ----------------------------------------------------
|
||||
*
|
||||
*/
|
||||
|
||||
if (cutting) {
|
||||
|
|
@ -1186,8 +1178,8 @@ Playlist::cut_copy (boost::shared_ptr<Playlist> (Playlist::*pmf)(samplepos_t, sa
|
|||
} else {
|
||||
|
||||
/* paste the next section into the nascent playlist,
|
||||
offset to reflect the start of the first range we
|
||||
chopped.
|
||||
* offset to reflect the start of the first range we
|
||||
* chopped.
|
||||
*/
|
||||
|
||||
ret->paste (pl, (*i).start - start, 1.0f, 0);
|
||||
|
|
@ -1401,9 +1393,9 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::shift (samplepos_t at, sampleoffset_t distance, bool move_intersected, bool ignore_music_glue)
|
||||
{
|
||||
void
|
||||
Playlist::shift (samplepos_t at, sampleoffset_t distance, bool move_intersected, bool ignore_music_glue)
|
||||
{
|
||||
RegionWriteLock rlock (this);
|
||||
RegionList copy (regions.rlist());
|
||||
RegionList fixup;
|
||||
|
|
@ -1423,7 +1415,7 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
|
|||
}
|
||||
|
||||
/* do not move regions glued to music time - that
|
||||
has to be done separately.
|
||||
* has to be done separately.
|
||||
*/
|
||||
|
||||
if (!ignore_music_glue && (*r)->position_lock_style() != AudioTime) {
|
||||
|
|
@ -1438,32 +1430,31 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
|
|||
for (RegionList::iterator r = fixup.begin(); r != fixup.end(); ++r) {
|
||||
(*r)->recompute_position_from_lock_style (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::split (const MusicSample& at)
|
||||
{
|
||||
void
|
||||
Playlist::split (const MusicSample& at)
|
||||
{
|
||||
RegionWriteLock rlock (this);
|
||||
RegionList copy (regions.rlist());
|
||||
|
||||
/* use a copy since this operation can modify the region list
|
||||
*/
|
||||
/* use a copy since this operation can modify the region list */
|
||||
|
||||
for (RegionList::iterator r = copy.begin(); r != copy.end(); ++r) {
|
||||
_split_region (*r, at);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::split_region (boost::shared_ptr<Region> region, const MusicSample& playlist_position)
|
||||
{
|
||||
void
|
||||
Playlist::split_region (boost::shared_ptr<Region> region, const MusicSample& playlist_position)
|
||||
{
|
||||
RegionWriteLock rl (this);
|
||||
_split_region (region, playlist_position);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::_split_region (boost::shared_ptr<Region> region, const MusicSample& playlist_position)
|
||||
{
|
||||
void
|
||||
Playlist::_split_region (boost::shared_ptr<Region> region, const MusicSample& playlist_position)
|
||||
{
|
||||
if (!region->covers (playlist_position.sample)) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1498,8 +1489,8 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
|
|||
plist.add (Properties::layer, region->layer ());
|
||||
|
||||
/* note: we must use the version of ::create with an offset here,
|
||||
since it supplies that offset to the Region constructor, which
|
||||
is necessary to get audio region gain envelopes right.
|
||||
* since it supplies that offset to the Region constructor, which
|
||||
* is necessary to get audio region gain envelopes right.
|
||||
*/
|
||||
left = RegionFactory::create (region, MusicSample (0, 0), plist, true);
|
||||
}
|
||||
|
|
@ -1525,7 +1516,7 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
|
|||
remove_region_internal (region);
|
||||
|
||||
_splicing = old_sp;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::AddToSoloSelectedList(const Region* r)
|
||||
|
|
@ -1556,9 +1547,9 @@ Playlist::SoloSelectedActive()
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
Playlist::possibly_splice (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude)
|
||||
{
|
||||
void
|
||||
Playlist::possibly_splice (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude)
|
||||
{
|
||||
if (_splicing || in_set_state) {
|
||||
/* don't respond to splicing moves or state setting */
|
||||
return;
|
||||
|
|
@ -1567,11 +1558,11 @@ Playlist::SoloSelectedActive()
|
|||
if (_edit_mode == Splice) {
|
||||
splice_locked (at, distance, exclude);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::possibly_splice_unlocked (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude)
|
||||
{
|
||||
void
|
||||
Playlist::possibly_splice_unlocked (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude)
|
||||
{
|
||||
if (_splicing || in_set_state) {
|
||||
/* don't respond to splicing moves or state setting */
|
||||
return;
|
||||
|
|
@ -1580,26 +1571,26 @@ Playlist::SoloSelectedActive()
|
|||
if (_edit_mode == Splice) {
|
||||
splice_unlocked (at, distance, exclude);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::splice_locked (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude)
|
||||
{
|
||||
void
|
||||
Playlist::splice_locked (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude)
|
||||
{
|
||||
{
|
||||
RegionWriteLock rl (this);
|
||||
core_splice (at, distance, exclude);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::splice_unlocked (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude)
|
||||
{
|
||||
void
|
||||
Playlist::splice_unlocked (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude)
|
||||
{
|
||||
core_splice (at, distance, exclude);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::core_splice (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude)
|
||||
{
|
||||
void
|
||||
Playlist::core_splice (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude)
|
||||
{
|
||||
_splicing = true;
|
||||
|
||||
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
|
|
@ -1686,7 +1677,7 @@ Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shar
|
|||
if (what_changed.contains (Properties::position)) {
|
||||
|
||||
/* remove it from the list then add it back in
|
||||
the right place again.
|
||||
* the right place again.
|
||||
*/
|
||||
|
||||
RegionSortByPosition cmp;
|
||||
|
|
@ -1695,8 +1686,8 @@ Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shar
|
|||
|
||||
if (i == regions.end()) {
|
||||
/* the region bounds are being modified but its not currently
|
||||
in the region list. we will use its bounds correctly when/if
|
||||
it is added
|
||||
* in the region list. we will use its bounds correctly when/if
|
||||
* it is added
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
|
@ -1732,11 +1723,11 @@ Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shar
|
|||
coalesce_and_check_crossfades (xf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::region_changed_proxy (const PropertyChange& what_changed, boost::weak_ptr<Region> weak_region)
|
||||
{
|
||||
void
|
||||
Playlist::region_changed_proxy (const PropertyChange& what_changed, boost::weak_ptr<Region> weak_region)
|
||||
{
|
||||
boost::shared_ptr<Region> region (weak_region.lock());
|
||||
|
||||
if (!region) {
|
||||
|
|
@ -1746,11 +1737,11 @@ Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shar
|
|||
/* this makes a virtual call to the right kind of playlist ... */
|
||||
|
||||
region_changed (what_changed, region);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Playlist::region_changed (const PropertyChange& what_changed, boost::shared_ptr<Region> region)
|
||||
{
|
||||
bool
|
||||
Playlist::region_changed (const PropertyChange& what_changed, boost::shared_ptr<Region> region)
|
||||
{
|
||||
PropertyChange our_interests;
|
||||
PropertyChange bounds;
|
||||
PropertyChange pos_and_length;
|
||||
|
|
@ -1785,7 +1776,7 @@ Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shar
|
|||
}
|
||||
|
||||
/* don't notify about layer changes, since we are the only object that can initiate
|
||||
them, and we notify in ::relayer()
|
||||
* them, and we notify in ::relayer()
|
||||
*/
|
||||
|
||||
if (what_changed.contains (our_interests)) {
|
||||
|
|
@ -1795,19 +1786,19 @@ Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shar
|
|||
mark_session_dirty ();
|
||||
|
||||
return save;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::drop_regions ()
|
||||
{
|
||||
void
|
||||
Playlist::drop_regions ()
|
||||
{
|
||||
RegionWriteLock rl (this);
|
||||
regions.clear ();
|
||||
all_regions.clear ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::sync_all_regions_with_regions ()
|
||||
{
|
||||
void
|
||||
Playlist::sync_all_regions_with_regions ()
|
||||
{
|
||||
RegionWriteLock rl (this);
|
||||
|
||||
all_regions.clear ();
|
||||
|
|
@ -1815,11 +1806,11 @@ Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shar
|
|||
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
all_regions.insert (*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::clear (bool with_signals)
|
||||
{
|
||||
void
|
||||
Playlist::clear (bool with_signals)
|
||||
{
|
||||
{
|
||||
RegionWriteLock rl (this);
|
||||
|
||||
|
|
@ -1848,11 +1839,11 @@ Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shar
|
|||
ContentsChanged ();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* *********************************************************************
|
||||
FINDING THINGS
|
||||
**********************************************************************/
|
||||
/* *********************************************************************
|
||||
FINDING THINGS
|
||||
**********************************************************************/
|
||||
|
||||
boost::shared_ptr<RegionList>
|
||||
Playlist::region_list()
|
||||
|
|
@ -1879,9 +1870,9 @@ Playlist::regions_at (samplepos_t sample)
|
|||
return find_regions_at (sample);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Playlist::count_regions_at (samplepos_t sample) const
|
||||
{
|
||||
uint32_t
|
||||
Playlist::count_regions_at (samplepos_t sample) const
|
||||
{
|
||||
RegionReadLock rlock (const_cast<Playlist*>(this));
|
||||
uint32_t cnt = 0;
|
||||
|
||||
|
|
@ -1892,12 +1883,11 @@ Playlist::regions_at (samplepos_t sample)
|
|||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
}
|
||||
|
||||
boost::shared_ptr<Region>
|
||||
Playlist::top_region_at (samplepos_t sample)
|
||||
|
||||
{
|
||||
boost::shared_ptr<Region>
|
||||
Playlist::top_region_at (samplepos_t sample)
|
||||
{
|
||||
RegionReadLock rlock (this);
|
||||
boost::shared_ptr<RegionList> rlist = find_regions_at (sample);
|
||||
boost::shared_ptr<Region> region;
|
||||
|
|
@ -1909,12 +1899,11 @@ Playlist::regions_at (samplepos_t sample)
|
|||
}
|
||||
|
||||
return region;
|
||||
}
|
||||
}
|
||||
|
||||
boost::shared_ptr<Region>
|
||||
Playlist::top_unmuted_region_at (samplepos_t sample)
|
||||
|
||||
{
|
||||
boost::shared_ptr<Region>
|
||||
Playlist::top_unmuted_region_at (samplepos_t sample)
|
||||
{
|
||||
RegionReadLock rlock (this);
|
||||
boost::shared_ptr<RegionList> rlist = find_regions_at (sample);
|
||||
|
||||
|
|
@ -1940,7 +1929,7 @@ Playlist::regions_at (samplepos_t sample)
|
|||
}
|
||||
|
||||
return region;
|
||||
}
|
||||
}
|
||||
|
||||
boost::shared_ptr<RegionList>
|
||||
Playlist::find_regions_at (samplepos_t sample)
|
||||
|
|
@ -2133,9 +2122,9 @@ Playlist::find_next_region (samplepos_t sample, RegionPoint point, int dir)
|
|||
return ret;
|
||||
}
|
||||
|
||||
samplepos_t
|
||||
Playlist::find_next_region_boundary (samplepos_t sample, int dir)
|
||||
{
|
||||
samplepos_t
|
||||
Playlist::find_next_region_boundary (samplepos_t sample, int dir)
|
||||
{
|
||||
RegionReadLock rlock (this);
|
||||
|
||||
samplepos_t closest = max_samplepos;
|
||||
|
|
@ -2203,39 +2192,35 @@ Playlist::find_next_region (samplepos_t sample, RegionPoint point, int dir)
|
|||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
Playlist::mark_session_dirty ()
|
||||
{
|
||||
void
|
||||
Playlist::mark_session_dirty ()
|
||||
{
|
||||
if (!in_set_state && !holding_state ()) {
|
||||
_session.set_dirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::rdiff (vector<Command*>& cmds) const
|
||||
{
|
||||
void
|
||||
Playlist::rdiff (vector<Command*>& cmds) const
|
||||
{
|
||||
RegionReadLock rlock (const_cast<Playlist *> (this));
|
||||
Stateful::rdiff (cmds);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::clear_owned_changes ()
|
||||
{
|
||||
void
|
||||
Playlist::clear_owned_changes ()
|
||||
{
|
||||
RegionReadLock rlock (this);
|
||||
Stateful::clear_owned_changes ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::update (const RegionListProperty::ChangeRecord& change)
|
||||
{
|
||||
void
|
||||
Playlist::update (const RegionListProperty::ChangeRecord& change)
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::Properties, string_compose ("Playlist %1 updates from a change record with %2 adds %3 removes\n",
|
||||
name(), change.added.size(), change.removed.size()));
|
||||
|
||||
|
|
@ -2250,11 +2235,11 @@ Playlist::find_next_region (samplepos_t sample, RegionPoint point, int dir)
|
|||
}
|
||||
|
||||
thaw ();
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
Playlist::set_state (const XMLNode& node, int version)
|
||||
{
|
||||
int
|
||||
Playlist::set_state (const XMLNode& node, int version)
|
||||
{
|
||||
XMLNode *child;
|
||||
XMLNodeList nlist;
|
||||
XMLNodeConstIterator niter;
|
||||
|
|
@ -2514,7 +2499,6 @@ struct RelayerSort {
|
|||
* regions in the playlist to put the specified region in the appropriate
|
||||
* place. The actual layering will be fixed up when relayer() happens.
|
||||
*/
|
||||
|
||||
void
|
||||
Playlist::set_layer (boost::shared_ptr<Region> region, double new_layer)
|
||||
{
|
||||
|
|
@ -2569,9 +2553,9 @@ Playlist::relayer ()
|
|||
}
|
||||
|
||||
/* Build up a new list of regions on each layer, stored in a set of lists
|
||||
each of which represent some period of time on some layer. The idea
|
||||
is to avoid having to search the entire region list to establish whether
|
||||
each region overlaps another */
|
||||
* each of which represent some period of time on some layer. The idea
|
||||
* is to avoid having to search the entire region list to establish whether
|
||||
* each region overlaps another */
|
||||
|
||||
/* how many pieces to divide this playlist's time up into */
|
||||
int const divisions = 512;
|
||||
|
|
@ -2609,8 +2593,8 @@ Playlist::relayer ()
|
|||
for (RegionList::iterator i = copy.begin(); i != copy.end(); ++i) {
|
||||
|
||||
/* find the time divisions that this region covers; if there are no regions on the list,
|
||||
division_size will equal 0 and in this case we'll just say that
|
||||
start_division = end_division = 0.
|
||||
* division_size will equal 0 and in this case we'll just say that
|
||||
* start_division = end_division = 0.
|
||||
*/
|
||||
int start_division = 0;
|
||||
int end_division = 0;
|
||||
|
|
@ -2629,7 +2613,7 @@ Playlist::relayer ()
|
|||
size_t j = layers.size();
|
||||
while (j > 0) {
|
||||
/* try layer j - 1; it can go on if it overlaps no other region
|
||||
that is already on that layer
|
||||
* that is already on that layer
|
||||
*/
|
||||
|
||||
bool overlap = false;
|
||||
|
|
@ -2670,16 +2654,16 @@ Playlist::relayer ()
|
|||
}
|
||||
|
||||
/* It's a little tricky to know when we could avoid calling this; e.g. if we are
|
||||
relayering because we just removed the only region on the top layer, nothing will
|
||||
appear to have changed, but the StreamView must still sort itself out. We could
|
||||
probably keep a note of the top layer last time we relayered, and check that,
|
||||
but premature optimisation &c...
|
||||
* relayering because we just removed the only region on the top layer, nothing will
|
||||
* appear to have changed, but the StreamView must still sort itself out. We could
|
||||
* probably keep a note of the top layer last time we relayered, and check that,
|
||||
* but premature optimisation &c...
|
||||
*/
|
||||
notify_layering_changed ();
|
||||
|
||||
/* This relayer() may have been called as a result of a region removal, in which
|
||||
case we need to setup layering indices to account for the one that has just
|
||||
gone away.
|
||||
* case we need to setup layering indices to account for the one that has just
|
||||
* gone away.
|
||||
*/
|
||||
setup_layering_indices (copy);
|
||||
}
|
||||
|
|
@ -2766,10 +2750,10 @@ Playlist::uses_source (boost::shared_ptr<const Source> src, bool shallow) const
|
|||
|
||||
for (set<boost::shared_ptr<Region> >::const_iterator r = all_regions.begin(); r != all_regions.end(); ++r) {
|
||||
/* Note: passing the second argument as false can cause at best
|
||||
incredibly deep and time-consuming recursion, and at worst
|
||||
cycles if the user has managed to create cycles of reference
|
||||
between compound regions. We generally only this during
|
||||
cleanup, and @param shallow is passed as true.
|
||||
* incredibly deep and time-consuming recursion, and at worst
|
||||
* cycles if the user has managed to create cycles of reference
|
||||
* between compound regions. We generally only this during
|
||||
* cleanup, and @param shallow is passed as true.
|
||||
*/
|
||||
if ((*r)->uses_source (src, shallow)) {
|
||||
return true;
|
||||
|
|
@ -2908,14 +2892,14 @@ Playlist::shuffle (boost::shared_ptr<Region> region, int dir)
|
|||
|
||||
if ((*next)->position() != region->last_sample() + 1) {
|
||||
/* they didn't used to touch, so after shuffle,
|
||||
just have them swap positions.
|
||||
* just have them swap positions.
|
||||
*/
|
||||
new_pos = (*next)->position();
|
||||
} else {
|
||||
/* they used to touch, so after shuffle,
|
||||
make sure they still do. put the earlier
|
||||
region where the later one will end after
|
||||
it is moved.
|
||||
* make sure they still do. put the earlier
|
||||
* region where the later one will end after
|
||||
* it is moved.
|
||||
*/
|
||||
new_pos = region->position() + (*next)->length();
|
||||
}
|
||||
|
|
@ -2950,13 +2934,13 @@ Playlist::shuffle (boost::shared_ptr<Region> region, int dir)
|
|||
samplepos_t new_pos;
|
||||
if (region->position() != (*prev)->last_sample() + 1) {
|
||||
/* they didn't used to touch, so after shuffle,
|
||||
just have them swap positions.
|
||||
* just have them swap positions.
|
||||
*/
|
||||
new_pos = region->position();
|
||||
} else {
|
||||
/* they used to touch, so after shuffle,
|
||||
make sure they still do. put the earlier
|
||||
one where the later one will end after
|
||||
* make sure they still do. put the earlier
|
||||
* one where the later one will end after
|
||||
*/
|
||||
new_pos = (*prev)->position() + region->length();
|
||||
}
|
||||
|
|
@ -3159,9 +3143,7 @@ Playlist::combine (const RegionList& r)
|
|||
|
||||
boost::shared_ptr<Region> parent_region = RegionFactory::create (sources, plist, true);
|
||||
|
||||
/* now the non-whole-file region that we will actually use in the
|
||||
* playlist
|
||||
*/
|
||||
/* now the non-whole-file region that we will actually use in the playlist */
|
||||
|
||||
plist.clear ();
|
||||
plist.add (Properties::start, 0);
|
||||
|
|
@ -3171,8 +3153,7 @@ Playlist::combine (const RegionList& r)
|
|||
|
||||
boost::shared_ptr<Region> compound_region = RegionFactory::create (parent_region, plist, true);
|
||||
|
||||
/* remove all the selected regions from the current playlist
|
||||
*/
|
||||
/* remove all the selected regions from the current playlist */
|
||||
|
||||
freeze ();
|
||||
|
||||
|
|
@ -3180,9 +3161,7 @@ Playlist::combine (const RegionList& r)
|
|||
remove_region (*i);
|
||||
}
|
||||
|
||||
/* do type-specific stuff with the originals and the new compound
|
||||
region
|
||||
*/
|
||||
/* do type-specific stuff with the originals and the new compound region */
|
||||
|
||||
post_combine (originals, compound_region);
|
||||
|
||||
|
|
@ -3217,12 +3196,12 @@ Playlist::uncombine (boost::shared_ptr<Region> target)
|
|||
samplepos_t adjusted_end = 0; // gcc isn't smart enough
|
||||
|
||||
/* the leftmost (earliest) edge of the compound region
|
||||
starts at zero in its source, or larger if it
|
||||
has been trimmed or content-scrolled.
|
||||
|
||||
the rightmost (latest) edge of the compound region
|
||||
relative to its source is the starting point plus
|
||||
the length of the region.
|
||||
* starts at zero in its source, or larger if it
|
||||
* has been trimmed or content-scrolled.
|
||||
*
|
||||
* the rightmost (latest) edge of the compound region
|
||||
* relative to its source is the starting point plus
|
||||
* the length of the region.
|
||||
*/
|
||||
|
||||
// (2) get all the original regions
|
||||
|
|
@ -3267,9 +3246,7 @@ Playlist::uncombine (boost::shared_ptr<Region> target)
|
|||
samplepos_t pos = original->position();
|
||||
/* make a copy, but don't announce it */
|
||||
original = RegionFactory::create (original, false);
|
||||
/* the pure copy constructor resets position() to zero,
|
||||
so fix that up.
|
||||
*/
|
||||
/* the pure copy constructor resets position() to zero, so fix that up. */
|
||||
original->set_position (pos);
|
||||
}
|
||||
|
||||
|
|
@ -3284,7 +3261,7 @@ Playlist::uncombine (boost::shared_ptr<Region> target)
|
|||
switch (original->coverage (adjusted_start, adjusted_end)) {
|
||||
case Evoral::OverlapNone:
|
||||
/* original region does not cover any part
|
||||
of the current state of the compound region
|
||||
* of the current state of the compound region
|
||||
*/
|
||||
continue;
|
||||
|
||||
|
|
@ -3297,15 +3274,11 @@ Playlist::uncombine (boost::shared_ptr<Region> target)
|
|||
break;
|
||||
|
||||
case Evoral::OverlapExternal:
|
||||
/* overlap fully covers original, so leave it
|
||||
as is
|
||||
*/
|
||||
/* overlap fully covers original, so leave it as is */
|
||||
break;
|
||||
|
||||
case Evoral::OverlapEnd:
|
||||
/* overlap starts within but covers end,
|
||||
so trim the front of the region
|
||||
*/
|
||||
/* overlap starts within but covers end, so trim the front of the region */
|
||||
original->trim_front (adjusted_start);
|
||||
modified_region = true;
|
||||
break;
|
||||
|
|
@ -3320,8 +3293,7 @@ Playlist::uncombine (boost::shared_ptr<Region> target)
|
|||
}
|
||||
|
||||
if (move_offset) {
|
||||
/* fix the position to match any movement of the compound region.
|
||||
*/
|
||||
/* fix the position to match any movement of the compound region. */
|
||||
original->set_position (original->position() + move_offset);
|
||||
modified_region = true;
|
||||
}
|
||||
|
|
@ -3451,7 +3423,7 @@ void
|
|||
Playlist::coalesce_and_check_crossfades (list<Evoral::Range<samplepos_t> > ranges)
|
||||
{
|
||||
/* XXX: it's a shame that this coalesce algorithm also exists in
|
||||
TimeSelection::consolidate().
|
||||
* TimeSelection::consolidate().
|
||||
*/
|
||||
|
||||
/* XXX: xfade: this is implemented in Evoral::RangeList */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue