#include "pbd/xml++.h"
#include "pbd/convert.h"
#include "pbd/whitespace.h"
-#include "pbd/pathscanner.h"
+#include "pbd/file_utils.h"
#include "pbd/locale_guard.h"
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
+#include <glib/gstdio.h>
#include "ardour/ardour.h"
#include "ardour/audioengine.h"
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";
return;
}
+ if (get_parameter(which) == val) {
+ return;
+ }
+
const AUParameterDescriptor& d (descriptors[which]);
DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("set parameter %1 in scope %2 element %3 to %4\n", d.id, d.scope, d.element, val));
unit->SetParameter (d.id, d.scope, d.element, val);
}
bool
-AUPlugin::can_support_io_configuration (const ChanCount& in, ChanCount& out) const
+AUPlugin::can_support_io_configuration (const ChanCount& in, ChanCount& out)
{
// Note: We never attempt to multiply-instantiate plugins to meet io configurations.
{
/* not much to do with audio - the data is already in the buffers given to us in connect_and_run() */
- DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1: render callback, frames %2 bufs %3\n",
- name(), inNumberFrames, ioData->mNumberBuffers));
+ // DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1: render callback, frames %2 bufs %3\n",
+ // name(), inNumberFrames, ioData->mNumberBuffers));
if (input_maxbuf == 0) {
error << _("AUPlugin: render callback called illegally!") << endmsg;
AUPlugin::add_state (XMLNode* root) const
{
LocaleGuard lg (X_("POSIX"));
-
-#ifdef AU_STATE_SUPPORT
CFDataRef xmlData;
CFPropertyListRef propertyList;
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"));
return -1;
}
+#ifndef NO_PLUGIN_STATE
if (node.children().empty()) {
return -1;
}
}
CFRelease (propertyList);
}
+#endif
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
{
Plugin::load_preset (r);
-#ifdef AU_STATE_SUPPORT
bool ret = false;
CFPropertyListRef propertyList;
Glib::ustring path;
}
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
string
AUPlugin::do_save_preset (string preset_name)
{
-#ifdef AU_STATE_SUPPORT
CFPropertyListRef propertyList;
vector<Glib::ustring> v;
Glib::ustring user_preset_path;
- bool ret = true;
std::string m = maker();
std::string n = name();
if (g_mkdir_with_parents (user_preset_path.c_str(), 0775) < 0) {
error << string_compose (_("Cannot create user plugin presets folder (%1)"), user_preset_path) << endmsg;
- return false;
+ return string();
}
DEBUG_TRACE (DEBUG::AudioUnits, "get current preset\n");
if (unit->GetAUPreset (propertyList) != noErr) {
- return false;
+ return string();
}
// add the actual preset name */
if (save_property_list (propertyList, user_preset_path)) {
error << string_compose (_("Saving plugin state to %1 failed"), user_preset_path) << endmsg;
- ret = false;
+ return string();
}
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
}
//-----------------------------------------------------------------------------
{
string preset_name;
-#ifdef AU_STATE_SUPPORT
CFPropertyListRef propertyList;
DEBUG_TRACE (DEBUG::AudioUnits, "get current preset for current_preset()\n");
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;
+ vector<string> preset_files;
user_preset_map.clear ();
- preset_files = scanner (preset_search_path, au_preset_filter, this, true, true, -1, true);
+ find_files_matching_filter (preset_files, preset_search_path, au_preset_filter, this, true, true, -1, true);
- if (!preset_files) {
+ if (preset_files.empty()) {
return;
}
- for (vector<string*>::iterator x = preset_files->begin(); x != preset_files->end(); ++x) {
+ for (vector<string>::iterator x = preset_files.begin(); x != preset_files.end(); ++x) {
- string path = *(*x);
+ string path = *x;
string preset_name;
/* make an initial guess at the preset name using the path */
user_preset_map[preset_name] = path;
}
- delete *x;
}
- delete preset_files;
-
/* now fill the vector<string> with the names we have */
for (UserPresetMap::iterator i = user_preset_map.begin(); i != user_preset_map.end(); ++i) {
string const uri = string_compose ("%1", _presets.size ());
_presets.insert (make_pair (uri, Plugin::PresetRecord (uri, i->first, i->second)));
}
-
-#endif
}
bool
}
AUPluginInfo::get_names (temp, info->name, info->creator);
+ ARDOUR::PluginScanMessage(_("AU"), info->name, false);
info->type = ARDOUR::AudioUnit;
info->unique_id = stringify_descriptor (*info->descriptor);
if (!tree.write (path)) {
error << string_compose (_("could not save AU cache to %1"), path) << endmsg;
- unlink (path.c_str());
+ g_unlink (path.c_str());
}
}