diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-06-13 22:50:54 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-06-13 22:50:54 -0400 |
commit | 80a13145f398e1c4ea22b3f8a25a5b38d3c5e328 (patch) | |
tree | 078d80efe121a30f5898b9bd70c12e92a0f90810 /libs | |
parent | ea1dc499159d80903f07d116bfeb4b92e2f9de6a (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
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/audio_unit.cc | 52 | ||||
-rw-r--r-- | libs/ardour/plugin.cc | 27 | ||||
-rw-r--r-- | libs/ardour/route.cc | 11 |
3 files changed, 38 insertions, 52 deletions
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. |