13
0

Transport: engaging loop play while rolling with no audio tracks now works

At present only audio data from disk readers is declicked. MIDI tracks with audio output should
likely also be declicked, at which time Session::need_declick_before_locate() will require
amending
This commit is contained in:
Paul Davis 2020-07-18 17:29:53 -06:00
parent c778ded411
commit 15fcb5c782
5 changed files with 41 additions and 3 deletions

View File

@ -337,6 +337,7 @@ public:
uint32_t nstripables (bool with_monitor = false) const; uint32_t nstripables (bool with_monitor = false) const;
uint32_t nroutes() const { return routes.reader()->size(); } uint32_t nroutes() const { return routes.reader()->size(); }
uint32_t ntracks () const; uint32_t ntracks () const;
uint32_t naudiotracks () const;
uint32_t nbusses () const; uint32_t nbusses () const;
bool plot_process_graph (std::string const& file_name) const; bool plot_process_graph (std::string const& file_name) const;
@ -1296,6 +1297,7 @@ protected:
double speed() const { return _transport_speed; } double speed() const { return _transport_speed; }
samplepos_t position() const { return _transport_sample; } samplepos_t position() const { return _transport_sample; }
void set_transport_speed (double speed, bool abort, bool clear_state, bool as_default); void set_transport_speed (double speed, bool abort, bool clear_state, bool as_default);
bool need_declick_before_locate () const;
private: private:
int create (const std::string& mix_template, BusProfile const *, bool unnamed); int create (const std::string& mix_template, BusProfile const *, bool unnamed);

View File

@ -43,6 +43,7 @@ class LIBARDOUR_API TransportAPI
virtual double speed() const = 0; virtual double speed() const = 0;
virtual void set_transport_speed (double speed, bool abort_capture, bool clear_state, bool as_default) = 0; virtual void set_transport_speed (double speed, bool abort_capture, bool clear_state, bool as_default) = 0;
virtual samplepos_t position() const = 0; virtual samplepos_t position() const = 0;
virtual bool need_declick_before_locate () const = 0;
}; };
} /* end namespace ARDOUR */ } /* end namespace ARDOUR */

View File

@ -6002,6 +6002,8 @@ Session::get_mix_buffers (ChanCount count)
uint32_t uint32_t
Session::ntracks () const Session::ntracks () const
{ {
/* XXX Could be optimized by caching */
uint32_t n = 0; uint32_t n = 0;
boost::shared_ptr<RouteList> r = routes.reader (); boost::shared_ptr<RouteList> r = routes.reader ();
@ -6014,6 +6016,23 @@ Session::ntracks () const
return n; return n;
} }
uint32_t
Session::naudiotracks () const
{
/* XXX Could be optimized by caching */
uint32_t n = 0;
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
if (boost::dynamic_pointer_cast<AudioTrack> (*i)) {
++n;
}
}
return n;
}
uint32_t uint32_t
Session::nbusses () const Session::nbusses () const
{ {

View File

@ -647,6 +647,15 @@ Session::start_transport ()
TransportStateChange (); /* EMIT SIGNAL */ TransportStateChange (); /* EMIT SIGNAL */
} }
bool
Session::need_declick_before_locate () const
{
/* At this time (July 2020) only audio playback from disk readers is
de-clicked. MIDI tracks with audio output really need it too.
*/
return naudiotracks() > 0;
}
bool bool
Session::should_roll_after_locate () const Session::should_roll_after_locate () const
{ {

View File

@ -292,6 +292,7 @@ TransportFSM::process_event (Event& ev, bool already_deferred, bool& deferred)
break; break;
case Rolling: case Rolling:
if (ev.for_loop_end) { if (ev.for_loop_end) {
/* we will finish the locate synchronously, so /* we will finish the locate synchronously, so
* that after returning from * that after returning from
* ::locate_for_loop() we will already have * ::locate_for_loop() we will already have
@ -308,6 +309,7 @@ TransportFSM::process_event (Event& ev, bool already_deferred, bool& deferred)
*/ */
transition (WaitingForLocate); transition (WaitingForLocate);
locate_for_loop (ev); locate_for_loop (ev);
} else if (DiskReader::no_disk_output()) { } else if (DiskReader::no_disk_output()) {
/* separate clause to allow a comment that is /* separate clause to allow a comment that is
@ -326,8 +328,14 @@ TransportFSM::process_event (Event& ev, bool already_deferred, bool& deferred)
transition (WaitingForLocate); transition (WaitingForLocate);
locate_for_loop (ev); locate_for_loop (ev);
} else { } else {
if (api->need_declick_before_locate()) {
transition (DeclickToLocate); transition (DeclickToLocate);
start_declick_for_locate (ev); start_declick_for_locate (ev);
} else {
transition (WaitingForLocate);
locate_for_loop (ev);
}
} }
break; break;
case WaitingForLocate: case WaitingForLocate:
@ -675,4 +683,3 @@ TransportFSM::will_roll_fowards () const
} }
return (_direction_state == Forwards); return (_direction_state == Forwards);
} }