summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-11-14 15:01:53 +0000
committerCarl Hetherington <carl@carlh.net>2010-11-14 15:01:53 +0000
commita46af0460b0fdcc145c4dd282fa4fe071d4971fc (patch)
tree81a1a2f4c779958df0f19d976e6cfd003afea5eb /libs/ardour
parent7a25fa1beb76b7148d4f96de5629d8b639aac9e7 (diff)
Create a new layer if required on record to a track in stacked mode. Fixes #3391.
git-svn-id: svn://localhost/ardour2/branches/3.0@8026 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/audiosource.h4
-rw-r--r--libs/ardour/ardour/playlist.h2
-rw-r--r--libs/ardour/audio_diskstream.cc9
-rw-r--r--libs/ardour/audiosource.cc7
-rw-r--r--libs/ardour/playlist.cc24
5 files changed, 41 insertions, 5 deletions
diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h
index 36c79f6787..08c879d926 100644
--- a/libs/ardour/ardour/audiosource.h
+++ b/libs/ardour/ardour/audiosource.h
@@ -119,7 +119,7 @@ class AudioSource : virtual public Source,
int initialize_peakfile (bool newfile, std::string path);
int build_peaks_from_scratch ();
- int compute_and_write_peaks (Sample* buf, framepos_t first_frame, framecnt_t cnt,
+ int compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt,
bool force, bool intermediate_peaks_ready_signal);
void truncate_peakfile();
@@ -135,7 +135,7 @@ class AudioSource : virtual public Source,
framecnt_t npeaks, framepos_t start, framecnt_t cnt,
double samples_per_visual_peak, framecnt_t fpp) const;
- int compute_and_write_peaks (Sample* buf, framepos_t first_frame, framecnt_t cnt,
+ int compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt,
bool force, bool intermediate_peaks_ready_signal,
framecnt_t frames_per_peak);
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h
index 27acc674b6..352384b695 100644
--- a/libs/ardour/ardour/playlist.h
+++ b/libs/ardour/ardour/playlist.h
@@ -216,6 +216,8 @@ public:
return boost::shared_ptr<Crossfade> ();
}
+ framepos_t find_next_top_layer_position (framepos_t) const;
+
protected:
friend class Session;
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc
index 00d89f8271..c6caf4ddc5 100644
--- a/libs/ardour/audio_diskstream.cc
+++ b/libs/ardour/audio_diskstream.cc
@@ -1504,6 +1504,15 @@ AudioDiskstream::transport_stopped_wallclock (struct tm& when, time_t twhen, boo
}
i_am_the_modifier++;
+
+ if (_playlist->explicit_relayering()) {
+ /* We are in `explicit relayering' mode, so we must specify which layer this new region
+ should end up on. Put it at the top.
+ */
+ region->set_layer (_playlist->top_layer() + 1);
+ region->set_pending_explicit_relayer (true);
+ }
+
_playlist->add_region (region, (*ci)->start, 1, non_layered());
i_am_the_modifier--;
diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc
index 360e4cd48a..c61fb72ae2 100644
--- a/libs/ardour/audiosource.cc
+++ b/libs/ardour/audiosource.cc
@@ -648,7 +648,7 @@ AudioSource::build_peaks_from_scratch ()
goto out;
}
- framepos_t current_frame = 0;
+ framecnt_t current_frame = 0;
framecnt_t cnt = _length;
_peaks_built = false;
@@ -722,15 +722,16 @@ AudioSource::done_with_peakfile_writes (bool done)
_peakfile_descriptor = 0;
}
+/** @param first_frame Offset from the source start of the first frame to process */
int
-AudioSource::compute_and_write_peaks (Sample* buf, framepos_t first_frame, framecnt_t cnt,
+AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt,
bool force, bool intermediate_peaks_ready)
{
return compute_and_write_peaks (buf, first_frame, cnt, force, intermediate_peaks_ready, _FPP);
}
int
-AudioSource::compute_and_write_peaks (Sample* buf, framepos_t first_frame, framecnt_t cnt,
+AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt,
bool force, bool intermediate_peaks_ready, framecnt_t fpp)
{
Sample* buf2 = 0;
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index e462bceb10..971ed8b2e8 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -2981,3 +2981,27 @@ Playlist::remove_region_by_source (boost::shared_ptr<Source> s)
i = j;
}
}
+
+/** Look from a session frame time and find the start time of the next region
+ * which is on the top layer of this playlist.
+ * @param t Time to look from.
+ * @return Position of next top-layered region, or max_framepos if there isn't one.
+ */
+framepos_t
+Playlist::find_next_top_layer_position (framepos_t t) const
+{
+ RegionLock rlock (const_cast<Playlist *> (this));
+
+ layer_t const top = top_layer ();
+
+ RegionList copy = regions.rlist ();
+ copy.sort (RegionSortByPosition ());
+
+ for (RegionList::const_iterator i = copy.begin(); i != copy.end(); ++i) {
+ if ((*i)->position() >= t && (*i)->layer() == top) {
+ return (*i)->position();
+ }
+ }
+
+ return max_framepos;
+}