summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r--libs/ardour/ardour/audio_unit.h5
-rw-r--r--libs/ardour/ardour/ladspa_plugin.h7
-rw-r--r--libs/ardour/ardour/lv2_plugin.h9
-rw-r--r--libs/ardour/ardour/plugin.h60
-rw-r--r--libs/ardour/ardour/vst_plugin.h10
5 files changed, 63 insertions, 28 deletions
diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h
index b00c23b1dc..abbfdbea3d 100644
--- a/libs/ardour/ardour/audio_unit.h
+++ b/libs/ardour/ardour/audio_unit.h
@@ -95,12 +95,10 @@ class AUPlugin : public ARDOUR::Plugin
bool parameter_is_input (uint32_t) const;
bool parameter_is_output (uint32_t) const;
- XMLNode& get_state();
int set_state(const XMLNode& node, int);
bool save_preset (std::string name);
bool load_preset (const std::string& preset_label);
- std::vector<PresetRecord> get_presets ();
std::string current_preset() const;
bool has_editor () const;
@@ -143,6 +141,8 @@ class AUPlugin : public ARDOUR::Plugin
static std::string maybe_fix_broken_au_id (const std::string&);
private:
+ void find_presets ();
+
boost::shared_ptr<CAComponent> comp;
boost::shared_ptr<CAAudioUnit> unit;
@@ -178,6 +178,7 @@ class AUPlugin : public ARDOUR::Plugin
int set_input_format (AudioStreamBasicDescription&);
int set_stream_format (int scope, uint32_t cnt, AudioStreamBasicDescription&);
void discover_parameters ();
+ void add_state (XMLNode *) const;
std::vector<std::pair<uint32_t, uint32_t> > parameter_map;
uint32_t current_maxbuf;
diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h
index 7d561dd0a8..457921cf36 100644
--- a/libs/ardour/ardour/ladspa_plugin.h
+++ b/libs/ardour/ardour/ladspa_plugin.h
@@ -97,11 +97,9 @@ class LadspaPlugin : public ARDOUR::Plugin
bool parameter_is_output(uint32_t) const;
bool parameter_is_toggled(uint32_t) const;
- XMLNode& get_state();
int set_state (const XMLNode&, int version);
- std::vector<PresetRecord> get_presets ();
- bool load_preset (const std::string& uri);
+ bool load_preset (PresetRecord);
bool has_editor() const { return false; }
@@ -131,6 +129,8 @@ class LadspaPlugin : public ARDOUR::Plugin
uint32_t _index;
bool _was_activated;
+ void find_presets ();
+
void init (void *mod, uint32_t index, framecnt_t rate);
void run_in_place (pframes_t nsamples);
void latency_compute_run ();
@@ -140,6 +140,7 @@ class LadspaPlugin : public ARDOUR::Plugin
std::string preset_envvar () const;
std::string preset_source (std::string) const;
bool write_preset_file (std::string);
+ void add_state (XMLNode *) const;
};
class LadspaPluginInfo : public PluginInfo {
diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h
index c2b9ebc7bb..0920a01e6d 100644
--- a/libs/ardour/ardour/lv2_plugin.h
+++ b/libs/ardour/ardour/lv2_plugin.h
@@ -66,7 +66,7 @@ class LV2Plugin : public ARDOUR::Plugin
bool is_external_ui() const;
SLV2Port slv2_port(uint32_t i) { return slv2_plugin_get_port_by_index(_plugin, i); }
- const char* port_symbol(uint32_t port);
+ const char* port_symbol (uint32_t port) const;
const LV2_Feature* const* features() { return _features; }
@@ -112,12 +112,11 @@ class LV2Plugin : public ARDOUR::Plugin
static uint32_t midi_event_type() { return _midi_event_type; }
- XMLNode& get_state();
int set_state(const XMLNode& node, int version);
bool save_preset (std::string uri);
void remove_preset (std::string uri);
- bool load_preset (const std::string& uri);
- virtual std::vector<Plugin::PresetRecord> get_presets();
+ bool load_preset (PresetRecord);
+ std::string current_preset () const;
bool has_editor() const;
@@ -167,6 +166,8 @@ class LV2Plugin : public ARDOUR::Plugin
void latency_compute_run ();
std::string do_save_preset (std::string);
void do_remove_preset (std::string);
+ void find_presets ();
+ void add_state (XMLNode *) const;
};
diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h
index ad002a926d..00ed6bdc94 100644
--- a/libs/ardour/ardour/plugin.h
+++ b/libs/ardour/ardour/plugin.h
@@ -99,6 +99,9 @@ class Plugin : public PBD::StatefulDestructible, public Latent
bool max_unbound;
};
+ XMLNode& get_state ();
+ virtual int set_state (const XMLNode &, int version);
+
virtual std::string unique_id() const = 0;
virtual const char * label() const = 0;
virtual const char * name() const = 0;
@@ -131,23 +134,40 @@ class Plugin : public PBD::StatefulDestructible, public Latent
void realtime_handle_transport_stopped ();
- bool save_preset (std::string);
- void remove_preset (std::string);
- virtual bool load_preset (const std::string& uri) = 0;
-
struct PresetRecord {
- PresetRecord (const std::string& u, const std::string& l) : uri(u), label(l) {}
+ PresetRecord () : user (true) {}
+ PresetRecord (const std::string& u, const std::string& l, bool s = true) : uri (u), label (l), user (s) {}
+
+ bool operator!= (PresetRecord const & a) const {
+ return uri != a.uri || label != a.label;
+ }
+
std::string uri;
std::string label;
+ bool user;
};
+ PresetRecord save_preset (std::string);
+ void remove_preset (std::string);
+
+ virtual bool load_preset (PresetRecord);
+
const PresetRecord * preset_by_label (const std::string &);
const PresetRecord * preset_by_uri (const std::string &);
- /** Return this plugin's presets; should add them to _presets */
- virtual std::vector<PresetRecord> get_presets () = 0;
- virtual std::string current_preset () const { return std::string(); }
+ std::vector<PresetRecord> get_presets ();
+ /** @return Last preset to be requested; the settings may have
+ * been changed since; find out with parameter_changed_since_last_preset.
+ */
+ PresetRecord last_preset () const {
+ return _last_preset;
+ }
+
+ bool parameter_changed_since_last_preset () const {
+ return _parameter_changed_since_last_preset;
+ }
+
virtual int first_user_preset_index () const {
return 0;
}
@@ -155,13 +175,14 @@ class Plugin : public PBD::StatefulDestructible, public Latent
/** Emitted when a preset is added or removed, respectively */
PBD::Signal0<void> PresetAdded;
PBD::Signal0<void> PresetRemoved;
-
- /* XXX: no-one listens to this */
- static PBD::Signal0<bool> PresetFileExists;
- virtual bool has_editor() const = 0;
+ /** Emitted when a preset has been loaded */
+ PBD::Signal0<void> PresetLoaded;
+
+ virtual bool has_editor () const = 0;
- PBD::Signal2<void,uint32_t,float> ParameterChanged;
+ /** Emitted when any parameter changes */
+ PBD::Signal2<void, uint32_t, float> ParameterChanged;
/* NOTE: this block of virtual methods looks like the interface
to a Processor, but Plugin does not inherit from Processor.
@@ -199,7 +220,7 @@ protected:
friend class PluginInsert;
friend struct PluginInsert::PluginControl;
- virtual void set_parameter (uint32_t which, float val) = 0;
+ virtual void set_parameter (uint32_t which, float val);
/** Do the actual saving of the current plugin settings to a preset of the provided name.
* Should return a URI on success, or an empty string on failure.
@@ -215,10 +236,19 @@ protected:
std::map<std::string, PresetRecord> _presets;
private:
-
+
+ /** Fill _presets with our presets */
+ virtual void find_presets () = 0;
+
+ /** Add state to an existing XMLNode */
+ virtual void add_state (XMLNode *) const = 0;
+
+ bool _have_presets;
MidiStateTracker _tracker;
BufferSet _pending_stop_events;
bool _have_pending_stop_events;
+ PresetRecord _last_preset;
+ bool _parameter_changed_since_last_preset;
};
PluginPtr find_plugin(ARDOUR::Session&, std::string unique_id, ARDOUR::PluginType);
diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h
index e9a2c4abdf..83bf58c4ac 100644
--- a/libs/ardour/ardour/vst_plugin.h
+++ b/libs/ardour/ardour/vst_plugin.h
@@ -78,13 +78,11 @@ class VSTPlugin : public ARDOUR::Plugin
bool parameter_is_input(uint32_t i) const { return true; }
bool parameter_is_output(uint32_t i) const { return false; }
- bool load_preset (const std::string& preset_label);
- virtual std::vector<PresetRecord> get_presets ();
+ bool load_preset (PresetRecord);
int first_user_preset_index () const;
bool has_editor () const;
- XMLNode& get_state();
int set_state (XMLNode const &, int);
AEffect * plugin () const { return _plugin; }
@@ -94,10 +92,14 @@ private:
void do_remove_preset (std::string name);
std::string do_save_preset (std::string name);
- gchar* get_chunk (bool);
+ gchar* get_chunk (bool) const;
int set_chunk (gchar const *, bool);
XMLTree * presets_tree () const;
std::string presets_file () const;
+ void find_presets ();
+ bool load_user_preset (PresetRecord);
+ bool load_plugin_preset (PresetRecord);
+ void add_state (XMLNode *) const;
FSTHandle* handle;
FST* _fst;