From e9a8ccc7e2826d8fe91eff34ee8a0683a7f7aac6 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 25 Jun 2016 02:23:56 +0200 Subject: 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. --- libs/ardour/ardour/amp.h | 2 +- libs/ardour/ardour/audio_unit.h | 7 +++++-- libs/ardour/ardour/capturing_processor.h | 2 +- libs/ardour/ardour/delayline.h | 2 +- libs/ardour/ardour/delivery.h | 2 +- libs/ardour/ardour/internal_return.h | 2 +- libs/ardour/ardour/internal_send.h | 2 +- libs/ardour/ardour/io.h | 2 +- libs/ardour/ardour/io_processor.h | 2 +- libs/ardour/ardour/ladspa_plugin.h | 1 + libs/ardour/ardour/luaproc.h | 1 + libs/ardour/ardour/lv2_plugin.h | 1 + libs/ardour/ardour/meter.h | 2 +- libs/ardour/ardour/monitor_processor.h | 2 +- libs/ardour/ardour/plugin.h | 5 +++-- libs/ardour/ardour/plugin_insert.h | 8 ++++---- libs/ardour/ardour/port_insert.h | 2 +- libs/ardour/ardour/processor.h | 4 ++-- libs/ardour/ardour/return.h | 2 +- libs/ardour/ardour/send.h | 2 +- libs/ardour/ardour/session.h | 4 ++-- libs/ardour/ardour/sidechain.h | 2 +- libs/ardour/ardour/unknown_processor.h | 2 +- libs/ardour/ardour/vst_plugin.h | 14 ++++++++++---- 24 files changed, 44 insertions(+), 31 deletions(-) (limited to 'libs/ardour/ardour') 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 > 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 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, framepos_t start_frame, framepos_t end_frame, pframes_t nframes); + void process_input (boost::shared_ptr, 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); void set_output (boost::shared_ptr); - 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 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() const { return _amp; } boost::shared_ptr 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(&_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; }; } -- cgit v1.2.3