Move Loop Location to Processors
The processors will becomes responsible to know about loop-positions and map latency-compensated start_sample, end_sample into the loop-range as needed.
This commit is contained in:
parent
8e8168547b
commit
00a4ad712c
@ -89,9 +89,6 @@ class LIBARDOUR_API DiskIOProcessor : public Processor
|
||||
bool slaved() const { return _slaved; }
|
||||
void set_slaved(bool yn) { _slaved = yn; }
|
||||
|
||||
int set_loop (Location *loc);
|
||||
|
||||
PBD::Signal1<void,Location *> LoopSet;
|
||||
PBD::Signal0<void> SpeedChanged;
|
||||
PBD::Signal0<void> ReverseChanged;
|
||||
|
||||
@ -122,7 +119,6 @@ class LIBARDOUR_API DiskIOProcessor : public Processor
|
||||
double _target_speed;
|
||||
bool _seek_required;
|
||||
bool _slaved;
|
||||
Location* loop_location;
|
||||
bool in_set_state;
|
||||
samplepos_t playback_sample;
|
||||
bool _need_butler;
|
||||
|
@ -40,6 +40,7 @@ class PluginPinWindowProxy;
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
class Location;
|
||||
class Session;
|
||||
class Route;
|
||||
|
||||
@ -108,6 +109,8 @@ class LIBARDOUR_API Processor : public SessionObject, public Automatable, public
|
||||
virtual void realtime_handle_transport_stopped () {}
|
||||
virtual void realtime_locate () {}
|
||||
|
||||
virtual void set_loop (Location *loc) { _loop_location = loc; }
|
||||
|
||||
/* most processors won't care about this, but plugins that
|
||||
receive MIDI or similar data from an input source that
|
||||
may suddenly go "quiet" because of monitoring changes
|
||||
@ -167,6 +170,7 @@ protected:
|
||||
// absolute alignment to session i/o
|
||||
samplecnt_t _capture_offset;
|
||||
samplecnt_t _playback_offset;
|
||||
Location* _loop_location;
|
||||
};
|
||||
|
||||
} // namespace ARDOUR
|
||||
|
@ -78,6 +78,7 @@ class PluginInsert;
|
||||
class RouteGroup;
|
||||
class Send;
|
||||
class InternalReturn;
|
||||
class Location;
|
||||
class MonitorControl;
|
||||
class MonitorProcessor;
|
||||
class Pannable;
|
||||
@ -152,6 +153,7 @@ public:
|
||||
virtual void realtime_locate () {}
|
||||
virtual void non_realtime_locate (samplepos_t);
|
||||
virtual void set_pending_declick (int);
|
||||
int set_loop (ARDOUR::Location *);
|
||||
|
||||
/* end of vfunc-based API */
|
||||
|
||||
@ -672,6 +674,7 @@ protected:
|
||||
FedBy _fed_by;
|
||||
|
||||
InstrumentInfo _instrument_info;
|
||||
Location* _loop_location;
|
||||
|
||||
virtual ChanCount input_streams () const;
|
||||
|
||||
|
@ -37,7 +37,6 @@ class Region;
|
||||
class DiskReader;
|
||||
class DiskWriter;
|
||||
class IO;
|
||||
class Location;
|
||||
class RecordEnableControl;
|
||||
class RecordSafeControl;
|
||||
|
||||
@ -144,7 +143,6 @@ public:
|
||||
void non_realtime_speed_change ();
|
||||
int overwrite_existing_buffers ();
|
||||
samplecnt_t get_captured_samples (uint32_t n = 0) const;
|
||||
int set_loop (ARDOUR::Location *);
|
||||
void transport_looped (samplepos_t);
|
||||
void transport_stopped_wallclock (struct tm &, time_t, bool);
|
||||
bool pending_overwrite () const;
|
||||
|
@ -52,7 +52,6 @@ DiskIOProcessor::DiskIOProcessor (Session& s, string const & str, Flag f)
|
||||
, i_am_the_modifier (false)
|
||||
, _seek_required (false)
|
||||
, _slaved (false)
|
||||
, loop_location (0)
|
||||
, in_set_state (false)
|
||||
, playback_sample (0)
|
||||
, _need_butler (false)
|
||||
@ -182,22 +181,6 @@ DiskIOProcessor::set_block_size (pframes_t nframes)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
DiskIOProcessor::set_loop (Location *location)
|
||||
{
|
||||
if (location) {
|
||||
if (location->start() >= location->end()) {
|
||||
error << string_compose(_("Location \"%1\" not valid for track loop (start >= end)"), location->name()) << endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
loop_location = location;
|
||||
|
||||
LoopSet (location); /* EMIT SIGNAL */
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
DiskIOProcessor::non_realtime_locate (samplepos_t location)
|
||||
{
|
||||
|
@ -756,7 +756,7 @@ DiskReader::audio_read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer,
|
||||
just once.
|
||||
*/
|
||||
|
||||
if ((loc = loop_location) != 0) {
|
||||
if ((loc = _loop_location) != 0) {
|
||||
loop_start = loc->start();
|
||||
loop_end = loc->end();
|
||||
loop_length = loop_end - loop_start;
|
||||
@ -1254,7 +1254,7 @@ DiskReader::get_midi_playback (MidiBuffer& dst, samplepos_t start_sample, sample
|
||||
if (ms & MonitoringDisk) {
|
||||
/* disk data needed */
|
||||
|
||||
Location* loc = loop_location;
|
||||
Location* loc = _loop_location;
|
||||
|
||||
DEBUG_TRACE (DEBUG::MidiDiskstreamIO, string_compose (
|
||||
"%1 MDS pre-read read %8 offset = %9 @ %4..%5 from %2 write to %3, LOOPED ? %6 .. %7\n", _name,
|
||||
@ -1379,7 +1379,7 @@ DiskReader::midi_read (samplepos_t& start, samplecnt_t dur, bool reversed)
|
||||
samplepos_t loop_end = 0;
|
||||
samplepos_t loop_start = 0;
|
||||
samplecnt_t loop_length = 0;
|
||||
Location* loc = loop_location;
|
||||
Location* loc = _loop_location;
|
||||
samplepos_t effective_start = start;
|
||||
Evoral::Range<samplepos_t>* loop_range (0);
|
||||
|
||||
|
@ -384,7 +384,7 @@ DiskWriter::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp
|
||||
last_recordable_sample = max_samplepos;
|
||||
}
|
||||
|
||||
const Location* const loop_loc = loop_location;
|
||||
const Location* const loop_loc = _loop_location;
|
||||
samplepos_t loop_start = 0;
|
||||
samplepos_t loop_end = 0;
|
||||
samplepos_t loop_length = 0;
|
||||
|
@ -72,6 +72,7 @@ Processor::Processor(Session& session, const string& name)
|
||||
, _output_latency (0)
|
||||
, _capture_offset (0)
|
||||
, _playback_offset (0)
|
||||
, _loop_location (0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -91,6 +92,10 @@ Processor::Processor (const Processor& other)
|
||||
, _pinmgr_proxy (0)
|
||||
, _owner (0)
|
||||
, _input_latency (0)
|
||||
, _output_latency (0)
|
||||
, _capture_offset (0)
|
||||
, _playback_offset (0)
|
||||
, _loop_location (other._loop_location)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -108,6 +108,7 @@ Route::Route (Session& sess, string name, PresentationInfo::Flag flag, DataType
|
||||
, _declickable (false)
|
||||
, _have_internal_generator (false)
|
||||
, _default_type (default_type)
|
||||
, _loop_location (NULL)
|
||||
, _track_number (0)
|
||||
, _strict_io (false)
|
||||
, _in_configure_processors (false)
|
||||
@ -5881,6 +5882,16 @@ Route::set_disk_io_point (DiskIOPoint diop)
|
||||
processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
int
|
||||
Route::set_loop (Location* l)
|
||||
{
|
||||
_loop_location = l;
|
||||
Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
|
||||
for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) {
|
||||
(*i)->set_loop (l);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_TRACKS_CODE_FEATURES
|
||||
|
||||
/* This is the Tracks version of Track::monitoring_state().
|
||||
@ -6039,5 +6050,4 @@ Route::monitoring_state () const
|
||||
abort(); /* NOTREACHED */
|
||||
return MonitoringSilence;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1000,9 +1000,8 @@ Session::set_track_loop (bool yn)
|
||||
boost::shared_ptr<RouteList> rl = routes.reader ();
|
||||
|
||||
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
|
||||
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
|
||||
if (tr && !tr->is_private_route()) {
|
||||
tr->set_loop (yn ? loc : 0);
|
||||
if (*i && !(*i)->is_private_route()) {
|
||||
(*i)->set_loop (yn ? loc : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -538,15 +538,6 @@ Track::get_captured_samples (uint32_t n) const
|
||||
return _disk_writer->get_captured_samples (n);
|
||||
}
|
||||
|
||||
int
|
||||
Track::set_loop (Location* l)
|
||||
{
|
||||
if (_disk_reader->set_loop (l)) {
|
||||
return -1;
|
||||
}
|
||||
return _disk_writer->set_loop (l);
|
||||
}
|
||||
|
||||
void
|
||||
Track::transport_looped (samplepos_t p)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user