summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-06-13 22:50:54 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-06-13 22:50:54 -0400
commit80a13145f398e1c4ea22b3f8a25a5b38d3c5e328 (patch)
tree078d80efe121a30f5898b9bd70c12e92a0f90810
parentea1dc499159d80903f07d116bfeb4b92e2f9de6a (diff)
Generalize no-plugin-state from AudioUnits to all plugins
Replace AU_STATE_SUPPORT compile-time define with NO_PLUGIN_STATE and make it prevent plugin state setting, preset loading, preset saving and plugin state saving. Blocks on these actions exist partially in the backend and partially in the GUI (this latter class are not absolute, and should OSC or MIDI be able to drive Plugin::save_preset() the block could be circumvented). Set NO_PLUGIN_STATE if --freebie is used at waf-configure time
-rw-r--r--gtk2_ardour/plugin_ui.cc31
-rw-r--r--libs/ardour/audio_unit.cc52
-rw-r--r--libs/ardour/plugin.cc27
-rw-r--r--libs/ardour/route.cc11
-rw-r--r--wscript9
5 files changed, 74 insertions, 56 deletions
diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc
index 943a7a8bce..9a85b78454 100644
--- a/gtk2_ardour/plugin_ui.cc
+++ b/gtk2_ardour/plugin_ui.cc
@@ -565,9 +565,14 @@ PlugUIBase::preset_selected ()
}
}
+#ifdef NO_PLUGIN_STATE
+static bool seen_saving_message = false;
+#endif
+
void
PlugUIBase::add_plugin_setting ()
{
+#ifndef NO_PLUGIN_STATE
NewPluginPresetDialog d (plugin);
switch (d.run ()) {
@@ -586,23 +591,49 @@ PlugUIBase::add_plugin_setting ()
}
break;
}
+#else
+ if (!seen_saving_message) {
+ info << string_compose (_("Plugin presets are not supported in this build of %1. Consider paying for a full version"),
+ PROGRAM_NAME)
+ << endmsg;
+ seen_saving_message = true;
+ }
+#endif
}
void
PlugUIBase::save_plugin_setting ()
{
+#ifndef NO_PLUGIN_STATE
string const name = _preset_combo.get_active_text ();
plugin->remove_preset (name);
Plugin::PresetRecord const r = plugin->save_preset (name);
if (!r.uri.empty ()) {
plugin->load_preset (r);
}
+#else
+ if (!seen_saving_message) {
+ info << string_compose (_("Plugin presets are not supported in this build of %1. Consider paying for a newer version"),
+ PROGRAM_NAME)
+ << endmsg;
+ seen_saving_message = true;
+ }
+#endif
}
void
PlugUIBase::delete_plugin_setting ()
{
+#ifndef NO_PLUGIN_STATE
plugin->remove_preset (_preset_combo.get_active_text ());
+#else
+ if (!seen_saving_message) {
+ info << string_compose (_("Plugin presets are not supported in this build of %1. Consider paying for a newer version"),
+ PROGRAM_NAME)
+ << endmsg;
+ seen_saving_message = true;
+ }
+#endif
}
bool
diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc
index 399ce8aba7..0e9a11e6df 100644
--- a/libs/ardour/audio_unit.cc
+++ b/libs/ardour/audio_unit.cc
@@ -65,13 +65,6 @@ using namespace std;
using namespace PBD;
using namespace ARDOUR;
-#ifndef AU_STATE_SUPPORT
-static bool seen_get_state_message = false;
-static bool seen_set_state_message = false;
-static bool seen_loading_message = false;
-static bool seen_saving_message = false;
-#endif
-
AUPluginInfo::CachedInfoMap AUPluginInfo::cached_info;
static string preset_search_path = "/Library/Audio/Presets:/Network/Library/Audio/Presets";
@@ -1679,8 +1672,6 @@ void
AUPlugin::add_state (XMLNode* root) const
{
LocaleGuard lg (X_("POSIX"));
-
-#ifdef AU_STATE_SUPPORT
CFDataRef xmlData;
CFPropertyListRef propertyList;
@@ -1712,20 +1703,11 @@ AUPlugin::add_state (XMLNode* root) const
CFRelease (xmlData);
CFRelease (propertyList);
-#else
- if (!seen_get_state_message) {
- info << string_compose (_("Saving AudioUnit settings is not supported in this build of %1. Consider paying for a newer version"),
- PROGRAM_NAME)
- << endmsg;
- seen_get_state_message = true;
- }
-#endif
}
int
AUPlugin::set_state(const XMLNode& node, int version)
{
-#ifdef AU_STATE_SUPPORT
int ret = -1;
CFPropertyListRef propertyList;
LocaleGuard lg (X_("POSIX"));
@@ -1773,14 +1755,6 @@ AUPlugin::set_state(const XMLNode& node, int version)
Plugin::set_state (node, version);
return ret;
-#else
- if (!seen_set_state_message) {
- info << string_compose (_("Restoring AudioUnit settings is not supported in this build of %1. Consider paying for a newer version"),
- PROGRAM_NAME)
- << endmsg;
- }
- return Plugin::set_state (node, version);
-#endif
}
bool
@@ -1788,7 +1762,6 @@ AUPlugin::load_preset (PresetRecord r)
{
Plugin::load_preset (r);
-#ifdef AU_STATE_SUPPORT
bool ret = false;
CFPropertyListRef propertyList;
Glib::ustring path;
@@ -1836,15 +1809,6 @@ AUPlugin::load_preset (PresetRecord r)
}
return ret;
-#else
- if (!seen_loading_message) {
- info << string_compose (_("Loading AudioUnit presets is not supported in this build of %1. Consider paying for a newer version"),
- PROGRAM_NAME)
- << endmsg;
- seen_loading_message = true;
- }
- return true;
-#endif
}
void
@@ -1855,7 +1819,6 @@ AUPlugin::do_remove_preset (std::string)
string
AUPlugin::do_save_preset (string preset_name)
{
-#ifdef AU_STATE_SUPPORT
CFPropertyListRef propertyList;
vector<Glib::ustring> v;
Glib::ustring user_preset_path;
@@ -1904,15 +1867,6 @@ AUPlugin::do_save_preset (string preset_name)
CFRelease(propertyList);
return string ("file:///") + user_preset_path;
-#else
- if (!seen_saving_message) {
- info << string_compose (_("Saving AudioUnit presets is not supported in this build of %1. Consider paying for a newer version"),
- PROGRAM_NAME)
- << endmsg;
- seen_saving_message = true;
- }
- return string();
-#endif
}
//-----------------------------------------------------------------------------
@@ -2079,7 +2033,6 @@ AUPlugin::current_preset() const
{
string preset_name;
-#ifdef AU_STATE_SUPPORT
CFPropertyListRef propertyList;
DEBUG_TRACE (DEBUG::AudioUnits, "get current preset for current_preset()\n");
@@ -2087,14 +2040,13 @@ AUPlugin::current_preset() const
preset_name = get_preset_name_in_plist (propertyList);
CFRelease(propertyList);
}
-#endif
+
return preset_name;
}
void
AUPlugin::find_presets ()
{
-#ifdef AU_STATE_SUPPORT
vector<string*>* preset_files;
PathScanner scanner;
@@ -2143,8 +2095,6 @@ AUPlugin::find_presets ()
string const uri = string_compose ("%1", _presets.size ());
_presets.insert (make_pair (uri, Plugin::PresetRecord (uri, i->first, i->second)));
}
-
-#endif
}
bool
diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc
index 57198475d7..e76353e8d5 100644
--- a/libs/ardour/plugin.cc
+++ b/libs/ardour/plugin.cc
@@ -68,6 +68,11 @@ using namespace PBD;
namespace ARDOUR { class AudioEngine; }
+#ifdef NO_PLUGIN_STATE
+static bool seen_get_state_message = false;
+static bool seen_set_state_message = false;
+#endif
+
bool
PluginInfo::is_instrument () const
{
@@ -299,18 +304,28 @@ Plugin::resolve_midi ()
_have_pending_stop_events = true;
}
+
vector<Plugin::PresetRecord>
Plugin::get_presets ()
{
+ vector<PresetRecord> p;
+
+#ifndef NO_PLUGIN_STATE
if (!_have_presets) {
find_presets ();
_have_presets = true;
}
- vector<PresetRecord> p;
for (map<string, PresetRecord>::const_iterator i = _presets.begin(); i != _presets.end(); ++i) {
p.push_back (i->second);
}
+#else
+ if (!seen_set_state_message) {
+ info << string_compose (_("Plugin presets are not supported in this build of %1. Consider paying for a full version"),
+ PROGRAM_NAME)
+ << endmsg;
+ }
+#endif
return p;
}
@@ -376,7 +391,17 @@ Plugin::get_state ()
root->add_property (X_("last-preset-label"), _last_preset.label);
root->add_property (X_("parameter-changed-since-last-preset"), _parameter_changed_since_last_preset ? X_("yes") : X_("no"));
+#ifndef NO_PLUGIN_STATE
add_state (root);
+#else
+ if (!seen_get_state_message) {
+ info << string_compose (_("Saving AudioUnit settings is not supported in this build of %1. Consider paying for a newer version"),
+ PROGRAM_NAME)
+ << endmsg;
+ seen_get_state_message = true;
+ }
+#endif
+
return *root;
}
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 29e778e415..e84e8b6d93 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -2551,10 +2551,21 @@ Route::set_processor_state (const XMLNode& node)
continue;
}
+#ifndef NO_PLUGIN_STATE
if (processor->set_state (**niter, Stateful::current_state_version) != 0) {
/* This processor could not be configured. Turn it into a UnknownProcessor */
processor.reset (new UnknownProcessor (_session, **niter));
}
+#else
+ if (boost::dynamic_pointer_cast<PluginInsert>(processor)) {
+ if (processor->set_state (**niter, Stateful::current_state_version) != 0) {
+ /* This processor could not be configured. Turn it into a UnknownProcessor */
+ processor.reset (new UnknownProcessor (_session, **niter));
+ }
+ } else {
+ /* plugin, but ::set_state() not * allowed no message here - things will get too verbose */
+ }
+#endif
/* we have to note the monitor send here, otherwise a new one will be created
and the state of this one will be lost.
diff --git a/wscript b/wscript
index 64e8f29102..6c5ea19d64 100644
--- a/wscript
+++ b/wscript
@@ -513,6 +513,10 @@ def configure(conf):
else:
autowaf.display_msg(conf, 'Will build against private Ardour dependency stack', 'no')
+ if Options.options.freebie:
+ conf.env.append_value ('CFLAGS', '-DNO_PLUGIN_STATE')
+ conf.env.append_value ('CXXFLAGS', '-DNO_PLUGIN_STATE')
+
if sys.platform == 'darwin':
# this is required, potentially, for anything we link and then relocate into a bundle
@@ -521,9 +525,6 @@ def configure(conf):
conf.define ('HAVE_COREAUDIO', 1)
conf.define ('AUDIOUNIT_SUPPORT', 1)
- if not Options.options.freebie:
- conf.define ('AU_STATE_SUPPORT', 1)
-
conf.define ('GTKOSX', 1)
conf.define ('TOP_MENUBAR',1)
conf.define ('GTKOSX',1)
@@ -563,7 +564,7 @@ def configure(conf):
conf.env.append_value('LINKFLAGS_AUDIOUNITS', ['-framework', 'Cocoa'])
if not Options.options.freebie:
- conf.env.append_value('CXXFLAGS_AUDIOUNITS', "-DAU_STATE_SUPPORT")
+ conf.env.append_value('CXXFLAGS_AUDIOUNITS')
if re.search ("^[1-9][0-9]\.", os.uname()[2]) == None and not Options.options.nocarbon:
conf.env.append_value('CXXFLAGS_AUDIOUNITS', "-DWITH_CARBON")