summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-06-25 02:23:56 +0200
committerRobin Gareus <robin@gareus.org>2016-06-25 02:23:56 +0200
commite9a8ccc7e2826d8fe91eff34ee8a0683a7f7aac6 (patch)
tree50b54d5b0c31caf97d80a739c182ad5a101ecec5 /libs
parent6a12022ccf96261d61dce06b8da6c3116fb289a1 (diff)
major internal plugin & processor API change:
Pass current (latency compensated) cycle times to plugin. This fixes time-reporting to plugins and also fixes automation and when bouncing (the session->transport* is not valid) etc.
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/amp.cc2
-rw-r--r--libs/ardour/ardour/amp.h2
-rw-r--r--libs/ardour/ardour/audio_unit.h7
-rw-r--r--libs/ardour/ardour/capturing_processor.h2
-rw-r--r--libs/ardour/ardour/delayline.h2
-rw-r--r--libs/ardour/ardour/delivery.h2
-rw-r--r--libs/ardour/ardour/internal_return.h2
-rw-r--r--libs/ardour/ardour/internal_send.h2
-rw-r--r--libs/ardour/ardour/io.h2
-rw-r--r--libs/ardour/ardour/io_processor.h2
-rw-r--r--libs/ardour/ardour/ladspa_plugin.h1
-rw-r--r--libs/ardour/ardour/luaproc.h1
-rw-r--r--libs/ardour/ardour/lv2_plugin.h1
-rw-r--r--libs/ardour/ardour/meter.h2
-rw-r--r--libs/ardour/ardour/monitor_processor.h2
-rw-r--r--libs/ardour/ardour/plugin.h5
-rw-r--r--libs/ardour/ardour/plugin_insert.h8
-rw-r--r--libs/ardour/ardour/port_insert.h2
-rw-r--r--libs/ardour/ardour/processor.h4
-rw-r--r--libs/ardour/ardour/return.h2
-rw-r--r--libs/ardour/ardour/send.h2
-rw-r--r--libs/ardour/ardour/session.h4
-rw-r--r--libs/ardour/ardour/sidechain.h2
-rw-r--r--libs/ardour/ardour/unknown_processor.h2
-rw-r--r--libs/ardour/ardour/vst_plugin.h14
-rw-r--r--libs/ardour/audio_track.cc2
-rw-r--r--libs/ardour/audio_unit.cc41
-rw-r--r--libs/ardour/capturing_processor.cc2
-rw-r--r--libs/ardour/delayline.cc2
-rw-r--r--libs/ardour/delivery.cc2
-rw-r--r--libs/ardour/internal_return.cc2
-rw-r--r--libs/ardour/internal_send.cc8
-rw-r--r--libs/ardour/io.cc4
-rw-r--r--libs/ardour/io_processor.cc2
-rw-r--r--libs/ardour/ladspa_plugin.cc3
-rw-r--r--libs/ardour/luaproc.cc3
-rw-r--r--libs/ardour/lv2_plugin.cc38
-rw-r--r--libs/ardour/meter.cc2
-rw-r--r--libs/ardour/midi_track.cc2
-rw-r--r--libs/ardour/monitor_processor.cc2
-rw-r--r--libs/ardour/plugin.cc5
-rw-r--r--libs/ardour/plugin_insert.cc44
-rw-r--r--libs/ardour/port_insert.cc8
-rw-r--r--libs/ardour/return.cc6
-rw-r--r--libs/ardour/route.cc16
-rw-r--r--libs/ardour/send.cc10
-rw-r--r--libs/ardour/session_click.cc2
-rw-r--r--libs/ardour/session_vst.cc6
-rw-r--r--libs/ardour/sidechain.cc2
-rw-r--r--libs/ardour/track.cc8
-rw-r--r--libs/ardour/unknown_processor.cc2
-rw-r--r--libs/ardour/vst_plugin.cc8
52 files changed, 169 insertions, 140 deletions
diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc
index 273acc77f9..e4223e4586 100644
--- a/libs/ardour/amp.cc
+++ b/libs/ardour/amp.cc
@@ -71,7 +71,7 @@ Amp::configure_io (ChanCount in, ChanCount out)
}
void
-Amp::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t nframes, bool)
+Amp::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t nframes, bool)
{
if (!_active && !_pending_active) {
return;
diff --git a/libs/ardour/ardour/amp.h b/libs/ardour/ardour/amp.h
index a85963babe..820e2a85e1 100644
--- a/libs/ardour/ardour/amp.h
+++ b/libs/ardour/ardour/amp.h
@@ -47,7 +47,7 @@ public:
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
bool configure_io (ChanCount in, ChanCount out);
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool);
+ void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
bool apply_gain () const { return _apply_gain; }
void apply_gain (bool yn) { _apply_gain = yn; }
diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h
index 448584251c..b02a0d3b80 100644
--- a/libs/ardour/ardour/audio_unit.h
+++ b/libs/ardour/ardour/audio_unit.h
@@ -171,6 +171,8 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin
std::vector<std::pair<int,int> > io_configs;
pframes_t _current_block_size;
framecnt_t _last_nframes;
+ framepos_t _transport_frame;
+ framepos_t _transport_speed;
bool _requires_fixed_size_buffers;
AudioBufferList* buffers;
bool _has_midi_input;
@@ -226,8 +228,9 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin
void discover_factory_presets ();
- bool last_transport_rolling;
- float last_transport_speed;
+ framepos_t transport_frame;
+ float transport_speed;
+ floa t last_transport_speed;
static void _parameter_change_listener (void* /*arg*/, void* /*src*/, const AudioUnitEvent* event, UInt64 host_time, Float32 new_value);
void parameter_change_listener (void* /*arg*/, void* /*src*/, const AudioUnitEvent* event, UInt64 host_time, Float32 new_value);
diff --git a/libs/ardour/ardour/capturing_processor.h b/libs/ardour/ardour/capturing_processor.h
index 9a91e6d02f..b5cdc8739c 100644
--- a/libs/ardour/ardour/capturing_processor.h
+++ b/libs/ardour/ardour/capturing_processor.h
@@ -36,7 +36,7 @@ class LIBARDOUR_API CapturingProcessor : public Processor
public: // Processor overrides
bool display_to_user() const { return false; }
int set_block_size (pframes_t nframes);
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool result_required);
+ void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool result_required);
bool configure_io (ChanCount in, ChanCount out);
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
virtual XMLNode& state (bool);
diff --git a/libs/ardour/ardour/delayline.h b/libs/ardour/ardour/delayline.h
index 2e970ecd9f..93097df6b2 100644
--- a/libs/ardour/ardour/delayline.h
+++ b/libs/ardour/ardour/delayline.h
@@ -42,7 +42,7 @@ public:
bool display_to_user() const { return false; }
- void run (BufferSet&, framepos_t, framepos_t, pframes_t, bool);
+ void run (BufferSet&, framepos_t, framepos_t, double, pframes_t, bool);
void set_delay(framecnt_t signal_delay);
framecnt_t get_delay() { return _pending_delay; }
diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h
index 13e1cdcda3..80b8431737 100644
--- a/libs/ardour/ardour/delivery.h
+++ b/libs/ardour/ardour/delivery.h
@@ -71,7 +71,7 @@ public:
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
bool configure_io (ChanCount in, ChanCount out);
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool);
+ void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
/* supplemental method used with MIDI */
diff --git a/libs/ardour/ardour/internal_return.h b/libs/ardour/ardour/internal_return.h
index d12b330e37..48fcab151e 100644
--- a/libs/ardour/ardour/internal_return.h
+++ b/libs/ardour/ardour/internal_return.h
@@ -37,7 +37,7 @@ class LIBARDOUR_API InternalReturn : public Return
XMLNode& state (bool full);
XMLNode& get_state ();
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool);
+ void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
bool configure_io (ChanCount, ChanCount);
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h
index 71d8049cae..263c40b90b 100644
--- a/libs/ardour/ardour/internal_send.h
+++ b/libs/ardour/ardour/internal_send.h
@@ -40,7 +40,7 @@ class LIBARDOUR_API InternalSend : public Send
int set_state(const XMLNode& node, int version);
void cycle_start (pframes_t);
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool);
+ void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
bool feeds (boost::shared_ptr<Route> other) const;
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
bool configure_io (ChanCount in, ChanCount out);
diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h
index 5511f64dd6..db0f2c3cf8 100644
--- a/libs/ardour/ardour/io.h
+++ b/libs/ardour/ardour/io.h
@@ -194,7 +194,7 @@ class LIBARDOUR_API IO : public SessionObject, public Latent
/* three utility functions - this just seems to be simplest place to put them */
void collect_input (BufferSet& bufs, pframes_t nframes, ChanCount offset);
- void process_input (boost::shared_ptr<Processor>, framepos_t start_frame, framepos_t end_frame, pframes_t nframes);
+ void process_input (boost::shared_ptr<Processor>, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes);
void copy_to_outputs (BufferSet& bufs, DataType type, pframes_t nframes, framecnt_t offset);
/* AudioTrack::deprecated_use_diskstream_connections() needs these */
diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h
index a2735453a7..15bd74d122 100644
--- a/libs/ardour/ardour/io_processor.h
+++ b/libs/ardour/ardour/io_processor.h
@@ -64,7 +64,7 @@ class LIBARDOUR_API IOProcessor : public Processor
void set_input (boost::shared_ptr<IO>);
void set_output (boost::shared_ptr<IO>);
- void silence (framecnt_t nframes);
+ void silence (framecnt_t nframes, framepos_t start_frame);
void disconnect ();
void increment_port_buffer_offset (pframes_t);
diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h
index 6fd214db68..dbb635fd91 100644
--- a/libs/ardour/ardour/ladspa_plugin.h
+++ b/libs/ardour/ardour/ladspa_plugin.h
@@ -83,6 +83,7 @@ class LIBARDOUR_API LadspaPlugin : public ARDOUR::Plugin
int set_block_size (pframes_t /*nframes*/) { return 0; }
int connect_and_run (BufferSet& bufs,
+ framepos_t start, framepos_t end, double speed,
ChanMapping in, ChanMapping out,
pframes_t nframes, framecnt_t offset);
diff --git a/libs/ardour/ardour/luaproc.h b/libs/ardour/ardour/luaproc.h
index 67c4432087..a92bcdf2f6 100644
--- a/libs/ardour/ardour/luaproc.h
+++ b/libs/ardour/ardour/luaproc.h
@@ -75,6 +75,7 @@ public:
framecnt_t signal_latency() const { return 0; }
int connect_and_run (BufferSet& bufs,
+ framepos_t start, framepos_t end, double speed,
ChanMapping in, ChanMapping out,
pframes_t nframes, framecnt_t offset);
diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h
index 54a1611cb6..9d4e2d1f68 100644
--- a/libs/ardour/ardour/lv2_plugin.h
+++ b/libs/ardour/ardour/lv2_plugin.h
@@ -108,6 +108,7 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
bool requires_fixed_sized_buffers () const;
int connect_and_run (BufferSet& bufs,
+ framepos_t start, framepos_t end, double speed,
ChanMapping in, ChanMapping out,
pframes_t nframes, framecnt_t offset);
diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h
index a3bd34e1b7..ddc1e5e48f 100644
--- a/libs/ardour/ardour/meter.h
+++ b/libs/ardour/ardour/meter.h
@@ -64,7 +64,7 @@ public:
void emit_configuration_changed ();
/** Compute peaks */
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool);
+ void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
void activate () { }
void deactivate () { }
diff --git a/libs/ardour/ardour/monitor_processor.h b/libs/ardour/ardour/monitor_processor.h
index cef12b33d9..d369cb9c28 100644
--- a/libs/ardour/ardour/monitor_processor.h
+++ b/libs/ardour/ardour/monitor_processor.h
@@ -127,7 +127,7 @@ public:
bool display_to_user() const;
- void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t /*nframes*/, bool /*result_required*/);
+ void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t /*nframes*/, bool /*result_required*/);
XMLNode& state (bool full);
int set_state (const XMLNode&, int /* version */);
diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h
index d284c2620d..935b75faea 100644
--- a/libs/ardour/ardour/plugin.h
+++ b/libs/ardour/ardour/plugin.h
@@ -99,8 +99,9 @@ class LIBARDOUR_API Plugin : public PBD::StatefulDestructible, public Latent
virtual bool inplace_broken() const { return false; }
virtual int connect_and_run (BufferSet& bufs,
- ChanMapping in, ChanMapping out,
- pframes_t nframes, framecnt_t offset);
+ framepos_t start, framepos_t end, double speed,
+ ChanMapping in, ChanMapping out,
+ pframes_t nframes, framecnt_t offset);
virtual std::set<Evoral::Parameter> automatable() const = 0;
virtual std::string describe_parameter (Evoral::Parameter) = 0;
diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h
index 2905f012bf..5ec35d0589 100644
--- a/libs/ardour/ardour/plugin_insert.h
+++ b/libs/ardour/ardour/plugin_insert.h
@@ -61,8 +61,8 @@ class LIBARDOUR_API PluginInsert : public Processor
void update_id (PBD::ID);
void set_state_dir (const std::string& d = "");
- void run (BufferSet& in, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool);
- void silence (framecnt_t nframes);
+ void run (BufferSet& in, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
+ void silence (framecnt_t nframes, framepos_t start_frame);
void activate ();
void deactivate ();
@@ -344,8 +344,8 @@ class LIBARDOUR_API PluginInsert : public Processor
PinMappings _out_map;
ChanMapping _thru_map; // out-idx <= in-idx
- void automation_run (BufferSet& bufs, framepos_t start, pframes_t nframes);
- void connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t offset, bool with_auto, framepos_t now = 0);
+ void automation_run (BufferSet& bufs, framepos_t start, framepos_t end, double speed, pframes_t nframes);
+ void connect_and_run (BufferSet& bufs, framepos_t start, framecnt_t end, double speed, pframes_t nframes, framecnt_t offset, bool with_auto);
void bypass (BufferSet& bufs, pframes_t nframes);
void inplace_silence_unconnected (BufferSet&, const PinMappings&, framecnt_t nframes, framecnt_t offset) const;
diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h
index 54d8583d9a..fee1f4694c 100644
--- a/libs/ardour/ardour/port_insert.h
+++ b/libs/ardour/ardour/port_insert.h
@@ -52,7 +52,7 @@ class LIBARDOUR_API PortInsert : public IOProcessor
XMLNode& get_state(void);
int set_state (const XMLNode&, int version);
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool);
+ void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
framecnt_t signal_latency () const;
diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h
index 914ddb904f..c86827c13b 100644
--- a/libs/ardour/ardour/processor.h
+++ b/libs/ardour/ardour/processor.h
@@ -74,8 +74,8 @@ class LIBARDOUR_API Processor : public SessionObject, public Automatable, public
/** @param result_required true if, on return from this method, @a bufs is required to contain valid data;
* if false, the method need not bother writing to @a bufs if it doesn't want to.
*/
- virtual void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t /*nframes*/, bool /*result_required*/) {}
- virtual void silence (framecnt_t /*nframes*/) {}
+ virtual void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double speed, pframes_t /*nframes*/, bool /*result_required*/) {}
+ virtual void silence (framecnt_t /*nframes*/, framepos_t /*start_frame*/) {}
virtual void activate () { _pending_active = true; ActiveChanged(); }
virtual void deactivate () { _pending_active = false; ActiveChanged(); }
diff --git a/libs/ardour/ardour/return.h b/libs/ardour/ardour/return.h
index 1d60a43d38..d42a280ffb 100644
--- a/libs/ardour/ardour/return.h
+++ b/libs/ardour/ardour/return.h
@@ -42,7 +42,7 @@ public:
uint32_t bit_slot() const { return _bitslot; }
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool);
+ void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
boost::shared_ptr<Amp> amp() const { return _amp; }
boost::shared_ptr<PeakMeter> meter() const { return _meter; }
diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h
index 2d6b8ee1b8..f70f09b6ea 100644
--- a/libs/ardour/ardour/send.h
+++ b/libs/ardour/ardour/send.h
@@ -61,7 +61,7 @@ class LIBARDOUR_API Send : public Delivery
uint32_t pans_required() const { return _configured_input.n_audio(); }
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool);
+ void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
bool configure_io (ChanCount in, ChanCount out);
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 0d96777f8c..5ec7e99cea 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -676,8 +676,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
bool synced_to_ltc () const { return config.get_external_sync() && Config->get_sync_source() == LTC && g_atomic_int_get (const_cast<gint*>(&_ltc_active)); }
double transport_speed() const { return _transport_speed; }
- bool transport_stopped() const { return _transport_speed == 0.0f; }
- bool transport_rolling() const { return _transport_speed != 0.0f; }
+ bool transport_stopped() const { return _transport_speed == 0.0; }
+ bool transport_rolling() const { return _transport_speed != 0.0; }
bool silent () { return _silent; }
diff --git a/libs/ardour/ardour/sidechain.h b/libs/ardour/ardour/sidechain.h
index ad92137cea..9d44c3efa2 100644
--- a/libs/ardour/ardour/sidechain.h
+++ b/libs/ardour/ardour/sidechain.h
@@ -34,7 +34,7 @@ public:
SideChain (Session&, const std::string&);
virtual ~SideChain ();
- void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool);
+ void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool);
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
bool configure_io (ChanCount in, ChanCount out);
diff --git a/libs/ardour/ardour/unknown_processor.h b/libs/ardour/ardour/unknown_processor.h
index b9743c9599..170be38042 100644
--- a/libs/ardour/ardour/unknown_processor.h
+++ b/libs/ardour/ardour/unknown_processor.h
@@ -46,7 +46,7 @@ public:
virtual ~UnknownProcessor ();
bool can_support_io_configuration (const ChanCount &, ChanCount &);
- void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t /*nframes*/, bool /*result_required*/);
+ void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t /*nframes*/, bool /*result_required*/);
XMLNode & state (bool);
diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h
index 3440534eb9..2f2bcaae83 100644
--- a/libs/ardour/ardour/vst_plugin.h
+++ b/libs/ardour/ardour/vst_plugin.h
@@ -63,10 +63,11 @@ public:
bool parameter_is_input (uint32_t) const { return true; }
bool parameter_is_output (uint32_t) const { return false; }
- int connect_and_run (
- BufferSet&, ChanMapping in, ChanMapping out,
- pframes_t nframes, framecnt_t offset
- );
+ int connect_and_run (BufferSet&,
+ framepos_t start, framepos_t end, double speed,
+ ChanMapping in, ChanMapping out,
+ pframes_t nframes, framecnt_t offset
+ );
std::string unique_id () const;
const char * label () const;
@@ -89,6 +90,8 @@ public:
PluginInsert* plugin_insert () const { return _pi; }
uint32_t plugin_number () const { return _num; }
VstTimeInfo* timeinfo () { return &_timeInfo; }
+ framepos_t transport_frame () const { return _transport_frame; }
+ float transport_speed () const { return _transport_speed; }
protected:
@@ -112,6 +115,9 @@ protected:
MidiBuffer* _midi_out_buf;
VstTimeInfo _timeInfo;
+
+ framepos_t _transport_frame;
+ float _transport_speed;
};
}
diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc
index 742eb9c778..8c56f90afb 100644
--- a/libs/ardour/audio_track.cc
+++ b/libs/ardour/audio_track.cc
@@ -383,7 +383,7 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
fill_buffers_with_input (bufs, _input, nframes);
if (_meter_point == MeterInput && ((_monitoring_control->monitoring_choice() & MonitorInput) || _diskstream->record_enabled())) {
- _meter->run (bufs, start_frame, end_frame, nframes, true);
+ _meter->run (bufs, start_frame, end_frame, 1.0 /*speed()*/, nframes, true);
}
if ((dret = diskstream->process (bufs, transport_frame, nframes, playback_distance, (monitoring_state() == MonitoringDisk))) != 0) {
diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc
index 70d2853f8c..c31d77256e 100644
--- a/libs/ardour/audio_unit.cc
+++ b/libs/ardour/audio_unit.cc
@@ -448,7 +448,8 @@ AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr<CAC
, audio_input_cnt (0)
, _parameter_listener (0)
, _parameter_listener_arg (0)
- , last_transport_rolling (false)
+ , transport_frame (false)
+ , transport_speed (false)
, last_transport_speed (0.0)
{
if (!preset_search_path_initialized) {
@@ -1584,9 +1585,15 @@ AUPlugin::render_callback(AudioUnitRenderActionFlags*,
}
int
-AUPlugin::connect_and_run (BufferSet& bufs, ChanMapping in_map, ChanMapping out_map, pframes_t nframes, framecnt_t offset)
+AUPlugin::connect_and_run (BufferSet& bufs,
+ framepos_t start, framepos_t end, double speed,
+ ChanMapping in_map, ChanMapping out_map,
+ pframes_t nframes, framecnt_t offset)
{
- Plugin::connect_and_run (bufs, in_map, out_map, nframes, offset);
+ Plugin::connect_and_run(bufs, start, end, speed, in_map, out_map, nframes, offset);
+
+ transport_frame = start;
+ transport_speed = speed;
AudioUnitRenderActionFlags flags = 0;
AudioTimeStamp ts;
@@ -1760,8 +1767,8 @@ AUPlugin::get_beat_and_tempo_callback (Float64* outCurrentBeat,
return kAudioUnitErr_CannotDoInCurrentContext;
}
- TempoMetric metric = tmap.metric_at (_session.transport_frame() + input_offset);
- Timecode::BBT_Time bbt = _session.tempo_map().bbt_at_frame (_session.transport_frame() + input_offset);
+ TempoMetric metric = tmap.metric_at (transport_frame + input_offset);
+ Timecode::BBT_Time bbt = _session.tempo_map().bbt_at_frame (transport_frame + input_offset);
if (outCurrentBeat) {
const double ppq_scaling = metric.meter().note_divisor() / 4.0;
@@ -1799,8 +1806,8 @@ AUPlugin::get_musical_time_location_callback (UInt32* outDeltaSampleOffsetToNe
return kAudioUnitErr_CannotDoInCurrentContext;
}
- TempoMetric metric = tmap.metric_at (_session.transport_frame() + input_offset);
- Timecode::BBT_Time bbt = _session.tempo_map().bbt_at_frame (_session.transport_frame() + input_offset);
+ TempoMetric metric = tmap.metric_at (transport_frame + input_offset);
+ Timecode::BBT_Time bbt = _session.tempo_map().bbt_at_frame (transport_frame + input_offset);
if (outDeltaSampleOffsetToNextBeat) {
if (bbt.ticks == 0) {
@@ -1808,7 +1815,7 @@ AUPlugin::get_musical_time_location_callback (UInt32* outDeltaSampleOffsetToNe
*outDeltaSampleOffsetToNextBeat = 0;
} else {
double const beat_frac_to_next = (Timecode::BBT_Time::ticks_per_beat - bbt.ticks) / Timecode::BBT_Time::ticks_per_beat;
- *outDeltaSampleOffsetToNextBeat = tmap.frame_at_beat (tmap.beat_at_frame (_session.transport_frame() + input_offset) + beat_frac_to_next);
+ *outDeltaSampleOffsetToNextBeat = tmap.frame_at_beat (tmap.beat_at_frame (transport_frame + input_offset) + beat_frac_to_next);
}
}
@@ -1842,22 +1849,20 @@ AUPlugin::get_transport_state_callback (Boolean* outIsPlaying,
Float64* outCycleStartBeat,
Float64* outCycleEndBeat)
{
- bool rolling;
- float speed;
+ const bool rolling = (transport_speed != 0);
+ const bool last_transport_rolling = (last_transport_speed != 0);
DEBUG_TRACE (DEBUG::AudioUnits, "AU calls ardour transport state callback\n");
- rolling = _session.transport_rolling();
- speed = _session.transport_speed ();
if (outIsPlaying) {
- *outIsPlaying = _session.transport_rolling();
+ *outIsPlaying = rolling;
}
if (outTransportStateChanged) {
if (rolling != last_transport_rolling) {
*outTransportStateChanged = true;
- } else if (speed != last_transport_speed) {
+ } else if (transport_speed != last_transport_speed) {
*outTransportStateChanged = true;
} else {
*outTransportStateChanged = false;
@@ -1868,13 +1873,14 @@ AUPlugin::get_transport_state_callback (Boolean* outIsPlaying,
/* this assumes that the AU can only call this host callback from render context,
where input_offset is valid.
*/
- *outCurrentSampleInTimeLine = _session.transport_frame() + input_offset;
+ *outCurrentSampleInTimeLine = transport_frame + input_offset;
}
if (outIsCycling) {
+ // TODO check bounce-processing
Location* loc = _session.locations()->auto_loop_location();
- *outIsCycling = (loc && _session.transport_rolling() && _session.get_play_loop());
+ *outIsCycling = (loc && rolling && _session.get_play_loop());
if (*outIsCycling) {
@@ -1919,8 +1925,7 @@ AUPlugin::get_transport_state_callback (Boolean* outIsPlaying,
}
}
- last_transport_rolling = rolling;
- last_transport_speed = speed;
+ last_transport_speed = transport_speed;
return noErr;
}
diff --git a/libs/ardour/capturing_processor.cc b/libs/ardour/capturing_processor.cc
index ce4a546fb4..755a00c4c4 100644
--- a/libs/ardour/capturing_processor.cc
+++ b/libs/ardour/capturing_processor.cc
@@ -46,7 +46,7 @@ CapturingProcessor::set_block_size (pframes_t nframes)
}
void
-CapturingProcessor::run (BufferSet& bufs, framepos_t, framepos_t, pframes_t nframes, bool)
+CapturingProcessor::run (BufferSet& bufs, framepos_t, framepos_t, double, pframes_t nframes, bool)
{
if (active()) {
capture_buffers.read_from (bufs, nframes);
diff --git a/libs/ardour/delayline.cc b/libs/ardour/delayline.cc
index 26b6ce619e..eda85f0dfd 100644
--- a/libs/ardour/delayline.cc
+++ b/libs/ardour/delayline.cc
@@ -50,7 +50,7 @@ DelayLine::~DelayLine ()
#define FADE_LEN (16)
void
-DelayLine::run (BufferSet& bufs, framepos_t /* start_frame */, framepos_t /* end_frame */, pframes_t nsamples, bool)
+DelayLine::run (BufferSet& bufs, framepos_t /* start_frame */, framepos_t /* end_frame */, double /* speed */, pframes_t nsamples, bool)
{
const uint32_t chn = _configured_output.n_audio();
pframes_t p0 = 0;
diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc
index ed1c89a3e2..565a6740fd 100644
--- a/libs/ardour/delivery.cc
+++ b/libs/ardour/delivery.cc
@@ -229,7 +229,7 @@ Delivery::configure_io (ChanCount in, ChanCount out)
}
void
-Delivery::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool result_required)
+Delivery::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double /*speed*/, pframes_t nframes, bool result_required)
{
assert (_output);
diff --git a/libs/ardour/internal_return.cc b/libs/ardour/internal_return.cc
index 4947231c84..e42c067454 100644
--- a/libs/ardour/internal_return.cc
+++ b/libs/ardour/internal_return.cc
@@ -32,7 +32,7 @@ InternalReturn::InternalReturn (Session& s)
}
void
-InternalReturn::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t nframes, bool)
+InternalReturn::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t nframes, bool)
{
if (!_active && !_pending_active) {
return;
diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc
index 1c42993d4f..0f7d633ba0 100644
--- a/libs/ardour/internal_send.cc
+++ b/libs/ardour/internal_send.cc
@@ -133,7 +133,7 @@ InternalSend::send_to_going_away ()
}
void
-InternalSend::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool)
+InternalSend::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool)
{
if ((!_active && !_pending_active) || !_send_to) {
_meter->reset ();
@@ -213,9 +213,9 @@ InternalSend::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame
_amp->set_gain_automation_buffer (_session.send_gain_automation_buffer ());
_amp->setup_gain_automation (start_frame, end_frame, nframes);
- _amp->run (mixbufs, start_frame, end_frame, nframes, true);
+ _amp->run (mixbufs, start_frame, end_frame, speed, nframes, true);
- _delayline->run (mixbufs, start_frame, end_frame, nframes, true);
+ _delayline->run (mixbufs, start_frame, end_frame, speed, nframes, true);
/* consider metering */
@@ -223,7 +223,7 @@ InternalSend::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame
if (_amp->gain_control()->get_value() == GAIN_COEFF_ZERO) {
_meter->reset();
} else {
- _meter->run (mixbufs, start_frame, end_frame, nframes, true);
+ _meter->run (mixbufs, start_frame, end_frame, speed, nframes, true);
}
}
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 9f880c5b91..6d15d58478 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -1675,7 +1675,7 @@ IO::connected_to (const string& str) const
* Caller must hold process lock.
*/
void
-IO::process_input (boost::shared_ptr<Processor> proc, framepos_t start_frame, framepos_t end_frame, pframes_t nframes)
+IO::process_input (boost::shared_ptr<Processor> proc, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes)
{
/* don't read the data into new buffers - just use the port buffers directly */
@@ -1686,7 +1686,7 @@ IO::process_input (boost::shared_ptr<Processor> proc, framepos_t start_frame, fr
_buffers.get_backend_port_addresses (_ports, nframes);
if (proc) {
- proc->run (_buffers, start_frame, end_frame, nframes, true);
+ proc->run (_buffers, start_frame, end_frame, speed, nframes, true);
}
}
diff --git a/libs/ardour/io_processor.cc b/libs/ardour/io_processor.cc
index 955447a386..3af3d67de4 100644
--- a/libs/ardour/io_processor.cc
+++ b/libs/ardour/io_processor.cc
@@ -240,7 +240,7 @@ IOProcessor::set_state_2X (const XMLNode& node, int version)
}
void
-IOProcessor::silence (framecnt_t nframes)
+IOProcessor::silence (framecnt_t nframes, framepos_t /* start_frame */)
{
if (_own_output && _output) {
_output->silence (nframes);
diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc
index 787079198f..cfff3a5ee6 100644
--- a/libs/ardour/ladspa_plugin.cc
+++ b/libs/ardour/ladspa_plugin.cc
@@ -566,10 +566,11 @@ LadspaPlugin::automatable () const
int
LadspaPlugin::connect_and_run (BufferSet& bufs,
+ framepos_t start, framepos_t end, double speed,
ChanMapping in_map, ChanMapping out_map,
pframes_t nframes, framecnt_t offset)
{
- Plugin::connect_and_run (bufs, in_map, out_map, nframes, offset);
+ Plugin::connect_and_run (bufs, start, end, speed, in_map, out_map, nframes, offset);
cycles_t now;
cycles_t then = get_cycles ();
diff --git a/libs/ardour/luaproc.cc b/libs/ardour/luaproc.cc
index fc899ba4ad..da7be47d21 100644
--- a/libs/ardour/luaproc.cc
+++ b/libs/ardour/luaproc.cc
@@ -613,6 +613,7 @@ LuaProc::configure_io (ChanCount in, ChanCount out)
int
LuaProc::connect_and_run (BufferSet& bufs,
+ framepos_t start, framepos_t end, double speed,
ChanMapping in, ChanMapping out,
pframes_t nframes, framecnt_t offset)
{
@@ -620,7 +621,7 @@ LuaProc::connect_and_run (BufferSet& bufs,
return 0;
}
- Plugin::connect_and_run (bufs, in, out, nframes, offset);
+ Plugin::connect_and_run (bufs, start, end, speed, in, out, nframes, offset);
// This is needed for ARDOUR::Session requests :(
if (! SessionEvent::has_per_thread_pool ()) {
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index ce090a79a4..cd0f9a9467 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -2248,17 +2248,18 @@ write_position(LV2_Atom_Forge* forge,
int
LV2Plugin::connect_and_run(BufferSet& bufs,
- ChanMapping in_map, ChanMapping out_map,
- pframes_t nframes, framecnt_t offset)
+ framepos_t start, framepos_t end, double speed,
+ ChanMapping in_map, ChanMapping out_map,
+ pframes_t nframes, framecnt_t offset)
{
DEBUG_TRACE(DEBUG::LV2, string_compose("%1 run %2 offset %3\n", name(), nframes, offset));
- Plugin::connect_and_run(bufs, in_map, out_map, nframes, offset);
+ Plugin::connect_and_run(bufs, start, end, speed, in_map, out_map, nframes, offset);
cycles_t then = get_cycles();
TempoMap& tmap = _session.tempo_map();
Metrics::const_iterator metric_i = tmap.metrics_end();
- TempoMetric tmetric = tmap.metric_at(_session.transport_frame(), &metric_i);
+ TempoMetric tmetric = tmap.metric_at(start, &metric_i);
if (_freewheel_control_port) {
*_freewheel_control_port = _session.engine().freewheeling() ? 1.f : 0.f;
@@ -2269,7 +2270,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
}
#ifdef LV2_EXTENDED
- if (_can_write_automation && _session.transport_frame() != _next_cycle_start) {
+ if (_can_write_automation && start != _next_cycle_start) {
// add guard-points after locating
for (AutomationCtrlMap::iterator i = _ctrl_map.begin(); i != _ctrl_map.end(); ++i) {
i->second->guard = true;
@@ -2337,13 +2338,12 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
if (valid && (flags & PORT_INPUT)) {
Timecode::BBT_Time bbt;
if ((flags & PORT_POSITION)) {
- if (_session.transport_frame() != _next_cycle_start ||
- _session.transport_speed() != _next_cycle_speed) {
+ if (start != _next_cycle_start ||
+ speed != _next_cycle_speed) {
// Transport has changed, write position at cycle start
- bbt = tmap.bbt_at_frame (_session.transport_frame());
+ bbt = tmap.bbt_at_frame (start);
write_position(&_impl->forge, _ev_buffers[port_index],
- tmetric, bbt, _session.transport_speed(),
- _session.transport_frame(), 0);
+ tmetric, bbt, speed, start, 0);
}
}
@@ -2357,7 +2357,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
// Now merge MIDI and any transport events into the buffer
const uint32_t type = _uri_map.urids.midi_MidiEvent;
- const framepos_t tend = _session.transport_frame() + nframes;
+ const framepos_t tend = end;
++metric_i;
while (m != m_end || (metric_i != tmap.metrics_end() &&
(*metric_i)->frame() < tend)) {
@@ -2374,9 +2374,9 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
tmetric.set_metric(metric);
bbt = tmap.bbt_at_pulse (metric->pulse());
write_position(&_impl->forge, _ev_buffers[port_index],
- tmetric, bbt, _session.transport_speed(),
+ tmetric, bbt, speed,
metric->frame(),
- metric->frame() - _session.transport_frame());
+ metric->frame() - start);
++metric_i;
}
}
@@ -2497,8 +2497,8 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
if (c &&
(c->ac->automation_state() == Touch || c->ac->automation_state() == Write)
) {
- framepos_t when = std::max ((framepos_t) 0, _session.transport_frame() + frames - _current_latency);
- assert (_session.transport_frame() + frames - _current_latency >= 0);
+ framepos_t when = std::max ((framepos_t) 0, start + frames - _current_latency);
+ assert (start + frames - _current_latency >= 0);
if (c->guard) {
c->guard = false;
c->ac->list()->add (when, v, true, true);
@@ -2560,7 +2560,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
AutomationCtrlPtr c = get_automation_control (p);
DEBUG_TRACE(DEBUG::LV2Automate, string_compose ("Start Touch p: %1\n", p));
if (c) {
- c->ac->start_touch (std::max ((framepos_t)0, _session.transport_frame() - _current_latency));
+ c->ac->start_touch (std::max ((framepos_t)0, start - _current_latency));
c->guard = true;
}
}
@@ -2575,7 +2575,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
AutomationCtrlPtr c = get_automation_control (p);
DEBUG_TRACE(DEBUG::LV2Automate, string_compose ("End Touch p: %1\n", p));
if (c) {
- c->ac->stop_touch (true, std::max ((framepos_t)0, _session.transport_frame() - _current_latency));
+ c->ac->stop_touch (true, std::max ((framepos_t)0, start - _current_latency));
}
}
}
@@ -2625,8 +2625,8 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
set_cycles((uint32_t)(now - then));
// Update expected transport information for next cycle so we can detect changes
- _next_cycle_speed = _session.transport_speed();
- _next_cycle_start = _session.transport_frame() + (nframes * _next_cycle_speed);
+ _next_cycle_speed = speed;
+ _next_cycle_start = end;
if (_latency_control_port) {
framecnt_t new_latency = signal_latency ();
diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc
index 72a2f82cb1..bb6e3eb29c 100644
--- a/libs/ardour/meter.cc
+++ b/libs/ardour/meter.cc
@@ -78,7 +78,7 @@ PeakMeter::~PeakMeter ()
* (runs in jack realtime context)
*/
void
-PeakMeter::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t nframes, bool)
+PeakMeter::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t nframes, bool)
{
if (!_active && !_pending_active) {
return;
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc
index 97ddb43f6f..e9efb2fc17 100644
--- a/libs/ardour/midi_track.cc
+++ b/libs/ardour/midi_track.cc
@@ -404,7 +404,7 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
_capture_filter.filter (bufs);
if (_meter_point == MeterInput && ((_monitoring_control->monitoring_choice() & MonitorInput) || _diskstream->record_enabled())) {
- _meter->run (bufs, start_frame, end_frame, nframes, true);
+ _meter->run (bufs, start_frame, end_frame, 1.0 /*speed()*/, nframes, true);
}
diff --git a/libs/ardour/monitor_processor.cc b/libs/ardour/monitor_processor.cc
index e5c58009af..f9bff99c19 100644
--- a/libs/ardour/monitor_processor.cc
+++ b/libs/ardour/monitor_processor.cc
@@ -270,7 +270,7 @@ MonitorProcessor::state (bool full)
}
void
-MonitorProcessor::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t nframes, bool /*result_required*/)
+MonitorProcessor::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t nframes, bool /*result_required*/)
{
uint32_t chn = 0;
gain_t target_gain;
diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc
index 8c1dd81d26..81982c156d 100644
--- a/libs/ardour/plugin.cc
+++ b/libs/ardour/plugin.cc
@@ -329,8 +329,9 @@ Plugin::preset_by_uri (const string& uri)
int
Plugin::connect_and_run (BufferSet& bufs,
- ChanMapping /*in_map*/, ChanMapping /*out_map*/,
- pframes_t /* nframes */, framecnt_t /*offset*/)
+ framepos_t /*start*/, framepos_t /*end*/, double /*speed*/,
+ ChanMapping /*in_map*/, ChanMapping /*out_map*/,
+ pframes_t /* nframes */, framecnt_t /*offset*/)
{
if (bufs.count().n_midi() > 0) {
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index 38c3b684ed..fd595c0d23 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -593,7 +593,7 @@ PluginInsert::inplace_silence_unconnected (BufferSet& bufs, const PinMappings& o
}
void
-PluginInsert::connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t offset, bool with_auto, framepos_t now)
+PluginInsert::connect_and_run (BufferSet& bufs, framepos_t start, framepos_t end, double speed, pframes_t nframes, framecnt_t offset, bool with_auto)
{
// TODO: atomically copy maps & _no_inplace
PinMappings in_map (_in_map);
@@ -661,7 +661,7 @@ PluginInsert::connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t of
if (c->list() && c->automation_playback()) {
bool valid;
- const float val = c->list()->rt_safe_eval (now, valid);
+ const float val = c->list()->rt_safe_eval (start, valid);
if (valid) {
/* This is the ONLY place where we are
@@ -709,7 +709,7 @@ PluginInsert::connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t of
ChanMapping mb_in_map (ChanCount::min (_configured_in, ChanCount (DataType::AUDIO, 2)));
ChanMapping mb_out_map (ChanCount::min (_configured_out, ChanCount (DataType::AUDIO, 2)));
- _plugins.front()->connect_and_run (bufs, mb_in_map, mb_out_map, nframes, offset);
+ _plugins.front()->connect_and_run (bufs, start, end, speed, mb_in_map, mb_out_map, nframes, offset);
for (uint32_t out = _configured_in.n_audio (); out < bufs.count().get (DataType::AUDIO); ++out) {
bufs.get (DataType::AUDIO, out).silence (nframes, offset);
@@ -785,7 +785,7 @@ PluginInsert::connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t of
i_out_map.offset_to (*t, natural_input_streams ().get (*t));
}
- if ((*i)->connect_and_run (inplace_bufs, i_in_map, i_out_map, nframes, offset)) {
+ if ((*i)->connect_and_run (inplace_bufs, start, end, speed, i_in_map, i_out_map, nframes, offset)) {
deactivate ();
}
}
@@ -815,7 +815,7 @@ PluginInsert::connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t of
/* in-place processing */
uint32_t pc = 0;
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i, ++pc) {
- if ((*i)->connect_and_run(bufs, in_map[pc], out_map[pc], nframes, offset)) {
+ if ((*i)->connect_and_run(bufs, start, end, speed, in_map[pc], out_map[pc], nframes, offset)) {
deactivate ();
}
}
@@ -962,7 +962,7 @@ PluginInsert::bypass (BufferSet& bufs, pframes_t nframes)
}
void
-PluginInsert::silence (framecnt_t nframes)
+PluginInsert::silence (framecnt_t nframes, framepos_t start_frame)
{
if (!active ()) {
return;
@@ -976,17 +976,17 @@ PluginInsert::silence (framecnt_t nframes)
#ifdef MIXBUS
if (is_channelstrip ()) {
if (_configured_in.n_audio() > 0) {
- _plugins.front()->connect_and_run (_session.get_scratch_buffers (maxbuf, true), in_map, out_map, nframes, 0);
+ _plugins.front()->connect_and_run (_session.get_scratch_buffers (maxbuf, true), start_frame, start_frame + nframes, 1.0 in_map, out_map, nframes);
}
} else
#endif
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
- (*i)->connect_and_run (_session.get_scratch_buffers (maxbuf, true), in_map, out_map, nframes, 0);
+ (*i)->connect_and_run (_session.get_scratch_buffers (maxbuf, true), start_frame, start_frame + nframes, 1.0, in_map, out_map, nframes, 0);
}
}
void
-PluginInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool)
+PluginInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool)
{
if (_pending_active) {
/* run as normal if we are active or moving from inactive to active */
@@ -994,13 +994,13 @@ PluginInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame
if (_sidechain) {
// collect sidechain input for complete cycle (!)
// TODO we need delaylines here for latency compensation
- _sidechain->run (bufs, start_frame, end_frame, nframes, true);
+ _sidechain->run (bufs, start_frame, end_frame, speed, nframes, true);
}
if (_session.transport_rolling() || _session.bounce_processing()) {
- automation_run (bufs, start_frame, nframes);
+ automation_run (bufs, start_frame, end_frame, speed, nframes);
} else {
- connect_and_run (bufs, nframes, 0, false);
+ connect_and_run (bufs, start_frame, end_frame, speed, nframes, 0, false);
}
} else {
@@ -1016,39 +1016,37 @@ PluginInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame
}
void
-PluginInsert::automation_run (BufferSet& bufs, framepos_t start, pframes_t nframes)
+PluginInsert::automation_run (BufferSet& bufs, framepos_t start, framepos_t end, double speed, pframes_t nframes)
{
Evoral::ControlEvent next_event (0, 0.0f);
- framepos_t now = start;
- framepos_t end = now + nframes;
framecnt_t offset = 0;
Glib::Threads::Mutex::Lock lm (control_lock(), Glib::Threads::TRY_LOCK);
if (!lm.locked()) {
- connect_and_run (bufs, nframes, offset, false);
+ connect_and_run (bufs, start, end, speed, nframes, offset, false);
return;
}
- if (!find_next_event (now, end, next_event) || _plugins.front()->requires_fixed_sized_buffers()) {
+ if (!find_next_event (start, end, next_event) || _plugins.front()->requires_fixed_sized_buffers()) {
/* no events have a time within the relevant range */
- connect_and_run (bufs, nframes, offset, true, now);
+ connect_and_run (bufs, start, end, speed, nframes, offset, true);
return;
}
while (nframes) {
- framecnt_t cnt = min (((framecnt_t) ceil (next_event.when) - now), (framecnt_t) nframes);
+ framecnt_t cnt = min (((framecnt_t) ceil (next_event.when) - start), (framecnt_t) nframes);
- connect_and_run (bufs, cnt, offset, true, now);
+ connect_and_run (bufs, start, start + cnt, speed, cnt, offset, true); // XXX (start + cnt) * speed
nframes -= cnt;
offset += cnt;
- now += cnt;
+ start += cnt;
- if (!find_next_event (now, end, next_event)) {
+ if (!find_next_event (start, end, next_event)) {
break;
}
}
@@ -1056,7 +1054,7 @@ PluginInsert::automation_run (BufferSet& bufs, framepos_t start, pframes_t nfram
/* cleanup anything that is left to do */
if (nframes) {
- connect_and_run (bufs, nframes, offset, true, now);
+ connect_and_run (bufs, start, start + nframes, speed, nframes, offset, true);
}
}
diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc
index 8ec5ead530..d38279c08c 100644
--- a/libs/ardour/port_insert.cc
+++ b/libs/ardour/port_insert.cc
@@ -107,7 +107,7 @@ PortInsert::latency() const
}
void
-PortInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool)
+PortInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool)
{
if (_output->n_ports().n_total() == 0) {
return;
@@ -134,7 +134,7 @@ PortInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
hear the remnants of whatever MTDM pumped into the pipeline.
*/
- silence (nframes);
+ silence (nframes, start_frame);
if (_latency_flush_frames > nframes) {
_latency_flush_frames -= nframes;
@@ -147,11 +147,11 @@ PortInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame,
if (!_active && !_pending_active) {
/* deliver silence */
- silence (nframes);
+ silence (nframes, start_frame);
goto out;
}
- _out->run (bufs, start_frame, end_frame, nframes, true);
+ _out->run (bufs, start_frame, end_frame, speed, nframes, true);
_input->collect_input (bufs, nframes, ChanCount::ZERO);
out:
diff --git a/libs/ardour/return.cc b/libs/ardour/return.cc
index 9c0f19ab03..cb61b0767a 100644
--- a/libs/ardour/return.cc
+++ b/libs/ardour/return.cc
@@ -115,7 +115,7 @@ Return::set_state (const XMLNode& node, int version)
}
void
-Return::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool)
+Return::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool)
{
if ((!_active && !_pending_active) || _input->n_ports() == ChanCount::ZERO) {
return;
@@ -127,13 +127,13 @@ Return::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pfra
// Can't automate gain for sends or returns yet because we need different buffers
// so that we don't overwrite the main automation data for the route amp
// _amp->setup_gain_automation (start_frame, end_frame, nframes);
- _amp->run (bufs, start_frame, end_frame, nframes, true);
+ _amp->run (bufs, start_frame, end_frame, speed, nframes, true);
if (_metering) {
if (_amp->gain_control()->get_value() == 0) {
_meter->reset();
} else {
- _meter->run (bufs, start_frame, end_frame, nframes, true);
+ _meter->run (bufs, start_frame, end_frame, speed, nframes, true);
}
}
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 6209b9f911..15848df31e 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -415,6 +415,7 @@ Route::process_output_buffers (BufferSet& bufs,
bool const meter_already_run = metering_state() == MeteringInput;
framecnt_t latency = 0;
+ const double speed = _session.transport_speed ();
for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) {
@@ -450,7 +451,7 @@ Route::process_output_buffers (BufferSet& bufs,
_initial_delay + latency, longest_session_latency - latency);
}
- (*i)->run (bufs, start_frame - latency, end_frame - latency, nframes, *i != _processors.back());
+ (*i)->run (bufs, start_frame - latency, end_frame - latency, speed, nframes, *i != _processors.back());
bufs.set_count ((*i)->output_streams());
if ((*i)->active ()) {
@@ -478,6 +479,7 @@ Route::bounce_process (BufferSet& buffers, framepos_t start, framecnt_t nframes,
_trim->setup_gain_automation (start, start + nframes, nframes);
latency = 0;
+ const double speed = _session.transport_speed ();
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
if (!include_endpoint && (*i) == endpoint) {
@@ -500,7 +502,7 @@ Route::bounce_process (BufferSet& buffers, framepos_t start, framecnt_t nframes,
*/
if ((*i) == _main_outs) {
assert ((*i)->does_routing());
- (*i)->run (buffers, start - latency, start - latency + nframes, nframes, true);
+ (*i)->run (buffers, start - latency, start - latency + nframes, speed, nframes, true);
buffers.set_count ((*i)->output_streams());
}
@@ -508,7 +510,7 @@ Route::bounce_process (BufferSet& buffers, framepos_t start, framecnt_t nframes,
* Also don't bother with metering.
*/
if (!(*i)->does_routing() && !boost::dynamic_pointer_cast<PeakMeter>(*i)) {
- (*i)->run (buffers, start - latency, start - latency + nframes, nframes, true);
+ (*i)->run (buffers, start - latency, start - latency + nframes, 1.0, nframes, true);
buffers.set_count ((*i)->output_streams());
latency += (*i)->signal_latency ();
}
@@ -2890,6 +2892,8 @@ Route::silence_unlocked (framecnt_t nframes)
{
/* Must be called with the processor lock held */
+ const framepos_t now = _session.transport_frame ();
+
if (!_silent) {
_output->silence (nframes);
@@ -2902,7 +2906,7 @@ Route::silence_unlocked (framecnt_t nframes)
continue;
}
- (*i)->silence (nframes);
+ (*i)->silence (nframes, now);
}
if (nframes == _session.get_block_size()) {
@@ -3432,7 +3436,7 @@ Route::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
fill_buffers_with_input (bufs, _input, nframes);
if (_meter_point == MeterInput) {
- _meter->run (bufs, start_frame, end_frame, nframes, true);
+ _meter->run (bufs, start_frame, end_frame, 0.0, nframes, true);
}
_amp->apply_gain_automation (false);
@@ -3472,7 +3476,7 @@ Route::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, in
fill_buffers_with_input (bufs, _input, nframes);
if (_meter_point == MeterInput) {
- _meter->run (bufs, start_frame, end_frame, nframes, true);
+ _meter->run (bufs, start_frame, end_frame, 1.0, nframes, true);
}
passthru (bufs, start_frame, end_frame, nframes, declick);
diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc
index 8f7afc7c8f..2ad08736df 100644
--- a/libs/ardour/send.cc
+++ b/libs/ardour/send.cc
@@ -159,7 +159,7 @@ Send::set_delay_out(framecnt_t delay)
}
void
-Send::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool)
+Send::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool)
{
if (_output->n_ports() == ChanCount::ZERO) {
_meter->reset ();
@@ -185,13 +185,13 @@ Send::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframe
_amp->set_gain_automation_buffer (_session.send_gain_automation_buffer ());
_amp->setup_gain_automation (start_frame, end_frame, nframes);
- _amp->run (sendbufs, start_frame, end_frame, nframes, true);
+ _amp->run (sendbufs, start_frame, end_frame, speed, nframes, true);
- _delayline->run (sendbufs, start_frame, end_frame, nframes, true);
+ _delayline->run (sendbufs, start_frame, end_frame, speed, nframes, true);
/* deliver to outputs */
- Delivery::run (sendbufs, start_frame, end_frame, nframes, true);
+ Delivery::run (sendbufs, start_frame, end_frame, speed, nframes, true);
/* consider metering */
@@ -199,7 +199,7 @@ Send::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframe
if (_amp->gain_control()->get_value() == 0) {
_meter->reset();
} else {
- _meter->run (*_output_buffers, start_frame, end_frame, nframes, true);
+ _meter->run (*_output_buffers, start_frame, end_frame, speed, nframes, true);
}
}
diff --git a/libs/ardour/session_click.cc b/libs/ardour/session_click.cc
index 872828e57e..969fdabb82 100644
--- a/libs/ardour/session_click.cc
+++ b/libs/ardour/session_click.cc
@@ -133,7 +133,7 @@ Session::click (framepos_t start, framecnt_t nframes)
}
}
- _click_gain->run (bufs, 0, 0, nframes, false);
+ _click_gain->run (bufs, 0, 0, 1.0, nframes, false);
_click_io->copy_to_outputs (bufs, DataType::AUDIO, nframes, 0);
}
diff --git a/libs/ardour/session_vst.cc b/libs/ardour/session_vst.cc
index 3ee5d5889c..4cce5219ac 100644
--- a/libs/ardour/session_vst.cc
+++ b/libs/ardour/session_vst.cc
@@ -200,8 +200,8 @@ intptr_t Session::vst_callback (
timeinfo->nanoSeconds = g_get_monotonic_time () * 1000;
- if (session) {
- framepos_t now = session->transport_frame();
+ if (plug && session) {
+ framepos_t now = plug->transport_frame();
timeinfo->samplePos = now;
timeinfo->sampleRate = session->frame_rate();
@@ -280,7 +280,7 @@ intptr_t Session::vst_callback (
newflags |= kVstTransportRecording;
}
- if (session->transport_speed () != 0.0f) {
+ if (plug->transport_speed () != 0.0f) {
newflags |= kVstTransportPlaying;
}
diff --git a/libs/ardour/sidechain.cc b/libs/ardour/sidechain.cc
index badbd63edf..0ac1e3227b 100644
--- a/libs/ardour/sidechain.cc
+++ b/libs/ardour/sidechain.cc
@@ -61,7 +61,7 @@ SideChain::set_state (const XMLNode& node, int version)
}
void
-SideChain::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool)
+SideChain::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double /*speed*/, pframes_t nframes, bool)
{
if (_input->n_ports () == ChanCount::ZERO) {
// inplace pass-through
diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc
index 75cb689441..0c586e4a0e 100644
--- a/libs/ardour/track.cc
+++ b/libs/ardour/track.cc
@@ -444,10 +444,10 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
if (no_meter) {
BufferSet& bufs (_session.get_silent_buffers (n_process_buffers()));
- _meter->run (bufs, 0, 0, nframes, true);
- _input->process_input (boost::shared_ptr<Processor>(), start_frame, end_frame, nframes);
+ _meter->run (bufs, start_frame, end_frame, 1.0, nframes, true);
+ _input->process_input (boost::shared_ptr<Processor>(), start_frame, end_frame, speed(), nframes);
} else {
- _input->process_input (_meter, start_frame, end_frame, nframes);
+ _input->process_input (_meter, start_frame, end_frame, speed(), nframes);
}
}
@@ -460,7 +460,7 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
fill_buffers_with_input (bufs, _input, nframes);
if (_meter_point == MeterInput) {
- _meter->run (bufs, start_frame, end_frame, nframes, true);
+ _meter->run (bufs, start_frame, end_frame, 1.0 /*speed()*/, nframes, true);
}
passthru (bufs, start_frame, end_frame, nframes, false);
diff --git a/libs/ardour/unknown_processor.cc b/libs/ardour/unknown_processor.cc
index e7f738507d..1f710d4c4c 100644
--- a/libs/ardour/unknown_processor.cc
+++ b/libs/ardour/unknown_processor.cc
@@ -111,7 +111,7 @@ UnknownProcessor::can_support_io_configuration (const ChanCount &in, ChanCount &
}
void
-UnknownProcessor::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t nframes, bool)
+UnknownProcessor::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t nframes, bool)
{
if (!have_ioconfig) {
return;
diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc
index 3b7f9776d0..b517b480b6 100644
--- a/libs/ardour/vst_plugin.cc
+++ b/libs/ardour/vst_plugin.cc
@@ -46,6 +46,8 @@ VSTPlugin::VSTPlugin (AudioEngine& engine, Session& session, VSTHandle* handle)
, _plugin (0)
, _pi (0)
, _num (0)
+ , _transport_frame (0)
+ , _transport_speed (0.f)
{
memset (&_timeInfo, 0, sizeof(_timeInfo));
}
@@ -533,10 +535,14 @@ VSTPlugin::automatable () const
int
VSTPlugin::connect_and_run (BufferSet& bufs,
+ framepos_t start, framepos_t end, double speed,
ChanMapping in_map, ChanMapping out_map,
pframes_t nframes, framecnt_t offset)
{
- Plugin::connect_and_run (bufs, in_map, out_map, nframes, offset);
+ Plugin::connect_and_run(bufs, start, end, speed, in_map, out_map, nframes, offset);
+
+ _transport_frame = start;
+ _transport_speed = speed;
ChanCount bufs_count;
bufs_count.set(DataType::AUDIO, 1);