summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-02-17 01:51:29 +0100
committerRobin Gareus <robin@gareus.org>2019-02-17 01:51:49 +0100
commit2ec28f3ce71faf596161f2210fc334f7521d1e93 (patch)
treec82a10ed7a1b504c902ad5a66bc62763be967aca /libs
parent4ee15fa7b3c0584e01f7978f2c7a99e5df3a6ed3 (diff)
Clean up Latency API (Processor vs Plugin)
Plugins are only a source of Latency (Plugin delay). The API to query, signal and override Latency is managed by PluginInsert.
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/audio_unit.h2
-rw-r--r--libs/ardour/ardour/ladspa_plugin.h2
-rw-r--r--libs/ardour/ardour/latent.h13
-rw-r--r--libs/ardour/ardour/luaproc.h2
-rw-r--r--libs/ardour/ardour/lv2_plugin.h3
-rw-r--r--libs/ardour/ardour/plugin.h8
-rw-r--r--libs/ardour/ardour/vst_plugin.h2
-rw-r--r--libs/ardour/audio_unit.cc2
-rw-r--r--libs/ardour/ladspa_plugin.cc2
-rw-r--r--libs/ardour/latent.cc13
-rw-r--r--libs/ardour/lv2_plugin.cc2
-rw-r--r--libs/ardour/plugin.cc2
-rw-r--r--libs/ardour/vst_plugin.cc2
13 files changed, 41 insertions, 14 deletions
diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h
index 454a7d1ce0..79f75c5ec0 100644
--- a/libs/ardour/ardour/audio_unit.h
+++ b/libs/ardour/ardour/audio_unit.h
@@ -70,7 +70,6 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin
const char * maker () const { return _info->creator.c_str(); }
uint32_t parameter_count () const;
float default_value (uint32_t port);
- samplecnt_t signal_latency() const;
void set_parameter (uint32_t which, float val);
float get_parameter (uint32_t which) const;
@@ -161,6 +160,7 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin
void do_remove_preset (std::string);
private:
+ samplecnt_t plugin_latency() const;
void find_presets ();
boost::shared_ptr<CAComponent> comp;
diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h
index ab2780e879..1557ef1ec3 100644
--- a/libs/ardour/ardour/ladspa_plugin.h
+++ b/libs/ardour/ardour/ladspa_plugin.h
@@ -50,7 +50,6 @@ class LIBARDOUR_API 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) { return _default_value (port); }
- samplecnt_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;
@@ -132,6 +131,7 @@ class LIBARDOUR_API LadspaPlugin : public ARDOUR::Plugin
uint32_t _index;
bool _was_activated;
+ samplecnt_t plugin_latency() const;
void find_presets ();
void init (std::string module_path, uint32_t index, samplecnt_t rate);
diff --git a/libs/ardour/ardour/latent.h b/libs/ardour/ardour/latent.h
index b7d9a3fcd5..194dbe3a72 100644
--- a/libs/ardour/ardour/latent.h
+++ b/libs/ardour/ardour/latent.h
@@ -25,12 +25,18 @@
namespace ARDOUR {
-class LIBARDOUR_API Latent {
+class LIBARDOUR_API HasLatency {
public:
- Latent() : _user_latency (0) {}
+ virtual ~HasLatency() {}
+ virtual samplecnt_t signal_latency() const = 0;
+};
+
+class LIBARDOUR_API Latent : public HasLatency {
+public:
+ Latent ();
+ Latent (Latent const&);
virtual ~Latent() {}
- virtual samplecnt_t signal_latency() const = 0;
/* effective latency to be used while processing */
samplecnt_t effective_latency() const {
@@ -77,6 +83,7 @@ protected:
private:
samplecnt_t _use_user_latency;
samplecnt_t _user_latency;
+
static bool _zero_latency;
};
diff --git a/libs/ardour/ardour/luaproc.h b/libs/ardour/ardour/luaproc.h
index a077254179..d311ebfcf6 100644
--- a/libs/ardour/ardour/luaproc.h
+++ b/libs/ardour/ardour/luaproc.h
@@ -85,7 +85,6 @@ public:
void cleanup () { }
int set_block_size (pframes_t /*nframes*/) { return 0; }
- samplecnt_t signal_latency() const { return _signal_latency; }
int connect_and_run (BufferSet& bufs,
samplepos_t start, samplepos_t end, double speed,
@@ -129,6 +128,7 @@ public:
LuaTableRef* instance_ref () { return &lref; }
private:
+ samplecnt_t plugin_latency() const { return _signal_latency; }
void find_presets ();
/* END Plugin interface */
diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h
index 75d07547ef..e9f6bf0d09 100644
--- a/libs/ardour/ardour/lv2_plugin.h
+++ b/libs/ardour/ardour/lv2_plugin.h
@@ -75,7 +75,6 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
uint32_t parameter_count () const;
float default_value (uint32_t port);
samplecnt_t max_latency () const;
- samplecnt_t signal_latency () const;
void set_parameter (uint32_t port, float val);
float get_parameter (uint32_t port) const;
std::string get_docs() const;
@@ -350,6 +349,8 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
bool _midnam_dirty;
#endif
+ samplecnt_t plugin_latency () const;
+
void latency_compute_run ();
std::string do_save_preset (std::string);
void do_remove_preset (std::string);
diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h
index 4f619e65ba..b8d1cd76c0 100644
--- a/libs/ardour/ardour/plugin.h
+++ b/libs/ardour/ardour/plugin.h
@@ -67,7 +67,7 @@ typedef std::set<uint32_t> PluginOutputConfiguration;
*
* Plugins are not used directly in Ardour but always wrapped by a PluginInsert.
*/
-class LIBARDOUR_API Plugin : public PBD::StatefulDestructible, public Latent
+class LIBARDOUR_API Plugin : public PBD::StatefulDestructible, public HasLatency
{
public:
Plugin (ARDOUR::AudioEngine&, ARDOUR::Session&);
@@ -337,6 +337,10 @@ class LIBARDOUR_API Plugin : public PBD::StatefulDestructible, public Latent
PBD::Signal1<void,uint32_t> StartTouch;
PBD::Signal1<void,uint32_t> EndTouch;
+ samplecnt_t signal_latency () const {
+ return plugin_latency ();
+ }
+
protected:
friend class PluginInsert;
@@ -370,6 +374,8 @@ protected:
private:
+ virtual samplecnt_t plugin_latency () const = 0;
+
/** Fill _presets with our presets */
virtual void find_presets () = 0;
diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h
index 21ac6775ad..3c75c03490 100644
--- a/libs/ardour/ardour/vst_plugin.h
+++ b/libs/ardour/ardour/vst_plugin.h
@@ -61,7 +61,6 @@ public:
bool load_preset (PresetRecord);
int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const;
std::string describe_parameter (Evoral::Parameter);
- samplecnt_t signal_latency() const;
std::set<Evoral::Parameter> automatable() const;
PBD::Signal0<void> LoadPresetProgram;
@@ -119,6 +118,7 @@ protected:
void do_remove_preset (std::string name);
XMLTree * presets_tree () const;
std::string presets_file () const;
+ samplecnt_t plugin_latency() const;
void find_presets ();
VSTHandle* _handle;
diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc
index 31ef2c470e..ad9a245ba6 100644
--- a/libs/ardour/audio_unit.cc
+++ b/libs/ardour/audio_unit.cc
@@ -954,7 +954,7 @@ AUPlugin::default_value (uint32_t port)
}
samplecnt_t
-AUPlugin::signal_latency () const
+AUPlugin::plugin_latency () const
{
guint lat = g_atomic_int_get (&_current_latency);;
if (lat == UINT_MAX) {
diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc
index bb59c6ec55..3782200415 100644
--- a/libs/ardour/ladspa_plugin.cc
+++ b/libs/ardour/ladspa_plugin.cc
@@ -526,7 +526,7 @@ LadspaPlugin::describe_parameter (Evoral::Parameter which)
}
ARDOUR::samplecnt_t
-LadspaPlugin::signal_latency () const
+LadspaPlugin::plugin_latency () const
{
if (_latency_control_port) {
return (samplecnt_t) floor (*_latency_control_port);
diff --git a/libs/ardour/latent.cc b/libs/ardour/latent.cc
index 44ec0e7d30..a2e85f9d5e 100644
--- a/libs/ardour/latent.cc
+++ b/libs/ardour/latent.cc
@@ -24,6 +24,19 @@ using namespace ARDOUR;
bool ARDOUR::Latent::_zero_latency = false;
+Latent::Latent ()
+ : HasLatency ()
+ , _use_user_latency (false)
+ , _user_latency (0)
+{}
+
+Latent::Latent (Latent const& other)
+ : HasLatency ()
+ , _use_user_latency (other._use_user_latency)
+ , _user_latency (other._user_latency)
+{}
+
+
int
Latent::set_state (const XMLNode& node, int version)
{
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index 99841e34d7..2ba1a994d7 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -2380,7 +2380,7 @@ LV2Plugin::max_latency () const
}
samplecnt_t
-LV2Plugin::signal_latency() const
+LV2Plugin::plugin_latency() const
{
if (_latency_control_port) {
return (samplecnt_t)floor(*_latency_control_port);
diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc
index fceb87ee80..49e75e315c 100644
--- a/libs/ardour/plugin.cc
+++ b/libs/ardour/plugin.cc
@@ -102,7 +102,7 @@ Plugin::Plugin (AudioEngine& e, Session& s)
Plugin::Plugin (const Plugin& other)
: StatefulDestructible()
- , Latent()
+ , HasLatency()
, _engine (other._engine)
, _session (other._session)
, _info (other._info)
diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc
index e4968b5158..d7cf0f32ad 100644
--- a/libs/ardour/vst_plugin.cc
+++ b/libs/ardour/vst_plugin.cc
@@ -643,7 +643,7 @@ VSTPlugin::describe_parameter (Evoral::Parameter param)
}
samplecnt_t
-VSTPlugin::signal_latency () const
+VSTPlugin::plugin_latency () const
{
#if ( defined(__x86_64__) || defined(_M_X64) )
return *((int32_t *) (((char *) &_plugin->flags) + 24)); /* initialDelay */