22 #include <glibmm/threads.h>
24 #include <midi++/mmc.h>
41 Session::get_export_handler ()
43 if (!export_handler) {
47 return export_handler;
51 Session::get_export_status ()
62 Session::pre_export ()
71 for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
72 (*i)->protect_automation ();
78 if (get_record_enabled()) {
79 disable_record (
false);
84 post_export_sync = config.get_external_sync ();
85 post_export_position = _transport_frame;
87 config.set_external_sync (
false);
90 export_status->running =
true;
91 export_status->Finished.connect_same_thread (*
this, boost::bind (&Session::finalize_audio_export,
this));
95 _pre_export_mmc_enabled = _mmc->send_enabled ();
96 _mmc->enable_send (
false);
108 _export_started =
false;
115 _butler->wait_until_finished ();
122 for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
124 if (tr && tr->
seek (position,
true)) {
139 export_status->stop =
false;
149 if (!_engine.connected()) {
153 _engine.Freewheel.connect_same_thread (export_freewheel_connection, boost::bind (&Session::process_export_fw,
this, _1));
154 _export_rolling =
true;
155 return _engine.freewheel (
true);
161 if (_export_rolling && export_status->stop) {
162 stop_audio_export ();
165 if (_export_rolling) {
169 _butler->wait_until_finished ();
173 process_without_events (nframes);
179 ProcessExport (nframes);
181 }
catch (std::exception & e) {
183 export_status->abort (
true);
193 if (!_export_started) {
194 _export_started =
true;
195 set_transport_speed (1.0, 0,
false);
196 butler_transport_work ();
197 g_atomic_int_set (&_butler->should_do_transport_work, 0);
202 _engine.main_thread()->get_buffers ();
203 process_export (nframes);
204 _engine.main_thread()->drop_buffers ();
210 Session::stop_audio_export ()
217 realtime_stop (
true,
true);
218 _export_rolling =
false;
219 _butler->schedule_transport_work ();
225 Session::finalize_audio_export ()
229 if (_export_rolling) {
230 stop_audio_export ();
235 _engine.freewheel (
false);
237 export_freewheel_connection.disconnect();
239 _mmc->enable_send (_pre_export_mmc_enabled);
243 export_handler.reset();
244 export_status.reset();
248 if (post_export_sync) {
249 config.set_external_sync (
true);
251 locate (post_export_position,
false,
false,
false,
false,
false);
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r)
LIBPBD_API Transmitter error
std::ostream & endmsg(std::ostream &ostr)
int seek(framepos_t, bool complete_refill=false)
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > position
std::string string_compose(const std::string &fmt, const T1 &o1)