PBD::Signal0<void> Session::SuccessfulGraphSort;
PBD::Signal2<void,std::string,std::string> Session::VersionMismatch;
+const framecnt_t Session::bounce_chunk_size = 65536;
static void clean_up_session_event (SessionEvent* ev) { delete ev; }
const SessionEvent::RTeventCallback Session::rt_cleanup (clean_up_session_event);
: playlists (new SessionPlaylists)
, _engine (eng)
, process_function (&Session::process_with_events)
+ , _bounce_processing_active (false)
, waiting_for_sync_offset (false)
, _base_frame_rate (0)
, _current_frame_rate (0)
}
boost::shared_ptr<AudioFileSource>
-Session::source_by_path_and_channel (const string& path, uint16_t chn) const
+Session::audio_source_by_path_and_channel (const string& path, uint16_t chn) const
{
/* Restricted to audio files because only audio sources have channel
as a property.
}
boost::shared_ptr<MidiSource>
-Session::source_by_path (const std::string& path) const
+Session::midi_source_by_path (const std::string& path) const
{
/* Restricted to MIDI files because audio sources require a channel
for unique identification, in addition to a path.
string possible_path = Glib::build_filename (spath, buf);
- if (source_by_path (possible_path)) {
+ if (audio_source_by_path_and_channel (possible_path, chan)) {
existing++;
break;
}
existing++;
}
- if (source_by_path (possible_path)) {
+ if (midi_source_by_path (possible_path)) {
existing++;
}
}
void
Session::ensure_buffers (ChanCount howmany)
{
- BufferManager::ensure_buffers (howmany);
+ BufferManager::ensure_buffers (howmany, bounce_processing() ? bounce_chunk_size : 0);
}
void
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;
return result;
}
- const framecnt_t chunk_size = (256 * 1024)/4;
+ 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;
+ return result;
+ }
// block all process callback handling
Glib::Threads::Mutex::Lock lm (_engine.process_lock());
}
- _engine.main_thread()->get_buffers ();
+ _bounce_processing_active = true;
/* call tree *MUST* hold route_lock */
*/
need_block_size_reset = true;
- track.set_block_size (chunk_size);
+ track.set_block_size (bounce_chunk_size);
+ _engine.main_thread()->get_buffers ();
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) {
- buffers.ensure_buffers(*t, max_proc.get(*t), chunk_size);
+ buffers.ensure_buffers(*t, max_proc.get(*t), bounce_chunk_size);
}
buffers.set_count (max_proc);
while (to_do && !itt.cancel) {
- this_chunk = min (to_do, chunk_size);
+ 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;
}
to_do -= this_chunk;
itt.progress = (float) (1.0 - ((double) to_do / len));
- if (latency_skip >= chunk_size) {
- latency_skip -= chunk_size;
+ if (latency_skip >= bounce_chunk_size) {
+ latency_skip -= bounce_chunk_size;
continue;
}
}
/* 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, chunk_size);
+ 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) {
}
out:
- _engine.main_thread()->drop_buffers ();
if (!result) {
for (vector<boost::shared_ptr<Source> >::iterator src = srcs.begin(); src != srcs.end(); ++src) {
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource>(*src);
}
}
+ _bounce_processing_active = false;
if (need_block_size_reset) {
+ _engine.main_thread()->drop_buffers ();
track.set_block_size (get_block_size());
}