summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-02-29 13:50:56 +0100
committerRobin Gareus <robin@gareus.org>2016-02-29 13:50:56 +0100
commit33545e552be1a92fc1f8a13bc9eb06da700110aa (patch)
treeade0a3acf77a8964bf7551f588920f440fa02641
parent56c32a1e77822a9cd1bf4c858004d95b60ce4488 (diff)
pre-process (silence) before export to flush reverb tails etc.
-rw-r--r--libs/ardour/ardour/session.h2
-rw-r--r--libs/ardour/session.cc2
-rw-r--r--libs/ardour/session_export.cc28
3 files changed, 24 insertions, 8 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index d25f856b1f..0651eb69bf 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -1195,8 +1195,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
framepos_t post_export_position;
bool _exporting;
- bool _export_started;
bool _export_rolling;
+ framepos_t _export_preroll;
boost::shared_ptr<ExportHandler> export_handler;
boost::shared_ptr<ExportStatus> export_status;
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index d0fe74db21..bc17e4eb7f 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -204,8 +204,8 @@ Session::Session (AudioEngine &eng,
, post_export_sync (false)
, post_export_position (0)
, _exporting (false)
- , _export_started (false)
, _export_rolling (false)
+ , _export_preroll (0)
, _pre_export_mmc_enabled (false)
, _name (snapshot_name)
, _is_new (true)
diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc
index 8908716965..6b54db3826 100644
--- a/libs/ardour/session_export.cc
+++ b/libs/ardour/session_export.cc
@@ -73,12 +73,16 @@ Session::pre_export ()
}
}
- /* make sure we are actually rolling */
+ /* prepare transport */
+
+ realtime_stop (true, true);
if (get_record_enabled()) {
disable_record (false);
}
+ unset_play_loop ();
+
/* no slaving */
post_export_sync = config.get_external_sync ();
@@ -105,7 +109,8 @@ Session::start_audio_export (framepos_t position)
if (!_exporting) {
pre_export ();
}
- _export_started = false;
+
+ _export_preroll = 10.0 * nominal_frame_rate (); // TODO make configurable
/* We're about to call Track::seek, so the butler must have finished everything
up otherwise it could be doing do_refill in its thread while we are doing
@@ -190,8 +195,19 @@ Session::process_export (pframes_t nframes)
int
Session::process_export_fw (pframes_t nframes)
{
- if (!_export_started) {
- _export_started = true;
+ if (_export_preroll > 0) {
+
+ _engine.main_thread()->get_buffers ();
+ fail_roll (nframes);
+ _engine.main_thread()->drop_buffers ();
+
+ _export_preroll -= std::min ((framepos_t)nframes, _export_preroll);
+
+ if (_export_preroll > 0) {
+ // clear out buffers (reverb tails etc).
+ return 0;
+ }
+
set_transport_speed (1.0, 0, false);
butler_transport_work ();
g_atomic_int_set (&_butler->should_do_transport_work, 0);
@@ -199,9 +215,9 @@ Session::process_export_fw (pframes_t nframes)
return 0;
}
- _engine.main_thread()->get_buffers ();
+ _engine.main_thread()->get_buffers ();
process_export (nframes);
- _engine.main_thread()->drop_buffers ();
+ _engine.main_thread()->drop_buffers ();
return 0;
}