Consolidate common bounce code of Audio and MIDI Track

This commit is contained in:
Robin Gareus 2023-10-16 17:22:53 +02:00
parent b736c50d83
commit 15d560c5e4
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
6 changed files with 31 additions and 47 deletions

View File

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

View File

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

View File

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

View File

@ -306,24 +306,6 @@ AudioTrack::bounceable (std::shared_ptr<Processor> endpoint, bool include_endpoi
return true;
}
std::shared_ptr<Region>
AudioTrack::bounce (InterThreadInfo& itt, std::string const& name)
{
return bounce_range (_session.current_start_sample(), _session.current_end_sample(), itt, main_outs(), false, name);
}
std::shared_ptr<Region>
AudioTrack::bounce_range (samplepos_t start,
samplepos_t end,
InterThreadInfo& itt,
std::shared_ptr<Processor> endpoint,
bool include_endpoint,
std::string const& name)
{
vector<std::shared_ptr<Source> > srcs;
return _session.write_one_track (*this, start, end, false, srcs, itt, endpoint, include_endpoint, false, false, name);
}
void
AudioTrack::freeze_me (InterThreadInfo& itt)
{

View File

@ -604,22 +604,16 @@ MidiTrack::export_stuff (BufferSet& buffers,
return 0;
}
std::shared_ptr<Region>
MidiTrack::bounce (InterThreadInfo& itt, std::string const& name)
bool
MidiTrack::bounceable (std::shared_ptr<Processor> endpoint, bool include_endpoint) const
{
return bounce_range (_session.current_start_sample(), _session.current_end_sample(), itt, main_outs(), false, name);
}
std::shared_ptr<Region>
MidiTrack::bounce_range (samplepos_t start,
samplepos_t end,
InterThreadInfo& itt,
std::shared_ptr<Processor> endpoint,
bool include_endpoint,
std::string const& name)
{
vector<std::shared_ptr<Source> > srcs;
return _session.write_one_track (*this, start, end, false, srcs, itt, endpoint, include_endpoint, false, false, name);
if (!endpoint && !include_endpoint) {
/* no processing - just read from the playlist and create new
* files: always possible.
*/
return true;
}
return false; // a lie, Session::write_one_track can handle this.
}
void

View File

@ -931,6 +931,24 @@ Track::set_processor_state (XMLNode const& node, int version, XMLProperty const*
return false;
}
std::shared_ptr<Region>
Track::bounce (InterThreadInfo& itt, std::string const& name)
{
return bounce_range (_session.current_start_sample(), _session.current_end_sample(), itt, main_outs(), false, name);
}
std::shared_ptr<Region>
Track::bounce_range (samplepos_t start,
samplepos_t end,
InterThreadInfo& itt,
std::shared_ptr<Processor> endpoint,
bool include_endpoint,
std::string const& name)
{
vector<std::shared_ptr<Source> > srcs;
return _session.write_one_track (*this, start, end, false, srcs, itt, endpoint, include_endpoint, false, false, name);
}
void
Track::use_captured_sources (SourceList& srcs, CaptureInfos const & capture_info)
{