Skip to content

Commit

Permalink
Prompt user for name of Range and Region bounces (libardour part)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenLoftis committed Jul 26, 2020
1 parent f5bdfb1 commit f564c92
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 21 deletions.
5 changes: 3 additions & 2 deletions libs/ardour/ardour/audio_track.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ class LIBARDOUR_API AudioTrack : public Track
void unfreeze ();

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<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,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze,
MidiStateTracker&);
Expand Down
4 changes: 2 additions & 2 deletions libs/ardour/ardour/auditioner.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ class LIBARDOUR_API Auditioner : public Track
void freeze_me (InterThreadInfo&) {}
void unfreeze () {}

boost::shared_ptr<Region> bounce (InterThreadInfo&) {
boost::shared_ptr<Region> bounce (InterThreadInfo&, const std::string name) {
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> ();
}

Expand Down
5 changes: 3 additions & 2 deletions libs/ardour/ardour/midi_track.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ class LIBARDOUR_API MidiTrack : public Track
void unfreeze ();

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,
samplepos_t end,
InterThreadInfo& iti,
boost::shared_ptr<Processor> endpoint,
bool include_endpoint);
bool include_endpoint,
const std::string name);

int export_stuff (BufferSet& bufs,
samplepos_t start_sample,
Expand Down
2 changes: 1 addition & 1 deletion libs/ardour/ardour/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
boost::shared_ptr<Region> write_one_track (Track&, samplepos_t start, samplepos_t end,
bool overwrite, std::vector<boost::shared_ptr<Source> >&, InterThreadInfo& wot,
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&);

/* session-wide solo/mute/rec-enable */
Expand Down
4 changes: 2 additions & 2 deletions libs/ardour/ardour/track.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class LIBARDOUR_API Track : public Route, public Recordable
* @param itt asynchronous progress report and cancel
* @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.
* @param start start time (in samples)
Expand All @@ -107,7 +107,7 @@ class LIBARDOUR_API Track : public Route, public Recordable
* @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,
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,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze,
MidiStateTracker&) = 0;
Expand Down
10 changes: 5 additions & 5 deletions libs/ardour/audio_track.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,17 +292,17 @@ AudioTrack::bounceable (boost::shared_ptr<Processor> endpoint, bool include_endp
}

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>
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;
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
Expand Down Expand Up @@ -345,7 +345,7 @@ AudioTrack::freeze_me (InterThreadInfo& itt)
boost::shared_ptr<Region> res;

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;
}

Expand Down
9 changes: 5 additions & 4 deletions libs/ardour/midi_track.cc
Original file line number Diff line number Diff line change
Expand Up @@ -539,20 +539,21 @@ MidiTrack::export_stuff (BufferSet& buffers,
}

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>
MidiTrack::bounce_range (samplepos_t start,
samplepos_t end,
InterThreadInfo& itt,
boost::shared_ptr<Processor> endpoint,
bool include_endpoint)
bool include_endpoint,
const std::string name)
{
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
Expand Down
11 changes: 8 additions & 3 deletions libs/ardour/session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5672,7 +5672,7 @@ Session::write_one_track (Track& track, samplepos_t start, samplepos_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_freeze)
bool for_export, bool for_freeze, const std::string name)
{
boost::shared_ptr<Region> result;
boost::shared_ptr<Playlist> playlist;
Expand Down Expand Up @@ -5731,11 +5731,15 @@ Session::write_one_track (Track& track, samplepos_t start, samplepos_t end,
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) {

string base_name = string_compose ("%1-%2-bounce", playlist->name(), chan_n);
string path = ((data_type == DataType::AUDIO)
? new_audio_source_path (legal_playlist_name, diskstream_channels.n_audio(), chan_n, true)
: new_midi_source_path (legal_playlist_name));
Expand Down Expand Up @@ -5918,6 +5922,7 @@ Session::write_one_track (Track& track, samplepos_t start, samplepos_t end,

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:
Expand Down

0 comments on commit f564c92

Please sign in to comment.