summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-10-18 15:08:42 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-10-18 15:08:42 +0000
commit4aeebb914eedf9279e4904786ce42518611de137 (patch)
treebd703e27352128971955ceae57d1762aeb9698bc /libs/ardour
parent41dd8bd811f2fea4ecb048b8075e06f9222294ce (diff)
changes for OS X support: change waf config define to COREAUDIO_SUPPORT, remove PluginInsert call to IO::PortCountChanged, remove use of explicit Carbon linkage, fix up AudioUnit internals to actually work (Cocoa GUIs still currently broken)
git-svn-id: svn://localhost/ardour2/branches/3.0@10224 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/audio_unit.h4
-rw-r--r--libs/ardour/ardour/plugin.h2
-rw-r--r--libs/ardour/audio_unit.cc180
-rw-r--r--libs/ardour/buffer_manager.cc7
-rw-r--r--libs/ardour/globals.cc4
-rw-r--r--libs/ardour/plugin.cc12
-rw-r--r--libs/ardour/plugin_insert.cc18
-rw-r--r--libs/ardour/plugin_manager.cc30
-rw-r--r--libs/ardour/processor.cc2
-rw-r--r--libs/ardour/source_factory.cc10
-rw-r--r--libs/ardour/wscript2
11 files changed, 159 insertions, 112 deletions
diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h
index 0a786d5462..db38b0f234 100644
--- a/libs/ardour/ardour/audio_unit.h
+++ b/libs/ardour/ardour/audio_unit.h
@@ -94,6 +94,8 @@ class AUPlugin : public ARDOUR::Plugin
bool parameter_is_control (uint32_t) const;
bool parameter_is_input (uint32_t) const;
bool parameter_is_output (uint32_t) const;
+
+ void set_info (PluginInfoPtr);
int set_state(const XMLNode& node, int);
@@ -104,6 +106,8 @@ class AUPlugin : public ARDOUR::Plugin
bool reconfigurable_io() const { return true; }
bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
+ ChanCount output_streams() const;
+ ChanCount input_streams() const;
bool configure_io (ChanCount in, ChanCount out);
bool requires_fixed_size_buffers() const;
diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h
index fcd7d6d19b..9c073d4a19 100644
--- a/libs/ardour/ardour/plugin.h
+++ b/libs/ardour/ardour/plugin.h
@@ -215,7 +215,7 @@ class Plugin : public PBD::StatefulDestructible, public Latent
virtual ChanCount input_streams() const;
PluginInfoPtr get_info() const { return _info; }
- void set_info (const PluginInfoPtr inf) { _info = inf; }
+ virtual void set_info (const PluginInfoPtr inf);
ARDOUR::AudioEngine& engine() const { return _engine; }
ARDOUR::Session& session() const { return _session; }
diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc
index 04efb2e50c..5440156ebb 100644
--- a/libs/ardour/audio_unit.cc
+++ b/libs/ardour/audio_unit.cc
@@ -38,6 +38,7 @@
#include "ardour/ardour.h"
#include "ardour/audioengine.h"
#include "ardour/audio_buffer.h"
+#include "ardour/debug.h"
#include "ardour/midi_buffer.h"
#include "ardour/filesystem_paths.h"
#include "ardour/io.h"
@@ -60,13 +61,6 @@ using namespace std;
using namespace PBD;
using namespace ARDOUR;
-//#define TRACE_AU_API
-#ifdef TRACE_AU_API
-#define TRACE_API(fmt,...) fprintf (stderr, fmt, ## __VA_ARGS__)
-#else
-#define TRACE_API(fmt,...)
-#endif
-
#ifndef AU_STATE_SUPPORT
static bool seen_get_state_message = false;
static bool seen_set_state_message = false;
@@ -79,7 +73,6 @@ AUPluginInfo::CachedInfoMap AUPluginInfo::cached_info;
static string preset_search_path = "/Library/Audio/Presets:/Network/Library/Audio/Presets";
static string preset_suffix = ".aupreset";
static bool preset_search_path_initialized = false;
-static bool debug_io_config = true;
static OSStatus
_render_callback(void *userData,
@@ -392,7 +385,7 @@ AUPlugin::AUPlugin (const AUPlugin& other)
AUPlugin::~AUPlugin ()
{
if (unit) {
- TRACE_API ("about to call uninitialize in plugin destructor\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "about to call uninitialize in plugin destructor\n");
unit->Uninitialize ();
}
@@ -408,7 +401,7 @@ AUPlugin::discover_factory_presets ()
UInt32 dataSize = sizeof (presets);
OSStatus err;
- TRACE_API ("get property FactoryPresets in global scope\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "get property FactoryPresets in global scope\n");
if ((err = unit->GetProperty (kAudioUnitProperty_FactoryPresets, kAudioUnitScope_Global, 0, (void*) &presets, &dataSize)) != 0) {
cerr << "cannot get factory preset info: " << err << endl;
return;
@@ -435,8 +428,15 @@ AUPlugin::init ()
{
OSErr err;
+ /* these keep track of *configured* channel set up,
+ not potential set ups.
+ */
+
+ input_channels = -1;
+ output_channels = -1;
+
try {
- TRACE_API ("opening AudioUnit\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "opening AudioUnit\n");
err = CAAudioUnit::Open (*(comp.get()), *unit);
} catch (...) {
error << _("Exception thrown during AudioUnit plugin loading - plugin ignored") << endmsg;
@@ -448,11 +448,11 @@ AUPlugin::init ()
throw failed_constructor ();
}
- TRACE_API ("count global elements\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "count global elements\n");
unit->GetElementCount (kAudioUnitScope_Global, global_elements);
- TRACE_API ("count input elements\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "count input elements\n");
unit->GetElementCount (kAudioUnitScope_Input, input_elements);
- TRACE_API ("count output elements\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "count output elements\n");
unit->GetElementCount (kAudioUnitScope_Output, output_elements);
if (input_elements > 0) {
@@ -461,7 +461,7 @@ AUPlugin::init ()
renderCallbackInfo.inputProc = _render_callback;
renderCallbackInfo.inputProcRefCon = this;
- TRACE_API ("set render callback in input scope\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "set render callback in input scope\n");
if ((err = unit->SetProperty (kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
0, (void*) &renderCallbackInfo, sizeof(renderCallbackInfo))) != 0) {
cerr << "cannot install render callback (err = " << err << ')' << endl;
@@ -479,29 +479,18 @@ AUPlugin::init ()
info.transportStateProc = _get_transport_state_callback;
//ignore result of this - don't care if the property isn't supported
- TRACE_API ("set host callbacks in global scope\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "set host callbacks in global scope\n");
unit->SetProperty (kAudioUnitProperty_HostCallbacks,
kAudioUnitScope_Global,
0, //elementID
&info,
sizeof (HostCallbackInfo));
- /* these keep track of *configured* channel set up,
- not potential set ups.
- */
-
- input_channels = -1;
- output_channels = -1;
-
if (set_block_size (_session.get_block_size())) {
error << _("AUPlugin: cannot set processing block size") << endmsg;
throw failed_constructor();
}
- AUPluginInfoPtr pinfo = boost::dynamic_pointer_cast<AUPluginInfo>(get_info());
- _has_midi_input = pinfo->needs_midi_input ();
- _has_midi_output = false;
-
discover_parameters ();
discover_factory_presets ();
@@ -770,7 +759,7 @@ AUPlugin::set_parameter (uint32_t which, float val)
}
const AUParameterDescriptor& d (descriptors[which]);
- TRACE_API ("set parameter %d in scope %d element %d to %f\n", d.id, d.scope, d.element, val);
+ 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);
/* tell the world what we did */
@@ -783,7 +772,7 @@ AUPlugin::set_parameter (uint32_t which, float val)
theEvent.mArgument.mParameter.mScope = d.scope;
theEvent.mArgument.mParameter.mElement = d.element;
- TRACE_API ("notify about parameter change\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "notify about parameter change\n");
AUEventListenerNotify (NULL, NULL, &theEvent);
Plugin::set_parameter (which, val);
@@ -795,7 +784,7 @@ AUPlugin::get_parameter (uint32_t which) const
float val = 0.0;
if (which < descriptors.size()) {
const AUParameterDescriptor& d (descriptors[which]);
- TRACE_API ("get value of parameter %d in scope %d element %d\n", d.id, d.scope, d.element);
+ DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("get value of parameter %1 in scope %2 element %3\n", d.id, d.scope, d.element));
unit->GetParameter(d.id, d.scope, d.element, val);
}
return val;
@@ -827,7 +816,7 @@ AUPlugin::activate ()
{
if (!initialized) {
OSErr err;
- TRACE_API ("call Initialize in activate()\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "call Initialize in activate()\n");
if ((err = unit->Initialize()) != noErr) {
error << string_compose (_("AUPlugin: %1 cannot initialize plugin (err = %2)"), name(), err) << endmsg;
} else {
@@ -840,7 +829,7 @@ AUPlugin::activate ()
void
AUPlugin::deactivate ()
{
- TRACE_API ("call Uninitialize in deactivate()\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "call Uninitialize in deactivate()\n");
unit->Uninitialize ();
initialized = false;
}
@@ -848,7 +837,7 @@ AUPlugin::deactivate ()
void
AUPlugin::flush ()
{
- TRACE_API ("call Reset in flush()\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "call Reset in flush()\n");
unit->GlobalReset ();
}
@@ -870,7 +859,7 @@ AUPlugin::set_block_size (pframes_t nframes)
deactivate ();
}
- TRACE_API ("set MaximumFramesPerSlice in global scope to %u\n", numFrames);
+ DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("set MaximumFramesPerSlice in global scope to %1\n", numFrames));
if ((err = unit->SetProperty (kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global,
0, &numFrames, sizeof (numFrames))) != noErr) {
cerr << "cannot set max frames (err = " << err << ')' << endl;
@@ -894,6 +883,8 @@ AUPlugin::configure_io (ChanCount in, ChanCount out)
int32_t audio_in = in.n_audio();
int32_t audio_out = out.n_audio();
+ DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("configure %1 for %2 in %3 out\n", name(), in, out));
+
if (initialized) {
//if we are already running with the requested i/o config, bail out here
if ( (audio_in==input_channels) && (audio_out==output_channels) ) {
@@ -934,6 +925,11 @@ AUPlugin::configure_io (ChanCount in, ChanCount out)
return -1;
}
+ /* reset plugin info to show currently configured state */
+
+ _info->n_inputs = in;
+ _info->n_outputs = out;
+
if (was_initialized) {
activate ();
}
@@ -941,6 +937,43 @@ AUPlugin::configure_io (ChanCount in, ChanCount out)
return 0;
}
+ChanCount
+AUPlugin::input_streams() const
+{
+ ChanCount c;
+
+ c.set (DataType::AUDIO, 1);
+ c.set (DataType::MIDI, 0);
+
+ if (input_channels < 0) {
+ warning << string_compose (_("AUPlugin: %1 input_streams() called without any format set!"), name()) << endmsg;
+ } else {
+ c.set (DataType::AUDIO, input_channels);
+ c.set (DataType::MIDI, _has_midi_input ? 1 : 0);
+ }
+
+ return c;
+}
+
+
+ChanCount
+AUPlugin::output_streams() const
+{
+ ChanCount c;
+
+ c.set (DataType::AUDIO, 1);
+ c.set (DataType::MIDI, 0);
+
+ if (output_channels < 0) {
+ warning << string_compose (_("AUPlugin: %1 output_streams() called without any format set!"), name()) << endmsg;
+ } else {
+ c.set (DataType::AUDIO, output_channels);
+ c.set (DataType::MIDI, _has_midi_output ? 1 : 0);
+ }
+
+ return c;
+}
+
bool
AUPlugin::can_support_io_configuration (const ChanCount& in, ChanCount& out) const
{
@@ -962,9 +995,7 @@ AUPlugin::can_support_io_configuration (const ChanCount& in, ChanCount& out) con
vector<pair<int,int> >& io_configs = pinfo->cache.io_configs;
- if (debug_io_config) {
- cerr << name() << " has " << io_configs.size() << " IO Configurations\n";
- }
+ DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("%1 has %2 IO configurations\n", name(), io_configs.size()));
//Ardour expects the plugin to tell it the output configuration
//but AU plugins can have multiple I/O configurations
@@ -977,8 +1008,8 @@ AUPlugin::can_support_io_configuration (const ChanCount& in, ChanCount& out) con
int32_t possible_in = i->first;
int32_t possible_out = i->second;
- if (possible_in == audio_in && possible_out== audio_out) {
- cerr << "\tCHOSEN: in " << in << " out " << out << endl;
+ if (possible_in == audio_in && possible_out == audio_out) {
+ DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("\tCHOSEN: in %1 out %2\n", in, out));
return 1;
}
}
@@ -990,9 +1021,7 @@ AUPlugin::can_support_io_configuration (const ChanCount& in, ChanCount& out) con
int32_t possible_in = i->first;
int32_t possible_out = i->second;
- if (debug_io_config) {
- cerr << "\tin " << possible_in << " out " << possible_out << endl;
- }
+ DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("\tpossible in %1 possible out %2\n", possible_in, possible_out));
if (possible_out == 0) {
warning << string_compose (_("AU %1 has zero outputs - configuration ignored"), name()) << endmsg;
@@ -1124,12 +1153,10 @@ AUPlugin::can_support_io_configuration (const ChanCount& in, ChanCount& out) con
}
- if (debug_io_config) {
- if (plugcnt > 0) {
- cerr << "\tCHOSEN: in " << in << " out " << out << " plugcnt will be " << plugcnt << endl;
- } else {
- cerr << "\tFAIL: no configs match requested in " << in << endl;
- }
+ if (plugcnt > 0) {
+ DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("\tCHOSEN: in %1 out %2 plugcnt %3\n", in, out, plugcnt));
+ } else {
+ DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("\FAIL: no io configs match %1\n", in));
}
out.set (DataType::MIDI, 0);
@@ -1159,9 +1186,6 @@ AUPlugin::set_output_format (AudioStreamBasicDescription& fmt)
buffers = (AudioBufferList *) malloc (offsetof(AudioBufferList, mBuffers) +
fmt.mChannelsPerFrame * sizeof(::AudioBuffer));
- Glib::Mutex::Lock em (_session.engine().process_lock());
- IO::PortCountChanged (ChanCount(DataType::AUDIO, fmt.mChannelsPerFrame));
-
return 0;
}
@@ -1171,9 +1195,9 @@ AUPlugin::set_stream_format (int scope, uint32_t cnt, AudioStreamBasicDescriptio
OSErr result;
for (uint32_t i = 0; i < cnt; ++i) {
- TRACE_API ("set stream format for %s, scope = %d element %d\n",
- (scope == kAudioUnitScope_Input ? "input" : "output"),
- scope, cnt);
+ DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("set stream format for %1, scope = %2 element %3\n",
+ (scope == kAudioUnitScope_Input ? "input" : "output"),
+ scope, cnt));
if ((result = unit->SetFormat (scope, i, fmt)) != 0) {
error << string_compose (_("AUPlugin: could not set stream format for %1/%2 (err = %3)"),
(scope == kAudioUnitScope_Input ? "input" : "output"), i, result) << endmsg;
@@ -1322,7 +1346,7 @@ AUPlugin::get_beat_and_tempo_callback (Float64* outCurrentBeat,
{
TempoMap& tmap (_session.tempo_map());
- TRACE_API ("AU calls ardour beat&tempo callback\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "AU calls ardour beat&tempo callback\n");
/* more than 1 meter or more than 1 tempo means that a simplistic computation
(and interpretation) of a beat position will be incorrect. So refuse to
@@ -1361,7 +1385,7 @@ AUPlugin::get_musical_time_location_callback (UInt32* outDeltaSampleOffsetToNe
{
TempoMap& tmap (_session.tempo_map());
- TRACE_API ("AU calls ardour music time location callback\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "AU calls ardour music time location callback\n");
/* more than 1 meter or more than 1 tempo means that a simplistic computation
(and interpretation) of a beat position will be incorrect. So refuse to
@@ -1420,7 +1444,7 @@ AUPlugin::get_transport_state_callback (Boolean* outIsPlaying,
bool rolling;
float speed;
- TRACE_API ("AU calls ardour transport state callback\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "AU calls ardour transport state callback\n");
rolling = _session.transport_rolling();
speed = _session.transport_speed ();
@@ -1563,7 +1587,7 @@ AUPlugin::add_state (XMLNode* root) const
CFDataRef xmlData;
CFPropertyListRef propertyList;
- TRACE_API ("get preset state\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "get preset state\n");
if (unit->GetAUPreset (propertyList) != noErr) {
return;
}
@@ -1636,7 +1660,7 @@ AUPlugin::set_state(const XMLNode& node, int version)
CFRelease (xmlData);
if (propertyList) {
- TRACE_API ("set preset\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "set preset\n");
if (unit->SetAUPreset (propertyList) == noErr) {
ret = 0;
@@ -1679,7 +1703,7 @@ AUPlugin::load_preset (PresetRecord r)
if ((ux = user_preset_map.find (r.label)) != user_preset_map.end()) {
if ((propertyList = load_property_list (ux->second)) != 0) {
- TRACE_API ("set preset from user presets\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "set preset from user presets\n");
if (unit->SetAUPreset (propertyList) == noErr) {
ret = true;
@@ -1700,7 +1724,7 @@ AUPlugin::load_preset (PresetRecord r)
preset.presetNumber = fx->second;
preset.presetName = CFStringCreateWithCString (kCFAllocatorDefault, fx->first.c_str(), kCFStringEncodingUTF8);
- TRACE_API ("set preset from factory presets\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "set preset from factory presets\n");
if (unit->SetPresentPreset (preset) == 0) {
ret = true;
@@ -1760,7 +1784,7 @@ AUPlugin::do_save_preset (string preset_name)
return false;
}
- TRACE_API ("get current preset\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "get current preset\n");
if (unit->GetAUPreset (propertyList) != noErr) {
return false;
}
@@ -1961,7 +1985,7 @@ AUPlugin::current_preset() const
#ifdef AU_STATE_SUPPORT
CFPropertyListRef propertyList;
- TRACE_API ("get current preset for current_preset()\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "get current preset for current_preset()\n");
if (unit->GetAUPreset (propertyList) == noErr) {
preset_name = get_preset_name_in_plist (propertyList);
CFRelease(propertyList);
@@ -2051,7 +2075,7 @@ AUPluginInfo::load (Session& session)
try {
PluginPtr plugin;
- TRACE_API ("load AU as a component\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "load AU as a component\n");
boost::shared_ptr<CAComponent> comp (new CAComponent(*descriptor));
if (!comp->IsValid()) {
@@ -2061,12 +2085,14 @@ AUPluginInfo::load (Session& session)
}
AUPluginInfo *aup = new AUPluginInfo (*this);
+ DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("plugin info for %1 = %2\n", this, aup));
plugin->set_info (PluginInfoPtr (aup));
boost::dynamic_pointer_cast<AUPlugin> (plugin)->set_fixed_size_buffers (aup->creator == "Universal Audio");
return plugin;
}
catch (failed_constructor &err) {
+ DEBUG_TRACE (DEBUG::AudioUnits, "failed to load component/plugin\n");
return PluginPtr ();
}
}
@@ -2088,12 +2114,12 @@ AUPluginInfo::discover ()
PluginInfoList* plugs = new PluginInfoList;
-#if 0
discover_fx (*plugs);
discover_music (*plugs);
discover_generators (*plugs);
discover_instruments (*plugs);
-#endif
+
+ DEBUG_TRACE (DEBUG::PluginManager, string_compose ("AU: discovered %1 plugins\n", plugs->size()));
return plugs;
}
@@ -2227,7 +2253,8 @@ AUPluginInfo::discover_by_description (PluginInfoList& plugs, CAComponentDescrip
info->n_inputs.set (DataType::AUDIO, info->cache.io_configs.front().first);
info->n_outputs.set (DataType::AUDIO, info->cache.io_configs.front().second);
- cerr << "detected AU: " << info->name.c_str() << " (" << info->cache.io_configs.size() << " i/o configurations) - " << info->unique_id << endl;
+ DEBUG_TRACE (DEBUG::AudioUnits, string_compose ("detected AU %1 with %2 i/o configurations - %3\n",
+ info->name.c_str(), info->cache.io_configs.size(), info->unique_id));
plugs.push_back (info);
@@ -2282,20 +2309,20 @@ AUPluginInfo::cached_io_configuration (const std::string& unique_id,
} catch (...) {
warning << string_compose (_("Could not load AU plugin %1 - ignored"), name) << endmsg;
- cerr << string_compose (_("Could not load AU plugin %1 - ignored"), name) << endl;
return false;
}
- TRACE_API ("get AU channel info\n");
+ DEBUG_TRACE (DEBUG::AudioUnits, "get AU channel info\n");
if ((ret = unit.GetChannelInfo (&channel_info, cnt)) < 0) {
return false;
}
if (ret > 0) {
- /* no explicit info available */
- cinfo.io_configs.push_back (pair<int,int> (-1, -1));
+ /* no explicit info available, so default to 1in/1out */
+
+ cinfo.io_configs.push_back (pair<int,int> (1, 1));
} else {
@@ -2563,3 +2590,14 @@ AUPluginInfo::is_instrument () const
{
return descriptor->IsMusicDevice();
}
+
+void
+AUPlugin::set_info (PluginInfoPtr info)
+{
+ Plugin::set_info (info);
+
+ AUPluginInfoPtr pinfo = boost::dynamic_pointer_cast<AUPluginInfo>(get_info());
+
+ _has_midi_input = pinfo->needs_midi_input ();
+ _has_midi_output = false;
+}
diff --git a/libs/ardour/buffer_manager.cc b/libs/ardour/buffer_manager.cc
index 5ebbce2629..e035e4519a 100644
--- a/libs/ardour/buffer_manager.cc
+++ b/libs/ardour/buffer_manager.cc
@@ -18,7 +18,11 @@
*/
#include <iostream>
+
+#include "pbd/compose.h"
+
#include "ardour/buffer_manager.h"
+#include "ardour/debug.h"
#include "ardour/thread_buffers.h"
using namespace ARDOUR;
@@ -69,7 +73,10 @@ BufferManager::ensure_buffers (ChanCount howmany)
{
/* this is protected by the audioengine's process lock: we do not */
+ DEBUG_TRACE (DEBUG::Processors, string_compose ("BufferManager::ensure_buffers (%1)\n", howmany));
+
for (ThreadBufferList::iterator i = thread_buffers_list->begin(); i != thread_buffers_list->end(); ++i) {
+ DEBUG_TRACE (DEBUG::Processors, string_compose ("BufferManager::ensure_buffers, thread buffers @ %1\n", (*i)));
(*i)->ensure_buffers (howmany);
}
}
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index 48a7dc0da0..7c713980c3 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -37,7 +37,7 @@
#include "ardour/vstfx.h"
#endif
-#ifdef HAVE_AUDIOUNITS
+#ifdef AUDIOUNIT_SUPPORT
#include "ardour/audio_unit.h"
#endif
@@ -313,7 +313,7 @@ ARDOUR::init (bool use_vst, bool try_optimization)
}
#endif
-#ifdef HAVE_AUDIOUNITS
+#ifdef AUDIOUNIT_SUPPORT
AUPluginInfo::load_cached_info ();
#endif
diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc
index 12760e5d6e..21ad91ff0e 100644
--- a/libs/ardour/plugin.cc
+++ b/libs/ardour/plugin.cc
@@ -45,7 +45,7 @@
#include "ardour/ladspa_plugin.h"
#include "ardour/plugin_manager.h"
-#ifdef HAVE_AUDIOUNITS
+#ifdef AUDIOUNIT_SUPPORT
#include "ardour/audio_unit.h"
#endif
@@ -145,7 +145,7 @@ ARDOUR::find_plugin(Session& session, string identifier, PluginType type)
break;
#endif
-#ifdef HAVE_AUDIOUNITS
+#ifdef AUDIOUNIT_SUPPORT
case ARDOUR::AudioUnit:
plugs = mgr->au_plugin_info();
break;
@@ -237,7 +237,7 @@ Plugin::preset_by_uri (const string& uri)
int
Plugin::connect_and_run (BufferSet& bufs,
ChanMapping /*in_map*/, ChanMapping /*out_map*/,
- pframes_t nframes, framecnt_t offset)
+ pframes_t /* nframes */, framecnt_t /*offset*/)
{
if (bufs.count().n_midi() > 0) {
@@ -339,3 +339,9 @@ Plugin::get_state ()
add_state (root);
return *root;
}
+
+void
+Plugin::set_info (PluginInfoPtr info)
+{
+ _info = info;
+}
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index ea95ed09e5..78f6596330 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -30,6 +30,7 @@
#include "ardour/audio_buffer.h"
#include "ardour/automation_list.h"
#include "ardour/buffer_set.h"
+#include "ardour/debug.h"
#include "ardour/event_type_map.h"
#include "ardour/ladspa_plugin.h"
#include "ardour/plugin.h"
@@ -49,7 +50,7 @@
#include "ardour/lxvst_plugin.h"
#endif
-#ifdef HAVE_AUDIOUNITS
+#ifdef AUDIOUNIT_SUPPORT
#include "ardour/audio_unit.h"
#endif
@@ -133,6 +134,8 @@ PluginInsert::output_streams() const
{
ChanCount out = _plugins.front()->get_info()->n_outputs;
+ DEBUG_TRACE (DEBUG::Processors, string_compose ("Plugin insert, static output streams = %1\n", out));
+
if (out == ChanCount::INFINITE) {
return _plugins.front()->output_streams ();
} else {
@@ -147,6 +150,8 @@ PluginInsert::input_streams() const
{
ChanCount in = _plugins[0]->get_info()->n_inputs;
+ DEBUG_TRACE (DEBUG::Processors, string_compose ("Plugin insert, static input streams = %1, match using %2\n", in, _match.method));
+
if (_match.method == Split) {
/* we are splitting 1 processor input to multiple plugin inputs,
@@ -597,7 +602,7 @@ PluginInsert::plugin_factory (boost::shared_ptr<Plugin> other)
#ifdef LXVST_SUPPORT
boost::shared_ptr<LXVSTPlugin> lxvp;
#endif
-#ifdef HAVE_AUDIOUNITS
+#ifdef AUDIOUNIT_SUPPORT
boost::shared_ptr<AUPlugin> ap;
#endif
@@ -615,7 +620,7 @@ PluginInsert::plugin_factory (boost::shared_ptr<Plugin> other)
} else if ((lxvp = boost::dynamic_pointer_cast<LXVSTPlugin> (other)) != 0) {
return boost::shared_ptr<Plugin> (new LXVSTPlugin (*lxvp));
#endif
-#ifdef HAVE_AUDIOUNITS
+#ifdef AUDIOUNIT_SUPPORT
} else if ((ap = boost::dynamic_pointer_cast<AUPlugin> (other)) != 0) {
return boost::shared_ptr<Plugin> (new AUPlugin (*ap));
#endif
@@ -1013,13 +1018,6 @@ PluginInsert::set_state(const XMLNode& node, int version)
}
}
- /* catch up on I/O */
-
- {
- Glib::Mutex::Lock em (_session.engine().process_lock());
- IO::PortCountChanged (max(input_streams(), output_streams()));
- }
-
return 0;
}
diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc
index 7072e073ba..88dc4c13a7 100644
--- a/libs/ardour/plugin_manager.cc
+++ b/libs/ardour/plugin_manager.cc
@@ -47,12 +47,13 @@
#include "pbd/pathscanner.h"
#include "pbd/whitespace.h"
+#include "ardour/debug.h"
+#include "ardour/filesystem_paths.h"
#include "ardour/ladspa.h"
-#include "ardour/session.h"
-#include "ardour/plugin_manager.h"
-#include "ardour/plugin.h"
#include "ardour/ladspa_plugin.h"
-#include "ardour/filesystem_paths.h"
+#include "ardour/plugin.h"
+#include "ardour/plugin_manager.h"
+#include "ardour/session.h"
#ifdef LV2_SUPPORT
#include "ardour/lv2_plugin.h"
@@ -66,7 +67,7 @@
#include "ardour/lxvst_plugin.h"
#endif
-#ifdef HAVE_AUDIOUNITS
+#ifdef AUDIOUNIT_SUPPORT
#include "ardour/audio_unit.h"
#include <Carbon/Carbon.h>
#endif
@@ -94,14 +95,6 @@ PluginManager::PluginManager ()
load_statuses ();
-#ifdef HAVE_AUDIOUNITS
- ProcessSerialNumber psn = { 0, kCurrentProcess };
- OSStatus returnCode = TransformProcessType(& psn, kProcessTransformToForegroundApplication);
- if( returnCode != 0) {
- error << _("Cannot become GUI app") << endmsg;
- }
-#endif
-
if ((s = getenv ("LADSPA_RDF_PATH"))){
lrdf_path = s;
}
@@ -168,6 +161,8 @@ PluginManager::~PluginManager()
void
PluginManager::refresh ()
{
+ DEBUG_TRACE (DEBUG::PluginManager, "PluginManager::refresh\n");
+
ladspa_refresh ();
#ifdef LV2_SUPPORT
lv2_refresh ();
@@ -184,7 +179,7 @@ PluginManager::refresh ()
}
#endif //Native linuxVST SUPPORT
-#ifdef HAVE_AUDIOUNITS
+#ifdef AUDIOUNIT_SUPPORT
au_refresh ();
#endif
@@ -236,6 +231,8 @@ PluginManager::ladspa_refresh ()
}
+ DEBUG_TRACE (DEBUG::PluginManager, string_compose ("LADSPA: search along: [%1]\n", ladspa_path));
+
ladspa_discover_from_path (ladspa_path);
}
@@ -509,10 +506,11 @@ PluginManager::lv2_refresh ()
}
#endif
-#ifdef HAVE_AUDIOUNITS
+#ifdef AUDIOUNIT_SUPPORT
void
PluginManager::au_refresh ()
{
+ DEBUG_TRACE (DEBUG::PluginManager, "AU: refresh\n");
delete _au_plugin_info;
_au_plugin_info = AUPluginInfo::discover();
}
@@ -947,7 +945,7 @@ PluginManager::lv2_plugin_info ()
ARDOUR::PluginInfoList&
PluginManager::au_plugin_info ()
{
-#ifdef HAVE_AUDIOUNITS
+#ifdef AUDIOUNIT_SUPPORT
if (!_au_plugin_info)
au_refresh();
return *_au_plugin_info;
diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc
index cf641fd7cf..cbec3e6029 100644
--- a/libs/ardour/processor.cc
+++ b/libs/ardour/processor.cc
@@ -42,7 +42,7 @@
#include "ardour/vst_plugin.h"
#endif
-#ifdef HAVE_AUDIOUNITS
+#ifdef AUDIOUNIT_SUPPORT
#include "ardour/audio_unit.h"
#endif
diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc
index 3ea63a75ed..65f9d8da28 100644
--- a/libs/ardour/source_factory.cc
+++ b/libs/ardour/source_factory.cc
@@ -40,10 +40,6 @@
#include "ardour/session.h"
#ifdef HAVE_COREAUDIO
-#define USE_COREAUDIO_FOR_FILES
-#endif
-
-#ifdef USE_COREAUDIO_FOR_FILES
#include "ardour/coreaudiosource.h"
#endif
@@ -188,7 +184,7 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
catch (failed_constructor& err) {
-#ifdef USE_COREAUDIO_FOR_FILES
+#ifdef HAVE_COREAUDIO
/* this is allowed to throw */
@@ -252,7 +248,7 @@ SourceFactory::createReadable (DataType type, Session& s, const string& path,
}
catch (failed_constructor& err) {
-#ifdef USE_COREAUDIO_FOR_FILES
+#ifdef HAVE_COREAUDIO
Source* src = new CoreAudioSource (s, path, chn, flags);
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
@@ -350,7 +346,7 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat
}
boost::shared_ptr<Source>
-SourceFactory::createFromPlaylist (DataType type, Session& s, boost::shared_ptr<Playlist> p, const ID& orig, const std::string& name,
+SourceFactory::createFromPlaylist (DataType type, Session& s, boost::shared_ptr<Playlist> p, const PBD::ID& orig, const std::string& name,
uint32_t chn, frameoffset_t start, framecnt_t len, bool copy, bool defer_peaks)
{
if (type == DataType::AUDIO) {
diff --git a/libs/ardour/wscript b/libs/ardour/wscript
index 48694fdb5d..210c80e434 100644
--- a/libs/ardour/wscript
+++ b/libs/ardour/wscript
@@ -391,7 +391,7 @@ def build(bld):
obj.defines += [ 'LXVST_SUPPORT' ]
- if bld.is_defined('COREAUDIO'):
+ if bld.is_defined('HAVE_COREAUDIO'):
obj.source += [ 'coreaudiosource.cc', 'caimportable.cc' ]
obj.use += ['libappleutility']
obj.source += [ 'audio_unit.cc' ]