Prompt user for name of Range and Region bounces (libardour part)

This commit is contained in:
Ben Loftis 2020-07-13 14:30:10 -05:00
parent f5bdfb14fd
commit f564c92493
8 changed files with 29 additions and 21 deletions

View file

@ -44,9 +44,10 @@ class LIBARDOUR_API AudioTrack : public Track
void unfreeze (); void unfreeze ();
bool bounceable (boost::shared_ptr<Processor>, bool include_endpoint) const; bool bounceable (boost::shared_ptr<Processor>, bool include_endpoint) const;
boost::shared_ptr<Region> bounce (InterThreadInfo&); boost::shared_ptr<Region> bounce (InterThreadInfo&, const std::string name);
boost::shared_ptr<Region> bounce_range (samplepos_t start, samplepos_t end, InterThreadInfo&, boost::shared_ptr<Region> bounce_range (samplepos_t start, samplepos_t end, InterThreadInfo&,
boost::shared_ptr<Processor> endpoint, bool include_endpoint); boost::shared_ptr<Processor> endpoint, bool include_endpoint,
const std::string name);
int export_stuff (BufferSet& bufs, samplepos_t start_sample, samplecnt_t nframes, int export_stuff (BufferSet& bufs, samplepos_t start_sample, samplecnt_t nframes,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze,
MidiStateTracker&); MidiStateTracker&);

View file

@ -79,11 +79,11 @@ public:
void freeze_me (InterThreadInfo&) {} void freeze_me (InterThreadInfo&) {}
void unfreeze () {} void unfreeze () {}
boost::shared_ptr<Region> bounce (InterThreadInfo&) { boost::shared_ptr<Region> bounce (InterThreadInfo&, const std::string name) {
return boost::shared_ptr<Region> (); return boost::shared_ptr<Region> ();
} }
boost::shared_ptr<Region> bounce_range (samplepos_t, samplepos_t, InterThreadInfo&, boost::shared_ptr<Processor>, bool) { boost::shared_ptr<Region> bounce_range (samplepos_t, samplepos_t, InterThreadInfo&, boost::shared_ptr<Processor>, bool, const std::string) {
return boost::shared_ptr<Region> (); return boost::shared_ptr<Region> ();
} }

View file

@ -53,12 +53,13 @@ public:
void unfreeze (); void unfreeze ();
bool bounceable (boost::shared_ptr<Processor>, bool) const { return false; } bool bounceable (boost::shared_ptr<Processor>, bool) const { return false; }
boost::shared_ptr<Region> bounce (InterThreadInfo&); boost::shared_ptr<Region> bounce (InterThreadInfo&, const std::string name);
boost::shared_ptr<Region> bounce_range (samplepos_t start, boost::shared_ptr<Region> bounce_range (samplepos_t start,
samplepos_t end, samplepos_t end,
InterThreadInfo& iti, InterThreadInfo& iti,
boost::shared_ptr<Processor> endpoint, boost::shared_ptr<Processor> endpoint,
bool include_endpoint); bool include_endpoint,
const std::string name);
int export_stuff (BufferSet& bufs, int export_stuff (BufferSet& bufs,
samplepos_t start_sample, samplepos_t start_sample,

View file

@ -913,7 +913,7 @@ public:
boost::shared_ptr<Region> write_one_track (Track&, samplepos_t start, samplepos_t end, boost::shared_ptr<Region> write_one_track (Track&, samplepos_t start, samplepos_t end,
bool overwrite, std::vector<boost::shared_ptr<Source> >&, InterThreadInfo& wot, bool overwrite, std::vector<boost::shared_ptr<Source> >&, InterThreadInfo& wot,
boost::shared_ptr<Processor> endpoint, boost::shared_ptr<Processor> endpoint,
bool include_endpoint, bool for_export, bool for_freeze); bool include_endpoint, bool for_export, bool for_freeze, const std::string name);
int freeze_all (InterThreadInfo&); int freeze_all (InterThreadInfo&);
/* session-wide solo/mute/rec-enable */ /* session-wide solo/mute/rec-enable */

View file

@ -96,7 +96,7 @@ public:
* @param itt asynchronous progress report and cancel * @param itt asynchronous progress report and cancel
* @return a new audio region (or nil in case of error) * @return a new audio region (or nil in case of error)
*/ */
virtual boost::shared_ptr<Region> bounce (InterThreadInfo& itt) = 0; virtual boost::shared_ptr<Region> bounce (InterThreadInfo& itt, const std::string name) = 0;
/** Bounce the given range to a new audio region. /** Bounce the given range to a new audio region.
* @param start start time (in samples) * @param start start time (in samples)
@ -107,7 +107,7 @@ public:
* @return a new audio region (or nil in case of error) * @return a new audio region (or nil in case of error)
*/ */
virtual boost::shared_ptr<Region> bounce_range (samplepos_t start, samplepos_t end, InterThreadInfo& itt, virtual boost::shared_ptr<Region> bounce_range (samplepos_t start, samplepos_t end, InterThreadInfo& itt,
boost::shared_ptr<Processor> endpoint, bool include_endpoint) = 0; boost::shared_ptr<Processor> endpoint, bool include_endpoint, const std::string name) = 0;
virtual int export_stuff (BufferSet& bufs, samplepos_t start_sample, samplecnt_t nframes, virtual int export_stuff (BufferSet& bufs, samplepos_t start_sample, samplecnt_t nframes,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze,
MidiStateTracker&) = 0; MidiStateTracker&) = 0;

View file

@ -292,17 +292,17 @@ AudioTrack::bounceable (boost::shared_ptr<Processor> endpoint, bool include_endp
} }
boost::shared_ptr<Region> boost::shared_ptr<Region>
AudioTrack::bounce (InterThreadInfo& itt) AudioTrack::bounce (InterThreadInfo& itt, const std::string name)
{ {
return bounce_range (_session.current_start_sample(), _session.current_end_sample(), itt, main_outs(), false); return bounce_range (_session.current_start_sample(), _session.current_end_sample(), itt, main_outs(), false, name);
} }
boost::shared_ptr<Region> boost::shared_ptr<Region>
AudioTrack::bounce_range (samplepos_t start, samplepos_t end, InterThreadInfo& itt, AudioTrack::bounce_range (samplepos_t start, samplepos_t end, InterThreadInfo& itt,
boost::shared_ptr<Processor> endpoint, bool include_endpoint) boost::shared_ptr<Processor> endpoint, bool include_endpoint, const std::string name)
{ {
vector<boost::shared_ptr<Source> > srcs; vector<boost::shared_ptr<Source> > srcs;
return _session.write_one_track (*this, start, end, false, srcs, itt, endpoint, include_endpoint, false, false); return _session.write_one_track (*this, start, end, false, srcs, itt, endpoint, include_endpoint, false, false, name);
} }
void void
@ -345,7 +345,7 @@ AudioTrack::freeze_me (InterThreadInfo& itt)
boost::shared_ptr<Region> res; boost::shared_ptr<Region> res;
if ((res = _session.write_one_track (*this, _session.current_start_sample(), _session.current_end_sample(), if ((res = _session.write_one_track (*this, _session.current_start_sample(), _session.current_end_sample(),
true, srcs, itt, main_outs(), false, false, true)) == 0) { true, srcs, itt, main_outs(), false, false, true, "")) == 0) {
return; return;
} }

View file

@ -539,9 +539,9 @@ MidiTrack::export_stuff (BufferSet& buffers,
} }
boost::shared_ptr<Region> boost::shared_ptr<Region>
MidiTrack::bounce (InterThreadInfo& itt) MidiTrack::bounce (InterThreadInfo& itt, const std::string name)
{ {
return bounce_range (_session.current_start_sample(), _session.current_end_sample(), itt, main_outs(), false); return bounce_range (_session.current_start_sample(), _session.current_end_sample(), itt, main_outs(), false, name);
} }
boost::shared_ptr<Region> boost::shared_ptr<Region>
@ -549,10 +549,11 @@ MidiTrack::bounce_range (samplepos_t start,
samplepos_t end, samplepos_t end,
InterThreadInfo& itt, InterThreadInfo& itt,
boost::shared_ptr<Processor> endpoint, boost::shared_ptr<Processor> endpoint,
bool include_endpoint) bool include_endpoint,
const std::string name)
{ {
vector<boost::shared_ptr<Source> > srcs; vector<boost::shared_ptr<Source> > srcs;
return _session.write_one_track (*this, start, end, false, srcs, itt, endpoint, include_endpoint, false, false); return _session.write_one_track (*this, start, end, false, srcs, itt, endpoint, include_endpoint, false, false, name);
} }
void void

View file

@ -5672,7 +5672,7 @@ Session::write_one_track (Track& track, samplepos_t start, samplepos_t end,
bool /*overwrite*/, vector<boost::shared_ptr<Source> >& srcs, bool /*overwrite*/, vector<boost::shared_ptr<Source> >& srcs,
InterThreadInfo& itt, InterThreadInfo& itt,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, boost::shared_ptr<Processor> endpoint, bool include_endpoint,
bool for_export, bool for_freeze) bool for_export, bool for_freeze, const std::string name)
{ {
boost::shared_ptr<Region> result; boost::shared_ptr<Region> result;
boost::shared_ptr<Playlist> playlist; boost::shared_ptr<Playlist> playlist;
@ -5731,11 +5731,15 @@ Session::write_one_track (Track& track, samplepos_t start, samplepos_t end,
goto out; goto out;
} }
legal_playlist_name = legalize_for_path (playlist->name()); if (name.length() > 0) {
/*if the user passed in a name, we will use it, and also prepend the resulting sources with that name*/
legal_playlist_name.append(legalize_for_path (name) + "-");
}
legal_playlist_name.append(legalize_for_path(playlist->name()));
for (uint32_t chan_n = 0; chan_n < diskstream_channels.n(data_type); ++chan_n) { for (uint32_t chan_n = 0; chan_n < diskstream_channels.n(data_type); ++chan_n) {
string base_name = string_compose ("%1-%2-bounce", playlist->name(), chan_n);
string path = ((data_type == DataType::AUDIO) string path = ((data_type == DataType::AUDIO)
? new_audio_source_path (legal_playlist_name, diskstream_channels.n_audio(), chan_n, true) ? new_audio_source_path (legal_playlist_name, diskstream_channels.n_audio(), chan_n, true)
: new_midi_source_path (legal_playlist_name)); : new_midi_source_path (legal_playlist_name));
@ -5918,6 +5922,7 @@ Session::write_one_track (Track& track, samplepos_t start, samplepos_t end,
result = RegionFactory::create (srcs, plist, true); result = RegionFactory::create (srcs, plist, true);
result->set_name((name.length() != 0) ? name : legal_playlist_name); /*setting name in the properties didn't seem to work, but this does*/
} }
out: out: