#include <gtkmm/messagedialog.h>
+#include "gtkmm2ext/choice.h"
+
#include "export_dialog.h"
#include "editor.h"
#include "public_editor.h"
void
Editor::bounce_region_selection ()
{
+ for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
+
+ RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (&(*i)->get_time_axis_view());
+ boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track> (rtv->route());
+
+ if (!track->bounceable()) {
+ MessageDialog d (
+ _("One or more of the selected regions' tracks cannot be bounced because it has more outputs than inputs. "
+ "You can fix this by increasing the number of inputs on that track.")
+ );
+ d.set_title (_("Cannot bounce"));
+ d.run ();
+ return;
+ }
+ }
+
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
boost::shared_ptr<Region> region ((*i)->region());
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(&(*i)->get_time_axis_view());
- Track* track = dynamic_cast<Track*>(rtv->route().get());
+ boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track> (rtv->route());
InterThreadInfo itt;
return;
}
+ if (!clicked_routeview->track()->bounceable()) {
+ RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (clicked_routeview);
+ if (rtv && !rtv->track()->bounceable()) {
+ MessageDialog d (
+ _("This route cannot be frozen because it has more outputs than inputs. "
+ "You can fix this by increasing the number of inputs.")
+ );
+ d.set_title (_("Cannot freeze"));
+ d.run ();
+ return;
+ }
+ }
+
InterThreadInfo itt;
current_interthread_info = &itt;
TrackSelection views = selection->tracks;
+ for (TrackViewList::iterator i = views.begin(); i != views.end(); ++i) {
+ RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*i);
+ if (rtv && !rtv->track()->bounceable()) {
+ MessageDialog d (
+ _("One or more selected tracks cannot be bounced because it has more outputs than inputs. "
+ "You can fix this by increasing the number of inputs on that track.")
+ );
+ d.set_title (_("Cannot bounce"));
+ d.run ();
+ return;
+ }
+ }
+
framepos_t start = selection->time[clicked_selection].start;
framepos_t end = selection->time[clicked_selection].end;
framepos_t cnt = end - start + 1;
boost::shared_ptr<AudioFileSource> write_source (uint32_t n = 0);
+ bool bounceable () const;
+
protected:
boost::shared_ptr<AudioDiskstream> audio_diskstream () const;
XMLNode& state (bool full);
uint16_t get_channel_mask ();
boost::shared_ptr<MidiPlaylist> midi_playlist ();
+ bool bounceable () const {
+ return false;
+ }
+
PBD::Signal2<void, boost::shared_ptr<MidiBuffer>, boost::weak_ptr<MidiSource> > DataRecorded;
protected:
void set_block_size (pframes_t);
+ /** @return true if the track can be bounced, or false if it cannot because
+ * it has more outputs than diskstream channels.
+ */
+ virtual bool bounceable () const = 0;
+
/* PublicDiskstream interface */
boost::shared_ptr<Playlist> playlist ();
void monitor_input (bool);
return ds->write_source (n);
}
+bool
+AudioTrack::bounceable () const
+{
+ return n_inputs().n_audio() >= n_outputs().n_audio();
+}
boost::shared_ptr<AudioFileSource> fsource;
uint32_t x;
char buf[PATH_MAX+1];
- ChanCount nchans(track.n_channels());
+ ChanCount diskstream_channels (track.n_channels());
framepos_t position;
framecnt_t this_chunk;
framepos_t to_do;
framepos_t len = end - start;
bool need_block_size_reset = false;
string ext;
+ ChanCount const max_proc = track.max_processor_streams ();
if (end <= start) {
error << string_compose (_("Cannot write a range where end <= start (e.g. %1 <= %2)"),
ext = native_header_format_extension (config.get_native_file_header_format(), DataType::AUDIO);
- for (uint32_t chan_n=0; chan_n < nchans.n_audio(); ++chan_n) {
+ for (uint32_t chan_n = 0; chan_n < diskstream_channels.n_audio(); ++chan_n) {
for (x = 0; x < 99999; ++x) {
snprintf (buf, sizeof(buf), "%s/%s-%d-bounce-%" PRIu32 "%s", sound_dir.c_str(), playlist->name().c_str(), chan_n, x+1, ext.c_str());
to_do = len;
/* create a set of reasonably-sized buffers */
- buffers.ensure_buffers(DataType::AUDIO, nchans.n_audio(), chunk_size);
- buffers.set_count(nchans);
+ buffers.ensure_buffers (DataType::AUDIO, max_proc.n_audio(), chunk_size);
+ buffers.set_count (max_proc);
- for (vector<boost::shared_ptr<Source> >::iterator src=srcs.begin(); src != srcs.end(); ++src) {
+ 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);
if (afs)
afs->prepare_for_peakfile_writes ();