X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsession_export.cc;h=82869343581ab80424fb3306e925925bd5e55b28;hb=90263f9a6dcec5de1bf6cd305d194118333a81ef;hp=a17dde6979d658e952de0fa0f48b46e1a8bdc716;hpb=8af0757b61990767f2a85e68f535a5af9976fd79;p=ardour.git diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc index a17dde6979..8286934358 100644 --- a/libs/ardour/session_export.cc +++ b/libs/ardour/session_export.cc @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include @@ -47,14 +47,14 @@ #include #include #include -#include +#include #include #include "i18n.h" using namespace std; using namespace ARDOUR; -//using namespace sigc; +using namespace PBD; static int convert_spec_to_info (AudioExportSpecification& spec, SF_INFO& sfinfo) @@ -153,7 +153,7 @@ AudioExportSpecification::clear () } int -AudioExportSpecification::prepare (jack_nframes_t blocksize, jack_nframes_t frate) +AudioExportSpecification::prepare (nframes_t blocksize, nframes_t frate) { char errbuf[256]; GDitherSize dither_size; @@ -201,7 +201,7 @@ AudioExportSpecification::prepare (jack_nframes_t blocksize, jack_nframes_t frat if ((out = sf_open (path.c_str(), SFM_WRITE, &sfinfo)) == 0) { sf_error_str (0, errbuf, sizeof (errbuf) - 1); - error << compose(_("Export: cannot open output file \"%1\" (%2)"), path, errbuf) << endmsg; + error << string_compose(_("Export: cannot open output file \"%1\" (%2)"), path, errbuf) << endmsg; return -1; } @@ -211,12 +211,12 @@ AudioExportSpecification::prepare (jack_nframes_t blocksize, jack_nframes_t frat int err; if ((src_state = src_new (src_quality, channels, &err)) == 0) { - error << compose (_("cannot initialize sample rate conversion: %1"), src_strerror (err)) << endmsg; + error << string_compose (_("cannot initialize sample rate conversion: %1"), src_strerror (err)) << endmsg; return -1; } src_data.src_ratio = sample_rate / (double) frame_rate; - out_samples_max = (jack_nframes_t) ceil (blocksize * src_data.src_ratio * channels); + out_samples_max = (nframes_t) ceil (blocksize * src_data.src_ratio * channels); dataF2 = new float[out_samples_max]; max_leftover_frames = 4 * blocksize; @@ -258,7 +258,7 @@ AudioExportSpecification::prepare (jack_nframes_t blocksize, jack_nframes_t frat } int -AudioExportSpecification::process (jack_nframes_t nframes) +AudioExportSpecification::process (nframes_t nframes) { float* float_buffer = 0; uint32_t chn; @@ -266,7 +266,7 @@ AudioExportSpecification::process (jack_nframes_t nframes) uint32_t i; sf_count_t written; char errbuf[256]; - jack_nframes_t to_write = 0; + nframes_t to_write = 0; int cnt = 0; do { @@ -313,7 +313,7 @@ AudioExportSpecification::process (jack_nframes_t nframes) ++cnt; if ((err = src_process (src_state, &src_data)) != 0) { - error << compose (_("an error occured during sample rate conversion: %1"), + error << string_compose (_("an error occured during sample rate conversion: %1"), src_strerror (err)) << endmsg; return -1; @@ -413,9 +413,9 @@ AudioExportSpecification::process (jack_nframes_t nframes) break; } - if ((jack_nframes_t) written != to_write) { + if ((nframes_t) written != to_write) { sf_error_str (out, errbuf, sizeof (errbuf) - 1); - error << compose(_("Export: could not write data to output file (%1)"), errbuf) << endmsg; + error << string_compose(_("Export: could not write data to output file (%1)"), errbuf) << endmsg; return -1; } @@ -462,7 +462,7 @@ Session::stop_audio_export (AudioExportSpecification& spec) /* restart slaving */ if (post_export_slave != None) { - set_slave_source (post_export_slave, post_export_position); + Config->set_slave_source (post_export_slave); } else { locate (post_export_position, false, false, false); } @@ -485,8 +485,9 @@ Session::prepare_to_export (AudioExportSpecification& spec) /* take everyone out of awrite to avoid disasters */ { - LockMonitor lm (route_lock, __LINE__, __FILE__); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + boost::shared_ptr r = routes.reader (); + + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { (*i)->protect_automation (); } } @@ -494,10 +495,11 @@ Session::prepare_to_export (AudioExportSpecification& spec) /* get everyone to the right position */ { - LockMonitor lm (diskstream_lock, __LINE__, __FILE__); - for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) { + boost::shared_ptr dsl = diskstreams.reader(); + + for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { if ((*i)-> seek (spec.start_frame, true)) { - error << compose (_("%1: cannot seek to %2 for export"), + error << string_compose (_("%1: cannot seek to %2 for export"), (*i)->name(), spec.start_frame) << endmsg; goto out; @@ -508,23 +510,23 @@ Session::prepare_to_export (AudioExportSpecification& spec) /* make sure we are actually rolling */ if (get_record_enabled()) { - disable_record (); + disable_record (false); } _exporting = true; /* no slaving */ - post_export_slave = _slave_type; + post_export_slave = Config->get_slave_source (); post_export_position = _transport_frame; - set_slave_source (None, 0); + Config->set_slave_source (None); /* get transport ready */ set_transport_speed (1.0, false); butler_transport_work (); - atomic_set (&butler_should_do_transport_work, 0); + g_atomic_int_set (&butler_should_do_transport_work, 0); post_transport (); /* we are ready to go ... */ @@ -536,12 +538,12 @@ Session::prepare_to_export (AudioExportSpecification& spec) } int -Session::process_export (jack_nframes_t nframes, AudioExportSpecification* spec) +Session::process_export (nframes_t nframes, AudioExportSpecification* spec) { uint32_t chn; uint32_t x; int ret = -1; - jack_nframes_t this_nframes; + nframes_t this_nframes; /* This is not required to be RT-safe because we are running while freewheeling */