summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-10-31 18:32:26 +0100
committerRobin Gareus <robin@gareus.org>2017-10-31 18:32:26 +0100
commit00a4ad712c2d5ac73f04b0f43906590b24a22fb6 (patch)
treec849d672536222bc173c0e6fbbe3d38739dcbaf8 /libs
parent8e8168547bef7e404f70916fa3838cbe5c15bc62 (diff)
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.
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/disk_io.h4
-rw-r--r--libs/ardour/ardour/processor.h4
-rw-r--r--libs/ardour/ardour/route.h3
-rw-r--r--libs/ardour/ardour/track.h2
-rw-r--r--libs/ardour/disk_io.cc17
-rw-r--r--libs/ardour/disk_reader.cc6
-rw-r--r--libs/ardour/disk_writer.cc2
-rw-r--r--libs/ardour/processor.cc5
-rw-r--r--libs/ardour/route.cc12
-rw-r--r--libs/ardour/session_transport.cc5
-rw-r--r--libs/ardour/track.cc9
11 files changed, 29 insertions, 40 deletions
diff --git a/libs/ardour/ardour/disk_io.h b/libs/ardour/ardour/disk_io.h
index 74eede7644..3fae063c1e 100644
--- a/libs/ardour/ardour/disk_io.h
+++ b/libs/ardour/ardour/disk_io.h
@@ -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;
diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h
index f3325a1194..139a5cf592 100644
--- a/libs/ardour/ardour/processor.h
+++ b/libs/ardour/ardour/processor.h
@@ -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
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index f903a49bac..ba262d61e8 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -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;
diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h
index 6b024274f0..7703221bd4 100644
--- a/libs/ardour/ardour/track.h
+++ b/libs/ardour/ardour/track.h
@@ -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;
diff --git a/libs/ardour/disk_io.cc b/libs/ardour/disk_io.cc
index 1872c81ea9..c43e42c315 100644
--- a/libs/ardour/disk_io.cc
+++ b/libs/ardour/disk_io.cc
@@ -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)
{
diff --git a/libs/ardour/disk_reader.cc b/libs/ardour/disk_reader.cc
index 55180ad1bd..4896a95af2 100644
--- a/libs/ardour/disk_reader.cc
+++ b/libs/ardour/disk_reader.cc
@@ -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);
diff --git a/libs/ardour/disk_writer.cc b/libs/ardour/disk_writer.cc
index 0efc2e2811..c5c9beca36 100644
--- a/libs/ardour/disk_writer.cc
+++ b/libs/ardour/disk_writer.cc
@@ -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;
diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc
index c6e6c21360..19b6f30367 100644
--- a/libs/ardour/processor.cc
+++ b/libs/ardour/processor.cc
@@ -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)
{
}
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 29225404d9..6b1a73c088 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -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
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index b777097e98..10eea5d3bf 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -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);
}
}
}
diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc
index b3c8088033..d58faf1e83 100644
--- a/libs/ardour/track.cc
+++ b/libs/ardour/track.cc
@@ -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)
{