13
0

re-work bounce/freeze. Freezer stops at first active delivery.

amend to 8f52bf7d9f
This commit is contained in:
Robin Gareus 2014-06-03 21:08:45 +02:00
parent 03cb44f814
commit 06b4cf92db
11 changed files with 47 additions and 28 deletions

View File

@ -58,7 +58,7 @@ class LIBARDOUR_API AudioTrack : public Track
boost::shared_ptr<Region> bounce_range (framepos_t start, framepos_t end, InterThreadInfo&,
boost::shared_ptr<Processor> endpoint, bool include_endpoint);
int export_stuff (BufferSet& bufs, framepos_t start_frame, framecnt_t nframes,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export);
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze);
int set_state (const XMLNode&, int version);

View File

@ -97,7 +97,7 @@ class LIBARDOUR_API Auditioner : public Track
boost::shared_ptr<Region> bounce_range (framepos_t, framepos_t, InterThreadInfo&, boost::shared_ptr<Processor>, bool)
{ return boost::shared_ptr<Region> (); }
int export_stuff (BufferSet&, framepos_t, framecnt_t, boost::shared_ptr<Processor>, bool, bool)
int export_stuff (BufferSet&, framepos_t, framecnt_t, boost::shared_ptr<Processor>, bool, bool, bool)
{ return -1; }
boost::shared_ptr<Diskstream> diskstream_factory (XMLNode const &)

View File

@ -72,7 +72,8 @@ public:
framecnt_t end_frame,
boost::shared_ptr<Processor> endpoint,
bool include_endpoint,
bool for_export);
bool for_export,
bool for_freeze);
int set_state (const XMLNode&, int version);

View File

@ -473,10 +473,10 @@ class LIBARDOUR_API Route : public SessionObject, public Automatable, public Rou
virtual void bounce_process (BufferSet& bufs,
framepos_t start_frame, framecnt_t nframes,
boost::shared_ptr<Processor> endpoint, bool include_endpoint,
bool for_export);
bool for_export, bool for_freeze);
framecnt_t bounce_get_latency (boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export) const;
ChanCount bounce_get_output_streams (ChanCount &cc, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export) const;
framecnt_t bounce_get_latency (boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) const;
ChanCount bounce_get_output_streams (ChanCount &cc, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) const;
boost::shared_ptr<IO> _input;
boost::shared_ptr<IO> _output;

View File

@ -608,7 +608,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
boost::shared_ptr<Region> write_one_track (AudioTrack&, framepos_t start, framepos_t end,
bool overwrite, std::vector<boost::shared_ptr<Source> >&, InterThreadInfo& wot,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export);
boost::shared_ptr<Processor> endpoint,
bool include_endpoint, bool for_export, bool for_freeze);
int freeze_all (InterThreadInfo&);
/* session-wide solo/mute/rec-enable */

View File

@ -96,7 +96,7 @@ class LIBARDOUR_API Track : public Route, public PublicDiskstream
virtual boost::shared_ptr<Region> bounce_range (framepos_t start, framepos_t end, InterThreadInfo&,
boost::shared_ptr<Processor> endpoint, bool include_endpoint) = 0;
virtual int export_stuff (BufferSet& bufs, framepos_t start_frame, framecnt_t nframes,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export) = 0;
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) = 0;
XMLNode& get_state();
XMLNode& get_template();

View File

@ -383,7 +383,7 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
int
AudioTrack::export_stuff (BufferSet& buffers, framepos_t start, framecnt_t nframes,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export)
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze)
{
boost::scoped_array<gain_t> gain_buffer (new gain_t[nframes]);
boost::scoped_array<Sample> mix_buffer (new Sample[nframes]);
@ -417,7 +417,7 @@ AudioTrack::export_stuff (BufferSet& buffers, framepos_t start, framecnt_t nfram
}
}
bounce_process (buffers, start, nframes, endpoint, include_endpoint, for_export);
bounce_process (buffers, start, nframes, endpoint, include_endpoint, for_export, for_freeze);
return 0;
}
@ -490,7 +490,7 @@ AudioTrack::bounce_range (framepos_t start, framepos_t end, InterThreadInfo& itt
boost::shared_ptr<Processor> endpoint, bool include_endpoint)
{
vector<boost::shared_ptr<Source> > srcs;
return _session.write_one_track (*this, start, end, false, srcs, itt, endpoint, include_endpoint, false);
return _session.write_one_track (*this, start, end, false, srcs, itt, endpoint, include_endpoint, false, false);
}
void
@ -533,8 +533,8 @@ AudioTrack::freeze_me (InterThreadInfo& itt)
boost::shared_ptr<Region> res;
if ((res = _session.write_one_track (*this, _session.current_start_frame(), _session.current_end_frame(), true, srcs, itt,
main_outs(), false, false)) == 0) {
if ((res = _session.write_one_track (*this, _session.current_start_frame(), _session.current_end_frame(),
true, srcs, itt, main_outs(), false, false, true)) == 0) {
return;
}
@ -545,7 +545,10 @@ AudioTrack::freeze_me (InterThreadInfo& itt)
for (ProcessorList::iterator r = _processors.begin(); r != _processors.end(); ++r) {
if (!(*r)->does_routing() && !boost::dynamic_pointer_cast<PeakMeter>(*r)) {
if ((*r)->does_routing() && (*r)->active()) {
break;
}
if (!boost::dynamic_pointer_cast<PeakMeter>(*r)) {
FreezeRecordProcessorInfo* frii = new FreezeRecordProcessorInfo ((*r)->get_state(), (*r));
@ -553,9 +556,10 @@ AudioTrack::freeze_me (InterThreadInfo& itt)
_freeze_record.processor_info.push_back (frii);
/* now deactivate the processor */
(*r)->deactivate ();
/* now deactivate the processor, */
if (!boost::dynamic_pointer_cast<Amp>(*r)) {
(*r)->deactivate ();
}
}
_session.set_dirty ();

View File

@ -192,7 +192,7 @@ RegionExportChannelFactory::update_buffers (framecnt_t frames)
}
break;
case Processed:
track.export_stuff (buffers, position, frames, track.main_outs(), true, true);
track.export_stuff (buffers, position, frames, track.main_outs(), true, true, false);
break;
default:
throw ExportFailed ("Unhandled type in ExportChannelFactory::update_buffers");

View File

@ -547,7 +547,7 @@ MidiTrack::write_out_of_band_data (BufferSet& bufs, framepos_t /*start*/, framep
int
MidiTrack::export_stuff (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framecnt_t /*nframes*/,
boost::shared_ptr<Processor> /*endpoint*/, bool /*include_endpoint*/, bool /*forexport*/)
boost::shared_ptr<Processor> /*endpoint*/, bool /*include_endpoint*/, bool /*for_export*/, bool /*for_freeze*/)
{
return -1;
}

View File

@ -538,7 +538,8 @@ Route::process_output_buffers (BufferSet& bufs,
void
Route::bounce_process (BufferSet& buffers, framepos_t start, framecnt_t nframes,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export)
boost::shared_ptr<Processor> endpoint,
bool include_endpoint, bool for_export, bool for_freeze)
{
/* If no processing is required, there's no need to go any further. */
if (!endpoint && !include_endpoint) {
@ -558,6 +559,9 @@ Route::bounce_process (BufferSet& buffers, framepos_t start, framecnt_t nframes,
if (!for_export && boost::dynamic_pointer_cast<PortInsert>(*i)) {
break;
}
if (!for_export && for_freeze && (*i)->does_routing() && (*i)->active()) {
break;
}
/* don't run any processors that does routing.
* oh, and don't bother with the peak meter either.
@ -574,7 +578,8 @@ Route::bounce_process (BufferSet& buffers, framepos_t start, framecnt_t nframes,
}
framecnt_t
Route::bounce_get_latency (boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export) const
Route::bounce_get_latency (boost::shared_ptr<Processor> endpoint,
bool include_endpoint, bool for_export, bool for_freeze) const
{
framecnt_t latency = 0;
if (!endpoint && !include_endpoint) {
@ -588,6 +593,9 @@ Route::bounce_get_latency (boost::shared_ptr<Processor> endpoint, bool include_e
if (!for_export && boost::dynamic_pointer_cast<PortInsert>(*i)) {
break;
}
if (!for_export && for_freeze && (*i)->does_routing() && (*i)->active()) {
break;
}
if (!(*i)->does_routing() && !boost::dynamic_pointer_cast<PeakMeter>(*i)) {
latency += (*i)->signal_latency ();
}
@ -599,7 +607,8 @@ Route::bounce_get_latency (boost::shared_ptr<Processor> endpoint, bool include_e
}
ChanCount
Route::bounce_get_output_streams (ChanCount &cc, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export) const
Route::bounce_get_output_streams (ChanCount &cc, boost::shared_ptr<Processor> endpoint,
bool include_endpoint, bool for_export, bool for_freeze) const
{
if (!endpoint && !include_endpoint) {
return cc;
@ -612,6 +621,9 @@ Route::bounce_get_output_streams (ChanCount &cc, boost::shared_ptr<Processor> en
if (!for_export && boost::dynamic_pointer_cast<PortInsert>(*i)) {
break;
}
if (!for_export && for_freeze && (*i)->does_routing() && (*i)->active()) {
break;
}
if (!(*i)->does_routing() && !boost::dynamic_pointer_cast<PeakMeter>(*i)) {
cc = (*i)->output_streams();
}

View File

@ -4124,7 +4124,7 @@ Session::write_one_track (AudioTrack& track, framepos_t start, framepos_t end,
bool /*overwrite*/, vector<boost::shared_ptr<Source> >& srcs,
InterThreadInfo& itt,
boost::shared_ptr<Processor> endpoint, bool include_endpoint,
bool for_export)
bool for_export, bool for_freeze)
{
boost::shared_ptr<Region> result;
boost::shared_ptr<Playlist> playlist;
@ -4150,7 +4150,8 @@ Session::write_one_track (AudioTrack& track, framepos_t start, framepos_t end,
return result;
}
diskstream_channels = track.bounce_get_output_streams (diskstream_channels, endpoint, include_endpoint, for_export);
diskstream_channels = track.bounce_get_output_streams (diskstream_channels, endpoint,
include_endpoint, for_export, for_freeze);
if (diskstream_channels.n_audio() < 1) {
error << _("Cannot write a range with no audio.") << endmsg;
@ -4217,7 +4218,7 @@ Session::write_one_track (AudioTrack& track, framepos_t start, framepos_t end,
position = start;
to_do = len;
latency_skip = track.bounce_get_latency (endpoint, include_endpoint, for_export);
latency_skip = track.bounce_get_latency (endpoint, include_endpoint, for_export, for_freeze);
/* create a set of reasonably-sized buffers */
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
@ -4235,7 +4236,7 @@ Session::write_one_track (AudioTrack& track, framepos_t start, framepos_t end,
this_chunk = min (to_do, bounce_chunk_size);
if (track.export_stuff (buffers, start, this_chunk, endpoint, include_endpoint, for_export)) {
if (track.export_stuff (buffers, start, this_chunk, endpoint, include_endpoint, for_export, for_freeze)) {
goto out;
}
@ -4264,14 +4265,14 @@ Session::write_one_track (AudioTrack& track, framepos_t start, framepos_t end,
}
/* post-roll, pick up delayed processor output */
latency_skip = track.bounce_get_latency (endpoint, include_endpoint, for_export);
latency_skip = track.bounce_get_latency (endpoint, include_endpoint, for_export, for_freeze);
while (latency_skip && !itt.cancel) {
this_chunk = min (latency_skip, bounce_chunk_size);
latency_skip -= this_chunk;
buffers.silence (this_chunk, 0);
track.bounce_process (buffers, start, this_chunk, endpoint, include_endpoint, for_export);
track.bounce_process (buffers, start, this_chunk, endpoint, include_endpoint, for_export, for_freeze);
uint32_t n = 0;
for (vector<boost::shared_ptr<Source> >::iterator src=srcs.begin(); src != srcs.end(); ++src, ++n) {