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
No known key found for this signature in database
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 (); void unfreeze ();
bool bounceable (std::shared_ptr<Processor>, bool include_endpoint) const; 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, 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, std::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze,
MidiNoteTracker&); MidiNoteTracker&);

View file

@ -53,14 +53,7 @@ public:
void freeze_me (InterThreadInfo&); void freeze_me (InterThreadInfo&);
void unfreeze (); void unfreeze ();
bool bounceable (std::shared_ptr<Processor>, bool) const { return false; } bool bounceable (std::shared_ptr<Processor>, bool include_endpoint) const;
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);
int export_stuff (BufferSet& bufs, int export_stuff (BufferSet& bufs,
samplepos_t start_sample, samplepos_t start_sample,

View file

@ -98,7 +98,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 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. /** Bounce the given range to a new audio region.
* @param start start time (in samples) * @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, virtual std::shared_ptr<Region> bounce_range (samplepos_t start, samplepos_t end, InterThreadInfo& itt,
std::shared_ptr<Processor> endpoint, bool include_endpoint, 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, 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, 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; 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 void
AudioTrack::freeze_me (InterThreadInfo& itt) AudioTrack::freeze_me (InterThreadInfo& itt)
{ {

View file

@ -604,22 +604,16 @@ MidiTrack::export_stuff (BufferSet& buffers,
return 0; return 0;
} }
std::shared_ptr<Region> bool
MidiTrack::bounce (InterThreadInfo& itt, std::string const& name) 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); 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.
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);
} }
void void

View file

@ -931,6 +931,24 @@ Track::set_processor_state (XMLNode const& node, int version, XMLProperty const*
return false; 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 void
Track::use_captured_sources (SourceList& srcs, CaptureInfos const & capture_info) Track::use_captured_sources (SourceList& srcs, CaptureInfos const & capture_info)
{ {