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:
Robin Gareus 2018-12-21 16:35:07 +01:00
parent 9ec031cfce
commit 19a2d384fc
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 634 additions and 662 deletions

View file

@ -53,7 +53,7 @@ class Crossfade;
namespace Properties { namespace Properties {
/* fake the type, since regions are handled by SequenceProperty which doesn't /* 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; LIBARDOUR_API extern PBD::PropertyDescriptor<bool> regions;
} }

View file

@ -63,8 +63,6 @@ struct ShowMeTheList {
string name; string name;
}; };
void void
Playlist::make_property_quarks () Playlist::make_property_quarks ()
{ {
@ -102,8 +100,8 @@ RegionListProperty::create () const
void void
RegionListProperty::get_content_as_xml (boost::shared_ptr<Region> region, XMLNode & node) const 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 /* All regions (even those which are deleted) have their state
code, so we can just store ID here. * saved by other code, so we can just store ID here.
*/ */
node.set_property ("id", region->id()); node.set_property ("id", region->id());
@ -349,10 +347,9 @@ Playlist::~Playlist ()
void void
Playlist::_set_sort_id () Playlist::_set_sort_id ()
{ {
/* /* Playlists are given names like <track name>.<id>
Playlists are given names like <track name>.<id> * or <track name>.<edit group name>.<id> where id
or <track name>.<edit group name>.<id> where id * is an integer. We extract the id and sort by that.
is an integer. We extract the id and sort by that.
*/ */
size_t dot_position = _name.val().find_last_of("."); size_t dot_position = _name.val().find_last_of(".");
@ -372,9 +369,9 @@ bool
Playlist::set_name (const string& str) Playlist::set_name (const string& str)
{ {
/* in a typical situation, a playlist is being used /* in a typical situation, a playlist is being used
by one diskstream and also is referenced by the * by one diskstream and also is referenced by the
Session. if there are more references than that, * Session. if there are more references than that,
then don't change the name. * then don't change the name.
*/ */
if (_refcnt > 2) { if (_refcnt > 2) {
@ -389,11 +386,11 @@ Playlist::set_name (const string& str)
} }
/*********************************************************************** /***********************************************************************
CHANGE NOTIFICATION HANDLING * CHANGE NOTIFICATION HANDLING
*
Notifications must be delayed till the region_lock is released. This * Notifications must be delayed till the region_lock is released. This
is necessary because handlers for the signals may need to acquire * is necessary because handlers for the signals may need to acquire
the lock (e.g. to read from the playlist). * the lock (e.g. to read from the playlist).
***********************************************************************/ ***********************************************************************/
void void
@ -546,7 +543,7 @@ void
Playlist::notify_region_added (boost::shared_ptr<Region> r) Playlist::notify_region_added (boost::shared_ptr<Region> r)
{ {
/* the length change might not be true, but we have to act /* 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()) { 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 /* we have no idea what order the regions ended up in pending
bounds (it could be based on selection order, for example). * bounds (it could be based on selection order, for example).
so, to preserve layering in the "most recently moved is higher" * so, to preserve layering in the "most recently moved is higher"
model, sort them by existing layer, then timestamp them. * model, sort them by existing layer, then timestamp them.
*/ */
// RegionSortByLayer cmp; // RegionSortByLayer cmp;
@ -661,7 +658,7 @@ Playlist::clear_pending ()
} }
/************************************************************* /*************************************************************
PLAYLIST OPERATIONS * PLAYLIST OPERATIONS
*************************************************************/ *************************************************************/
/** Note: this calls set_layer (..., DBL_MAX) so it will reset the layering index of region */ /** Note: this calls set_layer (..., DBL_MAX) so it will reset the layering index of region */
@ -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 /* 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) { 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 * start and end if cutting == true. Regions that lie entirely within start and end are always
* removed. * removed.
*/ */
void void
Playlist::partition_internal (samplepos_t start, samplepos_t end, bool cutting, RegionList& thawlist) 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; in_partition = true;
/* need to work from a copy, because otherwise the regions we add during the process /* need to work from a copy, because otherwise the regions we add
get operated on as well. * during the process get operated on as well.
*/ */
RegionList copy = regions.rlist(); 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 /* coverage will return OverlapStart if the start coincides
with the end point. we do not partition such a region, * with the end point. we do not partition such a region,
so catch this special case. * so catch this special case.
*/ */
if (current->first_sample() >= end) { if (current->first_sample() >= end) {
@ -977,18 +973,16 @@ Playlist::partition_internal (samplepos_t start, samplepos_t end, bool cutting,
if (overlap == Evoral::OverlapInternal) { if (overlap == Evoral::OverlapInternal) {
/* split: we need 3 new regions, the front, middle and end. /* split: we need 3 new regions, the front, middle and end.
cut: we need 2 regions, the front and end. * cut: we need 2 regions, the front and end.
*/ *
*
/* * start end
start end * ---------------*************************------------
---------------*************************------------ * P1 P2 P3 P4
P1 P2 P3 P4 * SPLIT:
SPLIT: * ---------------*****++++++++++++++++====------------
---------------*****++++++++++++++++====------------ * CUT
CUT * ---------------*****----------------====------------
---------------*****----------------====------------
*/ */
if (!cutting) { if (!cutting) {
@ -1088,19 +1082,17 @@ Playlist::partition_internal (samplepos_t start, samplepos_t end, bool cutting,
} else if (overlap == Evoral::OverlapStart) { } else if (overlap == Evoral::OverlapStart) {
/* split: we need 2 regions: the front and the end. /* split: we need 2 regions: the front and the end.
cut: just trim current to skip the cut area * cut: just trim current to skip the cut area
*/ *
*
/* * start end
start end * ---------------*************************------------
---------------*************************------------ * P2 P1 P3 P4
P2 P1 P3 P4 *
* SPLIT:
SPLIT: * ---------------****+++++++++++++++++++++------------
---------------****+++++++++++++++++++++------------ * CUT:
CUT: * -------------------*********************------------
-------------------*********************------------
*/ */
if (!cutting) { if (!cutting) {
@ -1133,19 +1125,19 @@ Playlist::partition_internal (samplepos_t start, samplepos_t end, bool cutting,
} else if (overlap == Evoral::OverlapExternal) { } else if (overlap == Evoral::OverlapExternal) {
/* split: no split required. /* split: no split required.
cut: remove the region. * cut: remove the region.
*/ *
*
/* * start end
start end * ---------------*************************------------
---------------*************************------------ * P2 P1 P3 P4
P2 P1 P3 P4 *
*
SPLIT: * SPLIT:
---------------*************************------------ * ---------------*************************------------
CUT: * CUT:
---------------------------------------------------- * ----------------------------------------------------
*
*/ */
if (cutting) { if (cutting) {
@ -1186,8 +1178,8 @@ Playlist::cut_copy (boost::shared_ptr<Playlist> (Playlist::*pmf)(samplepos_t, sa
} else { } else {
/* paste the next section into the nascent playlist, /* paste the next section into the nascent playlist,
offset to reflect the start of the first range we * offset to reflect the start of the first range we
chopped. * chopped.
*/ */
ret->paste (pl, (*i).start - start, 1.0f, 0); ret->paste (pl, (*i).start - start, 1.0f, 0);
@ -1423,7 +1415,7 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
} }
/* do not move regions glued to music time - that /* 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) { if (!ignore_music_glue && (*r)->position_lock_style() != AudioTime) {
@ -1446,8 +1438,7 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
RegionWriteLock rlock (this); RegionWriteLock rlock (this);
RegionList copy (regions.rlist()); 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) { for (RegionList::iterator r = copy.begin(); r != copy.end(); ++r) {
_split_region (*r, at); _split_region (*r, at);
@ -1498,8 +1489,8 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
plist.add (Properties::layer, region->layer ()); plist.add (Properties::layer, region->layer ());
/* note: we must use the version of ::create with an offset here, /* note: we must use the version of ::create with an offset here,
since it supplies that offset to the Region constructor, which * since it supplies that offset to the Region constructor, which
is necessary to get audio region gain envelopes right. * is necessary to get audio region gain envelopes right.
*/ */
left = RegionFactory::create (region, MusicSample (0, 0), plist, true); left = RegionFactory::create (region, MusicSample (0, 0), plist, true);
} }
@ -1686,7 +1677,7 @@ Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shar
if (what_changed.contains (Properties::position)) { if (what_changed.contains (Properties::position)) {
/* remove it from the list then add it back in /* remove it from the list then add it back in
the right place again. * the right place again.
*/ */
RegionSortByPosition cmp; RegionSortByPosition cmp;
@ -1695,8 +1686,8 @@ Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shar
if (i == regions.end()) { if (i == regions.end()) {
/* the region bounds are being modified but its not currently /* the region bounds are being modified but its not currently
in the region list. we will use its bounds correctly when/if * in the region list. we will use its bounds correctly when/if
it is added * it is added
*/ */
return; return;
} }
@ -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 /* 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)) { if (what_changed.contains (our_interests)) {
@ -1896,7 +1887,6 @@ Playlist::regions_at (samplepos_t sample)
boost::shared_ptr<Region> boost::shared_ptr<Region>
Playlist::top_region_at (samplepos_t sample) Playlist::top_region_at (samplepos_t sample)
{ {
RegionReadLock rlock (this); RegionReadLock rlock (this);
boost::shared_ptr<RegionList> rlist = find_regions_at (sample); boost::shared_ptr<RegionList> rlist = find_regions_at (sample);
@ -1913,7 +1903,6 @@ Playlist::regions_at (samplepos_t sample)
boost::shared_ptr<Region> boost::shared_ptr<Region>
Playlist::top_unmuted_region_at (samplepos_t sample) Playlist::top_unmuted_region_at (samplepos_t sample)
{ {
RegionReadLock rlock (this); RegionReadLock rlock (this);
boost::shared_ptr<RegionList> rlist = find_regions_at (sample); boost::shared_ptr<RegionList> rlist = find_regions_at (sample);
@ -2205,12 +2194,8 @@ Playlist::find_next_region (samplepos_t sample, RegionPoint point, int dir)
return ret; return ret;
} }
/***********************************************************************/ /***********************************************************************/
void void
Playlist::mark_session_dirty () Playlist::mark_session_dirty ()
{ {
@ -2514,7 +2499,6 @@ struct RelayerSort {
* regions in the playlist to put the specified region in the appropriate * regions in the playlist to put the specified region in the appropriate
* place. The actual layering will be fixed up when relayer() happens. * place. The actual layering will be fixed up when relayer() happens.
*/ */
void void
Playlist::set_layer (boost::shared_ptr<Region> region, double new_layer) 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 /* 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 * 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 * is to avoid having to search the entire region list to establish whether
each region overlaps another */ * each region overlaps another */
/* how many pieces to divide this playlist's time up into */ /* how many pieces to divide this playlist's time up into */
int const divisions = 512; int const divisions = 512;
@ -2609,8 +2593,8 @@ Playlist::relayer ()
for (RegionList::iterator i = copy.begin(); i != copy.end(); ++i) { 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, /* 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 * division_size will equal 0 and in this case we'll just say that
start_division = end_division = 0. * start_division = end_division = 0.
*/ */
int start_division = 0; int start_division = 0;
int end_division = 0; int end_division = 0;
@ -2629,7 +2613,7 @@ Playlist::relayer ()
size_t j = layers.size(); size_t j = layers.size();
while (j > 0) { while (j > 0) {
/* try layer j - 1; it can go on if it overlaps no other region /* 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; 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 /* 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 * 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 * 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, * probably keep a note of the top layer last time we relayered, and check that,
but premature optimisation &c... * but premature optimisation &c...
*/ */
notify_layering_changed (); notify_layering_changed ();
/* This relayer() may have been called as a result of a region removal, in which /* 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 * case we need to setup layering indices to account for the one that has just
gone away. * gone away.
*/ */
setup_layering_indices (copy); 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) { 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 /* Note: passing the second argument as false can cause at best
incredibly deep and time-consuming recursion, and at worst * incredibly deep and time-consuming recursion, and at worst
cycles if the user has managed to create cycles of reference * cycles if the user has managed to create cycles of reference
between compound regions. We generally only this during * between compound regions. We generally only this during
cleanup, and @param shallow is passed as true. * cleanup, and @param shallow is passed as true.
*/ */
if ((*r)->uses_source (src, shallow)) { if ((*r)->uses_source (src, shallow)) {
return true; return true;
@ -2908,14 +2892,14 @@ Playlist::shuffle (boost::shared_ptr<Region> region, int dir)
if ((*next)->position() != region->last_sample() + 1) { if ((*next)->position() != region->last_sample() + 1) {
/* they didn't used to touch, so after shuffle, /* they didn't used to touch, so after shuffle,
just have them swap positions. * just have them swap positions.
*/ */
new_pos = (*next)->position(); new_pos = (*next)->position();
} else { } else {
/* they used to touch, so after shuffle, /* they used to touch, so after shuffle,
make sure they still do. put the earlier * make sure they still do. put the earlier
region where the later one will end after * region where the later one will end after
it is moved. * it is moved.
*/ */
new_pos = region->position() + (*next)->length(); new_pos = region->position() + (*next)->length();
} }
@ -2950,13 +2934,13 @@ Playlist::shuffle (boost::shared_ptr<Region> region, int dir)
samplepos_t new_pos; samplepos_t new_pos;
if (region->position() != (*prev)->last_sample() + 1) { if (region->position() != (*prev)->last_sample() + 1) {
/* they didn't used to touch, so after shuffle, /* they didn't used to touch, so after shuffle,
just have them swap positions. * just have them swap positions.
*/ */
new_pos = region->position(); new_pos = region->position();
} else { } else {
/* they used to touch, so after shuffle, /* they used to touch, so after shuffle,
make sure they still do. put the earlier * make sure they still do. put the earlier
one where the later one will end after * one where the later one will end after
*/ */
new_pos = (*prev)->position() + region->length(); 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); boost::shared_ptr<Region> parent_region = RegionFactory::create (sources, plist, true);
/* now the non-whole-file region that we will actually use in the /* now the non-whole-file region that we will actually use in the playlist */
* playlist
*/
plist.clear (); plist.clear ();
plist.add (Properties::start, 0); 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); 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 (); freeze ();
@ -3180,9 +3161,7 @@ Playlist::combine (const RegionList& r)
remove_region (*i); remove_region (*i);
} }
/* do type-specific stuff with the originals and the new compound /* do type-specific stuff with the originals and the new compound region */
region
*/
post_combine (originals, 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 samplepos_t adjusted_end = 0; // gcc isn't smart enough
/* the leftmost (earliest) edge of the compound region /* the leftmost (earliest) edge of the compound region
starts at zero in its source, or larger if it * starts at zero in its source, or larger if it
has been trimmed or content-scrolled. * has been trimmed or content-scrolled.
*
the rightmost (latest) edge of the compound region * the rightmost (latest) edge of the compound region
relative to its source is the starting point plus * relative to its source is the starting point plus
the length of the region. * the length of the region.
*/ */
// (2) get all the original regions // (2) get all the original regions
@ -3267,9 +3246,7 @@ Playlist::uncombine (boost::shared_ptr<Region> target)
samplepos_t pos = original->position(); samplepos_t pos = original->position();
/* make a copy, but don't announce it */ /* make a copy, but don't announce it */
original = RegionFactory::create (original, false); original = RegionFactory::create (original, false);
/* the pure copy constructor resets position() to zero, /* the pure copy constructor resets position() to zero, so fix that up. */
so fix that up.
*/
original->set_position (pos); original->set_position (pos);
} }
@ -3284,7 +3261,7 @@ Playlist::uncombine (boost::shared_ptr<Region> target)
switch (original->coverage (adjusted_start, adjusted_end)) { switch (original->coverage (adjusted_start, adjusted_end)) {
case Evoral::OverlapNone: case Evoral::OverlapNone:
/* original region does not cover any part /* original region does not cover any part
of the current state of the compound region * of the current state of the compound region
*/ */
continue; continue;
@ -3297,15 +3274,11 @@ Playlist::uncombine (boost::shared_ptr<Region> target)
break; break;
case Evoral::OverlapExternal: case Evoral::OverlapExternal:
/* overlap fully covers original, so leave it /* overlap fully covers original, so leave it as is */
as is
*/
break; break;
case Evoral::OverlapEnd: case Evoral::OverlapEnd:
/* overlap starts within but covers end, /* overlap starts within but covers end, so trim the front of the region */
so trim the front of the region
*/
original->trim_front (adjusted_start); original->trim_front (adjusted_start);
modified_region = true; modified_region = true;
break; break;
@ -3320,8 +3293,7 @@ Playlist::uncombine (boost::shared_ptr<Region> target)
} }
if (move_offset) { 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); original->set_position (original->position() + move_offset);
modified_region = true; modified_region = true;
} }
@ -3451,7 +3423,7 @@ void
Playlist::coalesce_and_check_crossfades (list<Evoral::Range<samplepos_t> > ranges) Playlist::coalesce_and_check_crossfades (list<Evoral::Range<samplepos_t> > ranges)
{ {
/* XXX: it's a shame that this coalesce algorithm also exists in /* XXX: it's a shame that this coalesce algorithm also exists in
TimeSelection::consolidate(). * TimeSelection::consolidate().
*/ */
/* XXX: xfade: this is implemented in Evoral::RangeList */ /* XXX: xfade: this is implemented in Evoral::RangeList */