small changes to export code to hopefully fix some bugs with range export(s)

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3441 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-06-03 12:22:21 +00:00
parent 66016dfef7
commit a29b3b862a
6 changed files with 51 additions and 31 deletions

View file

@ -600,8 +600,9 @@ class Session : public PBD::StatefulDestructible
SlaveSource post_export_slave;
nframes_t post_export_position;
int start_audio_export (ARDOUR::AudioExportSpecification&);
int stop_audio_export (ARDOUR::AudioExportSpecification&);
int pre_export ();
int start_audio_export (ARDOUR::AudioExportSpecification&);
int stop_audio_export (ARDOUR::AudioExportSpecification&);
void finalize_audio_export ();
static sigc::signal<void, std::string, std::string> Exported;
@ -1068,7 +1069,7 @@ class Session : public PBD::StatefulDestructible
void set_slave_source (SlaveSource);
bool _exporting;
int prepare_to_export (ARDOUR::AudioExportSpecification&);
int prepare_to_export (ARDOUR::AudioExportSpecification&);
void prepare_diskstreams ();
void commit_diskstreams (nframes_t, bool& session_requires_butler);

View file

@ -253,6 +253,12 @@ AudioExportSpecification::prepare (nframes_t blocksize, nframes_t frate)
output_data = (void*) malloc (sample_bytes * out_samples_max);
}
pos = start_frame;
end_frame = end_frame;
total_frames = end_frame - start_frame;
running = true;
do_freewheel = false; /* force a call to ::prepare_to_export() before proceeding to normal operation */
return 0;
}
@ -435,12 +441,6 @@ Session::start_audio_export (AudioExportSpecification& spec)
return -1;
}
spec.pos = spec.start_frame;
spec.end_frame = spec.end_frame;
spec.total_frames = spec.end_frame - spec.start_frame;
spec.running = true;
spec.do_freewheel = false; /* force a call to ::prepare_to_export() before proceeding to normal operation */
spec.freewheel_connection = _engine.Freewheel.connect (sigc::bind (mem_fun (*this, &Session::process_export), &spec));
return _engine.freewheel (true);
@ -454,16 +454,14 @@ Session::stop_audio_export (AudioExportSpecification& spec)
spec.freewheel_connection.disconnect ();
spec.clear (); /* resets running/stop etc */
Exported( spec.path, name() );
Exported (spec.path, name());
return 0;
}
int
Session::prepare_to_export (AudioExportSpecification& spec)
int
Session::pre_export ()
{
int ret = -1;
wait_till_butler_finished ();
/* take everyone out of awrite to avoid disasters */
@ -476,6 +474,27 @@ Session::prepare_to_export (AudioExportSpecification& spec)
}
}
/* make sure we are actually rolling */
if (get_record_enabled()) {
disable_record (false);
}
/* no slaving */
post_export_slave = Config->get_slave_source ();
post_export_position = _transport_frame;
Config->set_slave_source (None);
return 0;
}
int
Session::prepare_to_export (AudioExportSpecification& spec)
{
int ret = -1;
/* get everyone to the right position */
{
@ -491,22 +510,19 @@ Session::prepare_to_export (AudioExportSpecification& spec)
}
}
/* make sure we are actually rolling */
if (get_record_enabled()) {
disable_record (false);
}
/* we just did the core part of a locate() call above, but
for the sake of any GUI, put the _transport_frame in
the right place too.
*/
_transport_frame = spec.start_frame;
_exporting = true;
/* no slaving */
post_export_slave = Config->get_slave_source ();
post_export_position = _transport_frame;
Config->set_slave_source (None);
/* get transport ready */
/* get transport ready. note how this is calling butler functions
from a non-butler thread. we waited for the butler to stop
what it was doing earlier in Session::pre_export() and nothing
since then has re-awakened it.
*/
set_transport_speed (1.0, false);
butler_transport_work ();

View file

@ -140,6 +140,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL_PATH = @PERL_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@