mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-11 07:56:27 +01:00
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.
This commit is contained in:
parent
4ee15fa7b3
commit
2ec28f3ce7
13 changed files with 41 additions and 14 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue