From c14c1c2bf3d6e5c33a65c83f67b4853bd2faedfc Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 11 Nov 2009 19:09:24 +0000 Subject: better/correct AU transport state callback ; debug info for AU I/O configs git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6063 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/audio_unit.h | 3 +++ libs/ardour/audio_unit.cc | 59 +++++++++++++++++++++++++++++++++-------- libs/ardour/audioengine.cc | 2 +- 3 files changed, 52 insertions(+), 12 deletions(-) (limited to 'libs') diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index f3c21cce78..08a5ddd0c8 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -177,6 +177,9 @@ class AUPlugin : public ARDOUR::Plugin void init (); void discover_factory_presets (); + + bool last_transport_rolling; + float last_transport_speed; }; typedef boost::shared_ptr AUPluginPtr; diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index ded4dea85b..6524e83508 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -66,6 +66,7 @@ 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, @@ -335,14 +336,16 @@ Boolean ComponentAndDescriptionMatch_Loosely(Component inComponent, const Compon AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr _comp) : Plugin (engine, session), - comp (_comp), - unit (new CAAudioUnit), - initialized (false), - buffers (0), - current_maxbuf (0), - current_offset (0), - current_buffers (0), - frames_processed (0) + , comp (_comp) + , unit (new CAAudioUnit) + , initialized (false) + , buffers (0) + , current_maxbuf (0) + , current_offset (0) + , current_buffers (0) + , frames_processed (0) + , last_transport_rolling (false) + , last_transport_speed (0.0) { if (!preset_search_path_initialized) { Glib::ustring p = Glib::get_home_dir(); @@ -781,11 +784,19 @@ AUPlugin::can_do (int32_t in, int32_t& out) vector >& io_configs = pinfo->cache.io_configs; + if (debug_io_config) { + cerr << name() << " has " << io_configs.size() << " IO Configurations\n"; + } + for (vector >::iterator i = io_configs.begin(); i != io_configs.end(); ++i) { int32_t possible_in = i->first; int32_t possible_out = i->second; + if (debug_io_config) { + cerr << "\tin " << possible_in << " out " << possible_out << endl; + } + if (possible_out == 0) { warning << string_compose (_("AU %1 has zero outputs - configuration ignored"), name()) << endmsg; continue; @@ -916,6 +927,14 @@ AUPlugin::can_do (int32_t in, int32_t& out) } + 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; + } + } + return plugcnt; } @@ -1148,16 +1167,31 @@ AUPlugin::get_transport_state_callback (Boolean* outIsPlaying, Float64* outCycleStartBeat, Float64* outCycleEndBeat) { + bool rolling; + float speed; + + rolling = _session->transport_rolling(); + speed = _session->transport_speed (); + if (outIsPlaying) { *outIsPlaying = _session.transport_rolling(); } if (outTransportStateChanged) { - *outTransportStateChanged = false; + if (rolling != last_transport_rolling) { + *outTransportStateChanged = true; + } else if (speed != last_transport_speed) { + *outTransportStateChanged = true; + } else { + *outTransportStateChanged = false; + } } if (outCurrentSampleInTimeLine) { - *outCurrentSampleInTimeLine = _session.transport_frame(); + /* this assumes that the AU can only call this host callback from render context, + where current_offset is valid. + */ + *outCurrentSampleInTimeLine = _session.transport_frame() + current_offset; } if (outIsCycling) { @@ -1207,7 +1241,10 @@ AUPlugin::get_transport_state_callback (Boolean* outIsPlaying, } } } - + + last_transport_rolling = rolling; + last_transport_speed = speed; + return noErr; } diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 84e31786a9..9c7789eb06 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -857,7 +857,7 @@ AudioEngine::halted_info (jack_status_t code, const char* reason, void *arg) ae->Halted(""); /* EMIT SIGNAL */ } #else - ae->Halted(""); /* EMIT SIGNAL */ + ae->Halted(""); /* EMIT SIGNAL */ #endif } } -- cgit v1.2.3