bounce to target number of channels

This commit is contained in:
Robin Gareus 2014-05-25 18:10:01 +02:00
parent 5b2da3caf7
commit ad9c074828
3 changed files with 34 additions and 1 deletions

View File

@ -476,6 +476,7 @@ class LIBARDOUR_API Route : public SessionObject, public Automatable, public Rou
bool for_export);
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;
boost::shared_ptr<IO> _input;
boost::shared_ptr<IO> _output;

View File

@ -564,7 +564,7 @@ Route::bounce_process (BufferSet& buffers, framepos_t start, framecnt_t nframes,
(*i)->run (buffers, start, start+nframes, nframes, true);
}
//buffers.set_count ((*i)->output_streams());
buffers.set_count ((*i)->output_streams());
if ((*i) == endpoint) {
break;
@ -598,6 +598,31 @@ Route::bounce_get_latency (boost::shared_ptr<Processor> endpoint, bool include_e
return latency;
}
ChanCount
Route::bounce_get_output_streams (ChanCount &cc, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export) const
{
if (!endpoint && !include_endpoint) {
return cc;
}
for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) {
if (!include_endpoint && (*i) == endpoint) {
break;
}
if (!for_export && (*i)->does_routing()) {
break;
}
if (!(*i)->does_routing() && !boost::dynamic_pointer_cast<PeakMeter>(*i)) {
cc = (*i)->output_streams();
}
if ((*i) == endpoint) {
break;
}
}
return cc;
}
ChanCount
Route::n_process_buffers ()
{

View File

@ -4148,6 +4148,13 @@ 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);
if (diskstream_channels.n_audio() < 1) {
error << _("Cannot write a range with no audio.") << endmsg;
return result;
}
const framecnt_t chunk_size = (256 * 1024)/4;
// block all process callback handling