diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-09-10 21:27:39 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-09-10 21:27:39 +0000 |
commit | c86210a9d5bdb7b36ad58552a1f99f53d48781b3 (patch) | |
tree | 6ab06935a1e2bc4ef6a4448dd01b09f5b2628c66 /libs | |
parent | 68e943265edf04e63a8e8b8f62bab20f99d9c637 (diff) |
merge 2.0-ongoing into 3.0 @ 3581 - 3710
git-svn-id: svn://localhost/ardour2/branches/3.0@3712 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/lv2_plugin.h | 17 | ||||
-rw-r--r-- | libs/ardour/ardour/region.h | 2 | ||||
-rw-r--r-- | libs/ardour/audio_unit.cc | 13 | ||||
-rw-r--r-- | libs/ardour/audioengine.cc | 59 | ||||
-rw-r--r-- | libs/ardour/lv2_plugin.cc | 39 | ||||
-rw-r--r-- | libs/ardour/rb_effect.cc | 32 | ||||
-rw-r--r-- | libs/ardour/region.cc | 2 | ||||
-rw-r--r-- | libs/ardour/sndfilesource.cc | 12 | ||||
-rw-r--r-- | libs/pbd/pbd/xml++.h | 1 | ||||
-rw-r--r-- | libs/pbd/xml++.cc | 9 | ||||
-rw-r--r-- | libs/surfaces/control_protocol/SConscript | 1 | ||||
-rw-r--r-- | libs/surfaces/generic_midi/SConscript | 1 | ||||
-rw-r--r-- | libs/surfaces/mackie/SConscript | 1 | ||||
-rw-r--r-- | libs/surfaces/tranzport/SConscript | 1 | ||||
-rw-r--r-- | libs/vamp-plugins/SConscript | 3 |
15 files changed, 141 insertions, 52 deletions
diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index d20ece65bd..b3711c5588 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -60,9 +60,14 @@ class LV2Plugin : public ARDOUR::Plugin int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const; uint32_t nth_parameter (uint32_t port, bool& ok) const; + const void* extension_data(const char* uri) { return _instance->lv2_descriptor->extension_data(uri); } + SLV2Plugin slv2_plugin() { return _plugin; } + SLV2UI slv2_ui() { return _ui; } SLV2Port slv2_port(uint32_t i) { return slv2_plugin_get_port_by_index(_plugin, i); } + const LV2_Feature* const* features() { return _features; } + std::set<Parameter> automatable() const; void activate () { @@ -104,14 +109,14 @@ class LV2Plugin : public ARDOUR::Plugin int set_state(const XMLNode& node); bool save_preset(std::string name); - bool has_editor() const { return false; } + bool has_editor() const; - int require_output_streams (uint32_t); - private: void* _module; LV2World& _world; + LV2_Feature** _features; SLV2Plugin _plugin; + SLV2UI _ui; SLV2Value _name; SLV2Value _author; SLV2Instance _instance; @@ -123,6 +128,11 @@ class LV2Plugin : public ARDOUR::Plugin bool _was_activated; vector<bool> _port_is_input; + typedef struct { const void* (*extension_data)(const char* uri); } LV2_DataAccess; + LV2_DataAccess _data_access_extension_data; + LV2_Feature _data_access_feature; + LV2_Feature _instance_access_feature; + void init (LV2World& world, SLV2Plugin plugin, nframes_t rate); void run (nframes_t nsamples); void latency_compute_run (); @@ -149,6 +159,7 @@ struct LV2World { SLV2Value integer; SLV2Value toggled; SLV2Value srate; + SLV2Value gtk_gui; }; diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 00315846b2..32f47d42d7 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -217,7 +217,7 @@ class Region : public Automatable, public boost::enable_shared_from_this<Region> const SourceList& master_sources() const { return _master_sources; } std::vector<string> master_source_names(); - void set_master_sources (SourceList&); + void set_master_sources (const SourceList&); /* serialization */ diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 4862ddcd12..9c7ea0f13f 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -1081,10 +1081,19 @@ AUPluginInfo::cached_io_configuration (const std::string& unique_id, ARDOUR::BootMessage (string_compose (_("Checking AudioUnit: %1"), name)); - if (CAAudioUnit::Open (comp, unit) != noErr) { + try { + + if (CAAudioUnit::Open (comp, unit) != noErr) { + return false; + } + + } catch (...) { + + warning << string_compose (_("Could not load AU plugin %1 - ignored"), name) << endmsg; return false; - } + } + if ((ret = unit.GetChannelInfo (&channel_info, cnt)) < 0) { return false; } diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 76c0de9b24..6a76e98c3c 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -95,6 +95,7 @@ AudioEngine::~AudioEngine () if (_running) { jack_client_close (_jack); + _jack = 0; } stop_metering_thread (); @@ -121,6 +122,11 @@ _thread_init_callback (void *arg) int AudioEngine::start () { + if (!_jack) { + error << _("AudioEngine::start() called while disconnected from JACK") << endmsg; + return -1; + } + if (!_running) { if (session) { @@ -179,17 +185,13 @@ AudioEngine::start () int AudioEngine::stop (bool forever) { - if (_running) { - _running = false; - stop_metering_thread (); + if (_jack) { if (forever) { - jack_client_t* foo = _jack; - _jack = 0; - jack_client_close (foo); + disconnect_from_jack (); } else { jack_deactivate (_jack); + Stopped(); /* EMIT SIGNAL */ } - Stopped(); /* EMIT SIGNAL */ } return _running ? -1 : 0; @@ -204,11 +206,13 @@ AudioEngine::get_sync_offset (nframes_t& offset) const jack_position_t pos; - (void) jack_transport_query (_jack, &pos); - - if (pos.valid & JackVideoFrameOffset) { - offset = pos.video_offset; - return true; + if (_jack) { + (void) jack_transport_query (_jack, &pos); + + if (pos.valid & JackVideoFrameOffset) { + offset = pos.video_offset; + return true; + } } #endif @@ -252,7 +256,7 @@ int AudioEngine::_xrun_callback (void *arg) { AudioEngine* ae = static_cast<AudioEngine*> (arg); - if (ae->jack()) { + if (ae->connected()) { ae->Xrun (); /* EMIT SIGNAL */ } return 0; @@ -262,7 +266,7 @@ int AudioEngine::_graph_order_callback (void *arg) { AudioEngine* ae = static_cast<AudioEngine*> (arg); - if (ae->jack()) { + if (ae->connected()) { ae->GraphReordered (); /* EMIT SIGNAL */ } return 0; @@ -894,7 +898,8 @@ AudioEngine::halted (void *arg) ae->_running = false; ae->_buffer_size = 0; ae->_frame_rate = 0; - ae->_jack = 0; + + cerr << "!!! HALTED !!!\n"; if (was_running) { ae->Halted(); /* EMIT SIGNAL */ @@ -1067,7 +1072,6 @@ AudioEngine::update_total_latency (const Port& port) void AudioEngine::transport_stop () { - // cerr << "tell JACK to stop\n"; if (_jack) { jack_transport_stop (_jack); } @@ -1211,7 +1215,7 @@ AudioEngine::connect_to_jack (string client_name) { jack_client_name = client_name; - if ((_jack = jack_client_new (client_name.c_str())) == NULL) { + if ((_jack = jack_client_new (client_name.c_str())) == 0) { return -1; } @@ -1223,29 +1227,36 @@ AudioEngine::connect_to_jack (string client_name) int AudioEngine::disconnect_from_jack () { - if (_jack == 0) { + if (!_jack) { return 0; } - jack_client_close (_jack); + + if (_running) { + stop_metering_thread (); + } + + { + Glib::Mutex::Lock lm (_process_lock); + jack_client_close (_jack); + _jack = 0; + } _buffer_size = 0; _frame_rate = 0; if (_running) { - stop_metering_thread (); _running = false; Stopped(); /* EMIT SIGNAL */ } - _jack = 0; return 0; } int AudioEngine::reconnect_to_jack () { - if (_jack) { + if (_running) { disconnect_from_jack (); /* XXX give jackd a chance */ Glib::usleep (250000); @@ -1336,7 +1347,9 @@ void AudioEngine::update_total_latencies () { #ifdef HAVE_JACK_RECOMPUTE_LATENCIES - jack_recompute_total_latencies (_jack); + if (_jack) { + jack_recompute_total_latencies (_jack); + } #endif } diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index a38c851c21..f6bb2ec4dd 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -43,10 +43,11 @@ using namespace std; using namespace ARDOUR; using namespace PBD; - + LV2Plugin::LV2Plugin (AudioEngine& e, Session& session, LV2World& world, SLV2Plugin plugin, nframes_t rate) : Plugin (e, session) , _world(world) + , _features(NULL) { init (world, plugin, rate); } @@ -54,6 +55,7 @@ LV2Plugin::LV2Plugin (AudioEngine& e, Session& session, LV2World& world, SLV2Plu LV2Plugin::LV2Plugin (const LV2Plugin &other) : Plugin (other) , _world(other._world) + , _features(NULL) { init (other._world, other._plugin, other._sample_rate); @@ -68,12 +70,13 @@ LV2Plugin::init (LV2World& world, SLV2Plugin plugin, nframes_t rate) { _world = world; _plugin = plugin; + _ui = NULL; _control_data = 0; _shadow_data = 0; _latency_control_port = 0; _was_activated = false; - - _instance = slv2_plugin_instantiate(plugin, rate, NULL); + + _instance = slv2_plugin_instantiate(plugin, rate, _features); _name = slv2_plugin_get_name(plugin); assert(_name); _author = slv2_plugin_get_author_name(plugin); @@ -90,6 +93,18 @@ LV2Plugin::init (LV2World& world, SLV2Plugin plugin, nframes_t rate) slv2_value_free(_author); throw failed_constructor(); } + + _instance_access_feature.URI = "http://lv2plug.in/ns/ext/instance-access"; + _instance_access_feature.data = (void*)_instance->lv2_handle; + + _data_access_extension_data.extension_data = _instance->lv2_descriptor->extension_data; + _data_access_feature.URI = "http://lv2plug.in/ns/ext/data-access"; + _data_access_feature.data = &_data_access_extension_data; + + _features = (LV2_Feature**)malloc(sizeof(LV2_Feature*) * 3); + _features[0] = &_instance_access_feature; + _features[1] = &_data_access_feature; + _features[2] = NULL; _sample_rate = rate; @@ -124,6 +139,17 @@ LV2Plugin::init (LV2World& world, SLV2Plugin plugin, nframes_t rate) _defaults[i] = 0.0f; } } + + SLV2UIs uis = slv2_plugin_get_uis(_plugin); + if (slv2_uis_size(uis) > 0) { + for (unsigned i=0; i < slv2_uis_size(uis); ++i) { + SLV2UI ui = slv2_uis_get_at(uis, i); + if (slv2_ui_is_a(ui, _world.gtk_gui)) { + _ui = ui; + break; + } + } + } latency_compute_run (); } @@ -243,6 +269,12 @@ LV2Plugin::save_preset (string name) { return Plugin::save_preset (name, "lv2"); } + +bool +LV2Plugin::has_editor() const +{ + return (_ui != NULL); +} int LV2Plugin::set_state(const XMLNode& node) @@ -536,6 +568,7 @@ LV2World::LV2World() integer = slv2_value_new_uri(world, SLV2_NAMESPACE_LV2 "integer"); toggled = slv2_value_new_uri(world, SLV2_NAMESPACE_LV2 "toggled"); srate = slv2_value_new_uri(world, SLV2_NAMESPACE_LV2 "sampleRate"); + gtk_gui = slv2_value_new_uri(world, "http://lv2plug.in/ns/extensions/ui#GtkUI"); } LV2World::~LV2World() diff --git a/libs/ardour/rb_effect.cc b/libs/ardour/rb_effect.cc index 9d8ac311b7..d0a8a3abbf 100644 --- a/libs/ardour/rb_effect.cc +++ b/libs/ardour/rb_effect.cc @@ -60,8 +60,15 @@ RBEffect::~RBEffect () } int -RBEffect::run (boost::shared_ptr<AudioRegion> region) +RBEffect::run (boost::shared_ptr<Region> r) { + boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion> (r); + + if (!region) { + error << "RBEffect::run() passed a non-audio region! WTF?" << endmsg; + return -1; + } + SourceList nsrcs; nframes_t done; int ret = -1; @@ -158,9 +165,6 @@ RBEffect::run (boost::shared_ptr<AudioRegion> region) stretcher.setExpectedInputDuration(read_duration); stretcher.setDebugLevel(1); - stretcher.setExpectedInputDuration(duration); - stretcher.setDebugLevel(1); - /* the name doesn't need to be super-precise, but allow for 2 fractional digits just to disambiguate close but not identical FX */ @@ -288,8 +292,12 @@ RBEffect::run (boost::shared_ptr<AudioRegion> region) for (uint32_t i = 0; i < nsrcs.size(); ++i) { - if (nsrcs[i]->write(buffers[i], this_read) != - this_read) { + boost::shared_ptr<AudioSource> asrc = boost::dynamic_pointer_cast<AudioSource>(nsrcs[i]); + if (!asrc) { + continue; + } + + if (asrc->write(buffers[i], this_read) != this_read) { error << string_compose (_("error writing tempo-adjusted data to %1"), nsrcs[i]->name()) << endmsg; goto out; } @@ -305,7 +313,12 @@ RBEffect::run (boost::shared_ptr<AudioRegion> region) for (uint32_t i = 0; i < nsrcs.size(); ++i) { - if (nsrcs[i]->write(buffers[i], this_read) != + boost::shared_ptr<AudioSource> asrc = boost::dynamic_pointer_cast<AudioSource>(nsrcs[i]); + if (!asrc) { + continue; + } + + if (asrc->write(buffers[i], this_read) != this_read) { error << string_compose (_("error writing tempo-adjusted data to %1"), nsrcs[i]->name()) << endmsg; goto out; @@ -334,14 +347,13 @@ RBEffect::run (boost::shared_ptr<AudioRegion> region) /* now reset ancestral data for each new region */ - for (vector<boost::shared_ptr<AudioRegion> >::iterator x = results.begin(); x != results.end(); ++x) { - + for (vector<boost::shared_ptr<Region> >::iterator x = results.begin(); x != results.end(); ++x) { (*x)->set_ancestral_data (read_start, read_duration, stretch, shift); - (*x)->set_master_sources (region->get_master_sources()); + (*x)->set_master_sources (region->master_sources()); } out: diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 6676222b54..42564a8b5e 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -1406,7 +1406,7 @@ Region::master_source_names () } void -Region::set_master_sources (SourceList& srcs) +Region::set_master_sources (const SourceList& srcs) { _master_sources = srcs; } diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index b6efe27d36..ed63fb6132 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -160,8 +160,12 @@ SndFileSource::SndFileSource (Session& s, ustring path, SampleFormat sfmt, Heade memset (_broadcast_info, 0, sizeof (*_broadcast_info)); snprintf_bounded_null_filled (_broadcast_info->description, sizeof (_broadcast_info->description), "BWF %s", _name.c_str()); - snprintf_bounded_null_filled (_broadcast_info->originator, sizeof (_broadcast_info->originator), "ardour %s)", Glib::get_real_name().c_str()); - + snprintf_bounded_null_filled (_broadcast_info->originator, sizeof (_broadcast_info->originator), "ardour %d.%d.%d %s", + libardour3_major_version, + libardour3_minor_version, + libardour3_micro_version, + Glib::get_real_name().c_str()); + _broadcast_info->version = 1; _broadcast_info->time_reference_low = 0; _broadcast_info->time_reference_high = 0; @@ -551,14 +555,14 @@ SndFileSource::setup_broadcast_info (nframes_t when, struct tm& now, time_t tnow snprintf_bounded_null_filled (_broadcast_info->origination_date, sizeof (_broadcast_info->origination_date), "%4d-%02d-%02d", 1900 + now.tm_year, - now.tm_mon + 1, // move from 0..11 to 1..12 + now.tm_mon + 1, // shift range from 0..11 to 1..12 now.tm_mday); snprintf_bounded_null_filled (_broadcast_info->origination_time, sizeof (_broadcast_info->origination_time), "%02d:%02d:%02d", now.tm_hour, now.tm_min, now.tm_sec); - + /* now update header position taking header offset into account */ set_header_timeline_position (); diff --git a/libs/pbd/pbd/xml++.h b/libs/pbd/pbd/xml++.h index 290a449869..83cc8ff91b 100644 --- a/libs/pbd/pbd/xml++.h +++ b/libs/pbd/pbd/xml++.h @@ -78,6 +78,7 @@ private: XMLNodeList _children; XMLPropertyList _proplist; XMLPropertyMap _propmap; + mutable XMLNodeList _selected_children; public: XMLNode(const string& name); diff --git a/libs/pbd/xml++.cc b/libs/pbd/xml++.cc index ec1ca5d2b9..9643b5d3a8 100644 --- a/libs/pbd/xml++.cc +++ b/libs/pbd/xml++.cc @@ -278,22 +278,21 @@ XMLNode::children(const string& n) const { /* returns all children matching name */ - static XMLNodeList retval; XMLNodeConstIterator cur; if (n.empty()) { return _children; } - - retval.erase(retval.begin(), retval.end()); + + _selected_children.clear(); for (cur = _children.begin(); cur != _children.end(); ++cur) { if ((*cur)->name() == n) { - retval.insert(retval.end(), *cur); + _selected_children.insert(_selected_children.end(), *cur); } } - return retval; + return _selected_children; } XMLNode * diff --git a/libs/surfaces/control_protocol/SConscript b/libs/surfaces/control_protocol/SConscript index 22cb1f4961..2969a9e941 100644 --- a/libs/surfaces/control_protocol/SConscript +++ b/libs/surfaces/control_protocol/SConscript @@ -30,6 +30,7 @@ cp.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE") cp.Append(CXXFLAGS="-DDATA_DIR=\\\""+final_prefix+"/share\\\"") cp.Append(CXXFLAGS="-DCONFIG_DIR=\\\""+final_config_prefix+"\\\"") cp.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"") +cp.Append(CPPPATH = libraries['jack'].get('CPPPATH', [])) cp.Merge ([ libraries['ardour'], diff --git a/libs/surfaces/generic_midi/SConscript b/libs/surfaces/generic_midi/SConscript index 833f06923a..253718a368 100644 --- a/libs/surfaces/generic_midi/SConscript +++ b/libs/surfaces/generic_midi/SConscript @@ -30,6 +30,7 @@ genericmidi.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOUR genericmidi.Append(CXXFLAGS="-DDATA_DIR=\\\""+final_prefix+"/share\\\"") genericmidi.Append(CXXFLAGS="-DCONFIG_DIR=\\\""+final_config_prefix+"\\\"") genericmidi.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"") +genericmidi.Append(CPPPATH = libraries['jack'].get('CPPPATH', [])) genericmidi.Merge ([ libraries['ardour'], diff --git a/libs/surfaces/mackie/SConscript b/libs/surfaces/mackie/SConscript index 45ce63d3cd..655aba67ab 100644 --- a/libs/surfaces/mackie/SConscript +++ b/libs/surfaces/mackie/SConscript @@ -44,6 +44,7 @@ mackie.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE") mackie.Append(CXXFLAGS="-DDATA_DIR=\\\""+final_prefix+"/share\\\"") mackie.Append(CXXFLAGS="-DCONFIG_DIR=\\\""+final_config_prefix+"\\\"") mackie.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"") +mackie.Append(CPPPATH = libraries['jack'].get('CPPPATH', [])) mackie.Merge ([ libraries['ardour'], diff --git a/libs/surfaces/tranzport/SConscript b/libs/surfaces/tranzport/SConscript index fddd66c95d..9d46fe1817 100644 --- a/libs/surfaces/tranzport/SConscript +++ b/libs/surfaces/tranzport/SConscript @@ -52,6 +52,7 @@ tranzport.Append(CXXFLAGS="-DLOCALEDIR=\\\""+final_prefix+"/share/locale\\\"") # tranzport.Append(CXXFLAGS="-DHAVE_TRANZPORT_KERNEL_DRIVER=1") #merge more into tranzport files for the right io lib +tranzport.Append(CPPPATH = libraries['jack'].get('CPPPATH', [])) tranzport.Merge ([ libraries['ardour'], diff --git a/libs/vamp-plugins/SConscript b/libs/vamp-plugins/SConscript index d0796af092..36a0c55639 100644 --- a/libs/vamp-plugins/SConscript +++ b/libs/vamp-plugins/SConscript @@ -29,6 +29,9 @@ sources = plugin_files if vampplugs['AUBIO']: sources += aubio_files vampplugs.Merge ([libraries['aubio']]) + vampplugs.Merge ([libraries['fftw3f']]) +else: + print 'WARNING: some VAMP plugins will not be built because this machine has no AUBIO support' libvampplugins = vampplugs.SharedLibrary('ardourvampplugins', sources) |