From b5af3bb8e313e13166cc54c60a14e5492e674065 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 27 Jun 2007 22:06:35 +0000 Subject: allow user tweaking of everything that might have inherent latency; add GUI for track level adjustment and widget that can be (but is not yet) embedded in a plugin GUI git-svn-id: svn://localhost/ardour2/trunk@2075 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/audio_unit.h | 2 +- libs/ardour/ardour/audioengine.h | 1 + libs/ardour/ardour/io.h | 9 +++++++-- libs/ardour/ardour/ladspa_plugin.h | 2 +- libs/ardour/ardour/latent.h | 26 ++++++++++++++++++++++++++ libs/ardour/ardour/plugin.h | 4 ++-- libs/ardour/ardour/plugin_insert.h | 2 +- libs/ardour/ardour/port_insert.h | 2 +- libs/ardour/ardour/processor.h | 6 +++--- libs/ardour/ardour/route.h | 8 +++++--- libs/ardour/ardour/vst_plugin.h | 2 +- 11 files changed, 49 insertions(+), 15 deletions(-) create mode 100644 libs/ardour/ardour/latent.h (limited to 'libs/ardour/ardour') diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index 88591ab845..7b31b1937f 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -54,7 +54,7 @@ class AUPlugin : public ARDOUR::Plugin const char * maker () const; uint32_t parameter_count () const; float default_value (uint32_t port); - nframes_t latency () const; + nframes_t signal_latency () const; void set_parameter (uint32_t which, float val); float get_parameter (uint32_t which) const; diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index fca3c2df9a..cb5a6d72ce 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -139,6 +139,7 @@ class AudioEngine : public sigc::trackable nframes_t get_port_total_latency (const Port&); void update_total_latencies (); + void update_total_latency (const Port&); /** Caller may not delete the object pointed to by the return value */ diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 1592ac7cac..fc49f0699f 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -41,6 +41,7 @@ #include #include #include +#include using std::string; using std::vector; @@ -64,7 +65,8 @@ class BufferSet; * An IO can contain ports of varying types, making routes/inserts/etc with * varied combinations of types (eg MIDI and audio) possible. */ -class IO : public Automatable + +class IO : public Automatable, public Latent { public: static const string state_node_name; @@ -141,9 +143,12 @@ class IO : public Automatable int disconnect_inputs (void *src); int disconnect_outputs (void *src); + nframes_t signal_latency() const { return _own_latency; } nframes_t output_latency() const; nframes_t input_latency() const; - void set_port_latency (nframes_t); + void set_port_latency (nframes_t); + + void update_port_total_latencies (); const PortSet& inputs() const { return _inputs; } const PortSet& outputs() const { return _outputs; } diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index 5c15632391..ba51f551c7 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -59,7 +59,7 @@ class LadspaPlugin : public ARDOUR::Plugin const char * maker() const { return descriptor->Maker; } uint32_t parameter_count() const { return descriptor->PortCount; } float default_value (uint32_t port); - nframes_t latency() const; + nframes_t signal_latency() const; void set_parameter (uint32_t port, float val); float get_parameter (uint32_t port) const; int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const; diff --git a/libs/ardour/ardour/latent.h b/libs/ardour/ardour/latent.h new file mode 100644 index 0000000000..11bdf11370 --- /dev/null +++ b/libs/ardour/ardour/latent.h @@ -0,0 +1,26 @@ +#ifndef __ardour_latent_h__ +#define __ardour_latent_h__ + +#include + +namespace ARDOUR { + +class Latent { + public: + Latent() : _own_latency (0), _user_latency (0) {} + virtual ~Latent() {} + + virtual nframes_t signal_latency() const = 0; + nframes_t user_latency () const { return _user_latency; } + + virtual void set_latency_delay (nframes_t val) { _own_latency = val; } + virtual void set_user_latency (nframes_t val) { _user_latency = val; } + + protected: + nframes_t _own_latency; + nframes_t _user_latency; +}; + +} + +#endif /* __ardour_latent_h__*/ diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index 22c0862202..00c31720a7 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -79,7 +80,7 @@ class PluginInfo { typedef boost::shared_ptr PluginInfoPtr; typedef std::list PluginInfoList; -class Plugin : public PBD::StatefulDestructible +class Plugin : public PBD::StatefulDestructible, public Latent { public: Plugin (ARDOUR::AudioEngine&, ARDOUR::Session&); @@ -110,7 +111,6 @@ class Plugin : public PBD::StatefulDestructible virtual const char * maker() const = 0; virtual uint32_t parameter_count () const = 0; virtual float default_value (uint32_t port) = 0; - virtual nframes_t latency() const = 0; virtual void set_parameter (uint32_t which, float val) = 0; virtual float get_parameter(uint32_t which) const = 0; diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index ea8f78b62f..e3b1b62b19 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -92,7 +92,7 @@ class PluginInsert : public Processor string describe_parameter (ParamID param); - nframes_t latency(); + nframes_t signal_latency() const; void transport_stopped (nframes_t now); void automation_snapshot (nframes_t now); diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h index 1f366ae259..619e2e5bd2 100644 --- a/libs/ardour/ardour/port_insert.h +++ b/libs/ardour/ardour/port_insert.h @@ -54,7 +54,7 @@ class PortInsert : public IOProcessor void run (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset); - nframes_t latency(); + nframes_t signal_latency() const; ChanCount output_streams() const; ChanCount input_streams() const; diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index 7d126e8e0c..3985306d01 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -33,7 +33,7 @@ #include #include #include - +#include class XMLNode; @@ -43,7 +43,7 @@ class Session; /* A mixer strip element - plugin, send, meter, etc. */ -class Processor : public Automatable +class Processor : public Automatable, public Latent { public: static const string state_node_name; @@ -66,7 +66,7 @@ class Processor : public Automatable bool get_next_ab_is_active () const { return _next_ab_is_active; } void set_next_ab_is_active (bool yn) { _next_ab_is_active = yn; } - virtual nframes_t latency() { return 0; } + virtual nframes_t signal_latency() const { return 0; } virtual void transport_stopped (nframes_t frame) {} diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 008d8ffcbb..b8c9431e42 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -187,8 +187,9 @@ class Route : public IO void all_processors_active (Placement, bool state); virtual nframes_t update_total_latency(); - nframes_t signal_latency() const { return _own_latency; } - virtual void set_latency_delay (nframes_t); + void set_latency_delay (nframes_t); + void set_user_latency (nframes_t); + nframes_t initial_delay() const { return _initial_delay; } sigc::signal solo_changed; sigc::signal solo_safe_changed; @@ -204,6 +205,8 @@ class Route : public IO sigc::signal mix_group_changed; sigc::signal active_changed; sigc::signal meter_change; + sigc::signal signal_latency_changed; + sigc::signal initial_delay_changed; /* gui's call this for their own purposes. */ @@ -294,7 +297,6 @@ class Route : public IO nframes_t _initial_delay; nframes_t _roll_delay; - nframes_t _own_latency; ProcessorList _processors; Glib::RWLock _processor_lock; IO *_control_outs; diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index ffcb999183..1622df0c1a 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -62,7 +62,7 @@ class VSTPlugin : public ARDOUR::Plugin const char * maker() const; uint32_t parameter_count() const; float default_value (uint32_t port); - nframes_t latency() const; + nframes_t signal_latency() const; void set_parameter (uint32_t port, float val); float get_parameter (uint32_t port) const; int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const; -- cgit v1.2.3