summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-01-17 09:13:44 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2014-01-17 09:13:44 -0500
commitc0e6f8e4c324c3f44613949b59acd9e864ab263d (patch)
tree00bd7f9c979bb2a971b4f55ae4113c7442645eda /libs
parent2e27e21d3a09889311e18a8efe11abcaa6d9c8b3 (diff)
parent0479405e2f0cd44b75ba789cd620cb43bb9f9ffb (diff)
Merge branch 'master' into cairocanvas
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/auditioner.h10
-rw-r--r--libs/ardour/auditioner.cc43
-rw-r--r--libs/ardour/butler.cc8
3 files changed, 57 insertions, 4 deletions
diff --git a/libs/ardour/ardour/auditioner.h b/libs/ardour/ardour/auditioner.h
index 030bb162dd..26e395f93e 100644
--- a/libs/ardour/ardour/auditioner.h
+++ b/libs/ardour/ardour/auditioner.h
@@ -44,6 +44,9 @@ class LIBARDOUR_API Auditioner : public AudioTrack
void audition_region (boost::shared_ptr<Region>);
+ void seek_to_frame (frameoffset_t pos) { if (_seek_frame < 0 && !_seeking) { _seek_frame = pos; }}
+ void seek_to_percent (float const pos) { if (_seek_frame < 0 && !_seeking) { _seek_frame = floorf(length * pos / 100.0); }}
+
ARDOUR::AudioPlaylist& prepare_playlist ();
int play_audition (framecnt_t nframes);
@@ -59,12 +62,19 @@ class LIBARDOUR_API Auditioner : public AudioTrack
virtual ChanCount input_streams () const;
+ frameoffset_t seek_frame() const { return _seeking ? _seek_frame : -1;}
+ void seek_response(frameoffset_t pos) { _seek_complete = true; if (_seeking) { current_frame = pos; _seek_complete = true;} }
+ PBD::Signal2<void, ARDOUR::framecnt_t, ARDOUR::framecnt_t> AuditionProgress;
+
private:
boost::shared_ptr<AudioRegion> the_region;
framepos_t current_frame;
mutable gint _auditioning;
Glib::Threads::Mutex lock;
framecnt_t length;
+ frameoffset_t _seek_frame;
+ bool _seeking;
+ bool _seek_complete;
bool via_monitor;
void drop_ports ();
diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc
index 73670798d8..75a40f142d 100644
--- a/libs/ardour/auditioner.cc
+++ b/libs/ardour/auditioner.cc
@@ -44,6 +44,9 @@ Auditioner::Auditioner (Session& s)
, current_frame (0)
, _auditioning (0)
, length (0)
+ , _seek_frame (-1)
+ , _seeking (false)
+ , _seek_complete (false)
, via_monitor (false)
{
}
@@ -203,6 +206,8 @@ Auditioner::audition_region (boost::shared_ptr<Region> region)
_main_outs->reset_panner();
+ _seek_frame = -1;
+ _seeking = false;
length = the_region->length();
int dir;
@@ -232,14 +237,44 @@ Auditioner::play_audition (framecnt_t nframes)
return 0;
}
- this_nframes = min (nframes, length - current_frame);
+#if 0 // TODO
+ if (_seeking && _seek_complete) {
+ // set FADE-IN
+ } else if (_seek_frame >= 0 && _seek_frame < length && !_seeking) {
+ // set FADE-OUT -- use/override amp? || use region-gain ?
+ }
+#endif
+
+ if (_seeking && _seek_complete) {
+ _seek_complete = false;
+ _seeking = false;
+ _seek_frame = -1;
+ }
+
+ if(!_seeking) {
+ /* process audio */
+ this_nframes = min (nframes, length - current_frame);
+
+ if ((ret = roll (this_nframes, current_frame, current_frame + nframes, false, need_butler)) != 0) {
+ silence (nframes);
+ return ret;
+ }
- if ((ret = roll (this_nframes, current_frame, current_frame + nframes, false, need_butler)) != 0) {
+ current_frame += this_nframes;
+
+ } else {
silence (nframes);
- return ret;
}
- current_frame += this_nframes;
+ if (_seek_frame >= 0 && _seek_frame < length && !_seeking) {
+ _seek_complete = false;
+ _seeking = true;
+ need_butler = true;
+ }
+
+ if (!_seeking) {
+ AuditionProgress(current_frame, length); /* emit */
+ }
if (current_frame >= length) {
_session.cancel_audition ();
diff --git a/libs/ardour/butler.cc b/libs/ardour/butler.cc
index 1fe1524618..c9eb55a472 100644
--- a/libs/ardour/butler.cc
+++ b/libs/ardour/butler.cc
@@ -257,6 +257,14 @@ restart:
_session.butler_transport_work ();
}
+ frameoffset_t audition_seek;
+ if (should_run && _session.is_auditioning()
+ && (audition_seek = _session.the_auditioner()->seek_frame()) >= 0) {
+ boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (_session.the_auditioner());
+ tr->seek(audition_seek);
+ _session.the_auditioner()->seek_response(audition_seek);
+ }
+
boost::shared_ptr<RouteList> rl = _session.get_routes();
RouteList rl_with_auditioner = *rl;