summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/rc_configuration_vars.h1
-rw-r--r--libs/ardour/ardour/types.h7
-rw-r--r--libs/ardour/enums.cc20
-rw-r--r--libs/ardour/playlist.cc22
4 files changed, 46 insertions, 4 deletions
diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h
index 832cb8e958..52c3309b65 100644
--- a/libs/ardour/ardour/rc_configuration_vars.h
+++ b/libs/ardour/ardour/rc_configuration_vars.h
@@ -90,6 +90,7 @@ CONFIG_VARIABLE (bool, use_osc, "use-osc", false)
/* editing related */
+CONFIG_VARIABLE (LayerModel, layer_model, "layer-model", Manual)
CONFIG_VARIABLE (bool, automation_follows_regions, "automation-follows-regions", true)
CONFIG_VARIABLE (bool, region_boundaries_from_selected_tracks, "region-boundaries-from-selected-tracks", true)
CONFIG_VARIABLE (bool, region_boundaries_from_onscreen_tracks, "region-boundaries-from-onscreen_tracks", true)
diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h
index a43eb0125d..b1b4388a74 100644
--- a/libs/ardour/ardour/types.h
+++ b/libs/ardour/ardour/types.h
@@ -441,6 +441,11 @@ namespace ARDOUR {
MixerOrdered
};
+ enum LayerModel {
+ LaterHigher,
+ Manual
+ };
+
enum ListenPosition {
AfterFaderListen,
PreFaderListen
@@ -633,6 +638,7 @@ std::istream& operator>>(std::istream& o, ARDOUR::PFLPosition& sf);
std::istream& operator>>(std::istream& o, ARDOUR::AFLPosition& sf);
std::istream& operator>>(std::istream& o, ARDOUR::RemoteModel& sf);
std::istream& operator>>(std::istream& o, ARDOUR::ListenPosition& sf);
+std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf);
std::istream& operator>>(std::istream& o, ARDOUR::InsertMergePolicy& sf);
std::istream& operator>>(std::istream& o, ARDOUR::SyncSource& sf);
std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
@@ -652,6 +658,7 @@ std::ostream& operator<<(std::ostream& o, const ARDOUR::PFLPosition& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::AFLPosition& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::RemoteModel& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::ListenPosition& sf);
+std::ostream& operator<<(std::ostream& o, const ARDOUR::LayerModel& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::InsertMergePolicy& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::SyncSource& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleBehaviour& sf);
diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc
index b5a7447ab8..a1cf8d090c 100644
--- a/libs/ardour/enums.cc
+++ b/libs/ardour/enums.cc
@@ -74,6 +74,7 @@ setup_enum_writer ()
AFLPosition _AFLPosition;
RemoteModel _RemoteModel;
DenormalModel _DenormalModel;
+ LayerModel _LayerModel;
InsertMergePolicy _InsertMergePolicy;
ListenPosition _ListenPosition;
SampleFormat _SampleFormat;
@@ -298,7 +299,11 @@ setup_enum_writer ()
*/
enum_writer.add_to_hack_table ("EditorOrdered", "MixerOrdered");
- REGISTER_ENUM (InsertMergeReject);
+ REGISTER_ENUM (LaterHigher);
+ REGISTER_ENUM (Manual);
+ REGISTER (_LayerModel);
+
+ REGISTER_ENUM (InsertMergeReject);
REGISTER_ENUM (InsertMergeRelax);
REGISTER_ENUM (InsertMergeReplace);
REGISTER_ENUM (InsertMergeTruncateExisting);
@@ -805,6 +810,19 @@ std::ostream& operator<<(std::ostream& o, const ListenPosition& var)
std::string s = enum_2_string (var);
return o << s;
}
+std::istream& operator>>(std::istream& o, LayerModel& var)
+{
+ std::string s;
+ o >> s;
+ var = (LayerModel) string_2_enum (s, var);
+ return o;
+}
+
+std::ostream& operator<<(std::ostream& o, const LayerModel& var)
+{
+ std::string s = enum_2_string (var);
+ return o << s;
+}
std::istream& operator>>(std::istream& o, InsertMergePolicy& var)
{
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index d121ee04ff..20a2ef0197 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -2333,7 +2333,10 @@ struct RelayerSort {
void
Playlist::set_layer (boost::shared_ptr<Region> region, double new_layer)
{
- /* Remove the layer we are setting from our region list, and sort it */
+ /* Remove the layer we are setting from our region list, and sort it
+ * using the layer indeces.
+ */
+
RegionList copy = regions.rlist();
copy.remove (region);
copy.sort (RelayerSort ());
@@ -2362,6 +2365,12 @@ Playlist::setup_layering_indices (RegionList const & regions)
}
}
+struct LaterHigherSort {
+ bool operator () (boost::shared_ptr<Region> a, boost::shared_ptr<Region> b) {
+ return a->position() < b->position();
+ }
+};
+
/** Take the layering indices of each of our regions, compute the layers
* that they should be on, and write the layers back to the regions.
*/
@@ -2396,9 +2405,16 @@ Playlist::relayer ()
vector<vector<RegionList> > layers;
layers.push_back (vector<RegionList> (divisions));
- /* Sort our regions into layering index order */
+ /* Sort our regions into layering index order (for manual layering) or position order (for later is higher)*/
RegionList copy = regions.rlist();
- copy.sort (RelayerSort ());
+ switch (Config->get_layer_model()) {
+ case LaterHigher:
+ copy.sort (LaterHigherSort ());
+ break;
+ case Manual:
+ copy.sort (RelayerSort ());
+ break;
+ }
DEBUG_TRACE (DEBUG::Layering, "relayer() using:\n");
for (RegionList::iterator i = copy.begin(); i != copy.end(); ++i) {