summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/audioengine.h1
-rw-r--r--libs/ardour/ardour/playlist.h4
-rw-r--r--libs/ardour/ardour/port_insert.h12
-rw-r--r--libs/ardour/ardour/rc_configuration_vars.h2
-rw-r--r--libs/ardour/audioengine.cc14
-rw-r--r--libs/ardour/audioregion.cc14
-rw-r--r--libs/ardour/crossfade.cc1
-rw-r--r--libs/ardour/import.cc16
-rw-r--r--libs/ardour/ladspa_plugin.cc2
-rw-r--r--libs/ardour/playlist.cc41
-rw-r--r--libs/ardour/port_insert.cc84
-rw-r--r--libs/ardour/port_set.cc38
12 files changed, 198 insertions, 31 deletions
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index 6baa724cf2..e3fcb58fa1 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -247,7 +247,6 @@ _ the regular process() call to session->process() is not made.
nframes_t _processed_frames;
bool _freewheeling;
bool _freewheel_pending;
- bool _freewheel_thread_registered;
boost::function<int(nframes_t)> freewheel_action;
bool reconnect_on_halt;
int _usecs_per_cycle;
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h
index b6e8719ccd..5a6adda140 100644
--- a/libs/ardour/ardour/playlist.h
+++ b/libs/ardour/ardour/playlist.h
@@ -116,6 +116,7 @@ class Playlist : public SessionObject
bool used () const { return _refcnt != 0; }
bool set_name (const std::string& str);
+ int sort_id() { return _sort_id; }
const DataType& data_type() const { return _type; }
@@ -240,6 +241,7 @@ class Playlist : public SessionObject
std::set<boost::shared_ptr<Region> > all_regions; /* all regions ever added to this playlist */
PBD::ScopedConnectionList region_state_changed_connections;
DataType _type;
+ int _sort_id;
mutable gint block_notifications;
mutable gint ignore_state_changes;
mutable Glib::RecMutex region_lock;
@@ -289,6 +291,8 @@ class Playlist : public SessionObject
virtual void flush_notifications ();
void clear_pending ();
+ void _set_sort_id ();
+
void notify_region_removed (boost::shared_ptr<Region>);
void notify_region_added (boost::shared_ptr<Region>);
void notify_length_changed ();
diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h
index 5e50b4775e..2f39d8688e 100644
--- a/libs/ardour/ardour/port_insert.h
+++ b/libs/ardour/ardour/port_insert.h
@@ -29,6 +29,7 @@
#include "ardour/types.h"
class XMLNode;
+class MTDM;
namespace ARDOUR {
@@ -64,6 +65,12 @@ class PortInsert : public IOProcessor
uint32_t bit_slot() const { return bitslot; }
+ void start_latency_detection ();
+ void stop_latency_detection ();
+
+ MTDM* mtdm () const { return _mtdm; }
+ void set_measured_latency (nframes_t);
+
private:
/* disallow copy construction */
PortInsert (const PortInsert&);
@@ -71,7 +78,10 @@ class PortInsert : public IOProcessor
boost::shared_ptr<Delivery> _out;
uint32_t bitslot;
-};
+ MTDM* _mtdm;
+ bool _latency_detect;
+ nframes_t _latency_flush_frames;
+ nframes_t _measured_latency;};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h
index 98f4e2d1b7..823fb4e7f2 100644
--- a/libs/ardour/ardour/rc_configuration_vars.h
+++ b/libs/ardour/ardour/rc_configuration_vars.h
@@ -136,7 +136,7 @@ CONFIG_VARIABLE (bool, periodic_safety_backups, "periodic-safety-backups", true)
CONFIG_VARIABLE (uint32_t, periodic_safety_backup_interval, "periodic-safety-backup-interval", 120)
CONFIG_VARIABLE (float, automation_interval, "automation-interval", 50)
CONFIG_VARIABLE (bool, sync_all_route_ordering, "sync-all-route-ordering", true)
-CONFIG_VARIABLE (bool, only_copy_imported_files, "only-copy-imported-files", true)
+CONFIG_VARIABLE (bool, only_copy_imported_files, "only-copy-imported-files", false)
CONFIG_VARIABLE (bool, new_plugins_active, "new-plugins-active", true)
CONFIG_VARIABLE (std::string, keyboard_layout, "keyboard-layout", "ansi")
CONFIG_VARIABLE (std::string, default_bindings, "default-bindings", "ardour")
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index ba08e9f878..398a4936cc 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -76,7 +76,6 @@ AudioEngine::AudioEngine (string client_name)
_jack = 0;
_frame_rate = 0;
_buffer_size = 0;
- _freewheel_thread_registered = false;
_freewheeling = false;
m_meter_thread = 0;
@@ -1104,16 +1103,11 @@ AudioEngine::freewheel (bool onoff)
GET_PRIVATE_JACK_POINTER_RET (_jack, -1);
if (onoff != _freewheeling) {
-
- if (onoff) {
- _freewheel_thread_registered = false;
- }
-
- return jack_set_freewheel (_priv_jack, onoff);
-
+ return jack_set_freewheel (_priv_jack, onoff);
+
} else {
- /* already doing what has been asked for */
- return 0;
+ /* already doing what has been asked for */
+ return 0;
}
}
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index 2cdb0dfbd1..3430eb5128 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -1387,14 +1387,22 @@ AudioRegion::get_transients (AnalysisFeatureList& results, bool force_new)
/* no existing/complete transient info */
+ static bool analyse_dialog_shown = false; /* global per instance of Ardour */
+
if (!Config->get_auto_analyse_audio()) {
- pl->session().Dialog (_("\
-You have requested an operation that requires audio analysis.\n\n\
+ if (!analyse_dialog_shown) {
+ pl->session().Dialog (_("\
+You have requested an operation that requires audio analysis.\n\n \
You currently have \"auto-analyse-audio\" disabled, which means\n\
that transient data must be generated every time it is required.\n\n\
If you are doing work that will require transient data on a\n\
regular basis, you should probably enable \"auto-analyse-audio\"\n\
-then quit ardour and restart."));
++then quit ardour and restart.\n\n\
++This dialog will not display again. But you may notice a slight delay\n\
++in this and future transient-detection operations.\n\
++"));
+ analyse_dialog_shown = true;
+ }
}
TransientDetector t (pl->session().frame_rate());
diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc
index 4f20db5b35..276a42f77b 100644
--- a/libs/ardour/crossfade.cc
+++ b/libs/ardour/crossfade.cc
@@ -100,6 +100,7 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> in, boost::shared_ptr<Audio
_out = out;
_anchor_point = ap;
_fixed = true;
+ _follow_overlap = false;
initialize ();
}
diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc
index 035772305a..d6fa4e95bf 100644
--- a/libs/ardour/import.cc
+++ b/libs/ardour/import.cc
@@ -205,7 +205,7 @@ map_existing_mono_sources (const vector<string>& new_paths, Session& /*sess*/,
static bool
create_mono_sources_for_writing (const vector<string>& new_paths, Session& sess,
uint samplerate, vector<boost::shared_ptr<Source> >& newfiles,
- nframes64_t /*timeline_position*/)
+ framepos_t timeline_position)
{
for (vector<string>::const_iterator i = new_paths.begin(); i != new_paths.end(); ++i)
{
@@ -229,6 +229,14 @@ create_mono_sources_for_writing (const vector<string>& new_paths, Session& sess,
}
newfiles.push_back(boost::dynamic_pointer_cast<Source>(source));
+
+ /* for audio files, reset the timeline position so that any BWF-ish
+ information in the original files we are importing from is maintained.
+ */
+
+ boost::shared_ptr<AudioFileSource> afs;
+ afs = boost::dynamic_pointer_cast<AudioFileSource>(source);
+ afs->set_timeline_position(timeline_position);
}
return true;
}
@@ -425,13 +433,13 @@ Session::import_audiofiles (ImportStatus& status)
get_best_session_directory_for_new_source (),
channels);
Sources newfiles;
- nframes64_t natural_position = source ? source->natural_position() : 0;
+ framepos_t natural_position = source ? source->natural_position() : 0;
if (status.replace_existing_source) {
fatal << "THIS IS NOT IMPLEMENTED YET, IT SHOULD NEVER GET CALLED!!! DYING!" << endmsg;
status.cancel = !map_existing_mono_sources (new_paths, *this, frame_rate(), newfiles, this);
} else {
- status.cancel = !create_mono_sources_for_writing (new_paths, *this, frame_rate(), newfiles, natural_position);
+ status.cancel = !create_mono_sources_for_writing (new_paths, *this, frame_rate(), newfiles, natural_position);
}
// copy on cancel/failure so that any files that were created will be removed below
@@ -468,7 +476,7 @@ Session::import_audiofiles (ImportStatus& status)
for (Sources::iterator x = all_new_sources.begin(); x != all_new_sources.end(); ) {
if ((afs = boost::dynamic_pointer_cast<AudioFileSource>(*x)) != 0) {
- afs->update_header(0, *now, xnow);
+ afs->update_header((*x)->natural_position(), *now, xnow);
afs->done_with_peakfile_writes ();
/* now that there is data there, requeue the file for analysis */
diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc
index 7abcca2718..efbc97bc91 100644
--- a/libs/ardour/ladspa_plugin.cc
+++ b/libs/ardour/ladspa_plugin.cc
@@ -178,8 +178,6 @@ LadspaPlugin::default_value (uint32_t port)
sr_scaling = true;
}
- /* FIXME: add support for logarithmic defaults */
-
else if (LADSPA_IS_HINT_DEFAULT_LOW(prh[port].HintDescriptor)) {
if (LADSPA_IS_HINT_LOGARITHMIC(prh[port].HintDescriptor)) {
ret = exp(log(prh[port].LowerBound) * 0.75f + log(prh[port].UpperBound) * 0.25f);
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index 5cf0627448..5968f67f21 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -25,6 +25,8 @@
#include <string>
#include <climits>
+#include <boost/lexical_cast.hpp>
+
#include "pbd/failed_constructor.h"
#include "pbd/stateful_diff_command.h"
#include "pbd/xml++.h"
@@ -150,6 +152,7 @@ Playlist::Playlist (Session& sess, string nom, DataType type, bool hide)
init (hide);
first_set_state = false;
_name = nom;
+ _set_sort_id ();
}
@@ -164,6 +167,7 @@ Playlist::Playlist (Session& sess, const XMLNode& node, DataType type, bool hide
init (hide);
_name = "unnamed"; /* reset by set_state */
+ _set_sort_id ();
/* set state called by derived class */
}
@@ -359,6 +363,32 @@ Playlist::~Playlist ()
/* GoingAway must be emitted by derived classes */
}
+void
+Playlist::_set_sort_id ()
+{
+ /*
+ Playlists are given names like <track name>.<id>
+ or <track name>.<edit group name>.<id> where id
+ is an integer. We extract the id and sort by that.
+ */
+
+ size_t dot_position = _name.val().find_last_of(".");
+
+ if (dot_position == string::npos) {
+ _sort_id = 0;
+ } else {
+ string t = _name.val().substr(dot_position + 1);
+
+ try {
+ _sort_id = boost::lexical_cast<int>(t);
+ }
+
+ catch (boost::bad_lexical_cast e) {
+ _sort_id = 0;
+ }
+ }
+}
+
bool
Playlist::set_name (const string& str)
{
@@ -370,9 +400,13 @@ Playlist::set_name (const string& str)
if (_refcnt > 2) {
return false;
- } else {
- return SessionObject::set_name(str);
- }
+ }
+
+ bool ret = SessionObject::set_name(str);
+ if (ret) {
+ _set_sort_id ();
+ }
+ return ret;
}
/***********************************************************************
@@ -2121,6 +2155,7 @@ Playlist::set_state (const XMLNode& node, int version)
if (prop->name() == X_("name")) {
_name = prop->value();
+ _set_sort_id ();
} else if (prop->name() == X_("id")) {
_id = prop->value();
} else if (prop->name() == X_("orig_diskstream_id")) {
diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc
index dee661db41..fb688c6f84 100644
--- a/libs/ardour/port_insert.cc
+++ b/libs/ardour/port_insert.cc
@@ -23,14 +23,15 @@
#include "pbd/failed_constructor.h"
#include "pbd/xml++.h"
+#include "ardour/audioengine.h"
+#include "ardour/audio_port.h"
+#include "ardour/buffer_set.h"
#include "ardour/delivery.h"
-#include "ardour/port_insert.h"
+#include "ardour/mtdm.h"
#include "ardour/plugin.h"
#include "ardour/port.h"
+#include "ardour/port_insert.h"
#include "ardour/route.h"
-#include "ardour/buffer_set.h"
-
-#include "ardour/audioengine.h"
#include "ardour/session.h"
#include "ardour/types.h"
@@ -44,6 +45,11 @@ PortInsert::PortInsert (Session& s, boost::shared_ptr<MuteMaster> mm)
: IOProcessor (s, true, true, string_compose (_("insert %1"), (bitslot = s.next_insert_id()) + 1), "")
, _out (new Delivery (s, _output, mm, _name, Delivery::Insert))
{
+ _mtdm = 0;
+ _latency_detect = false;
+ _latency_flush_frames = false;
+ _measured_latency = 0;
+
ProcessorCreated (this); /* EMIT SIGNAL */
}
@@ -52,6 +58,11 @@ PortInsert::PortInsert (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLN
, _out (new Delivery (s, _output, mm, _name, Delivery::Insert))
{
+ _mtdm = 0;
+ _latency_detect = false;
+ _latency_flush_frames = false;
+ _measured_latency = 0;
+
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor();
}
@@ -61,6 +72,33 @@ PortInsert::PortInsert (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLN
PortInsert::~PortInsert ()
{
+ delete _mtdm;
+}
+
+void
+PortInsert::start_latency_detection ()
+{
+ if (_mtdm != 0) {
+ delete _mtdm;
+ }
+
+ _mtdm = new MTDM;
+ _latency_flush_frames = false;
+ _latency_detect = true;
+ _measured_latency = 0;
+}
+
+void
+PortInsert::stop_latency_detection ()
+{
+ _latency_flush_frames = signal_latency() + _session.engine().frames_per_cycle();
+ _latency_detect = false;
+}
+
+void
+PortInsert::set_measured_latency (nframes_t n)
+{
+ _measured_latency = n;
}
void
@@ -70,6 +108,38 @@ PortInsert::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nf
return;
}
+ if (_latency_detect) {
+
+ if (_input->n_ports().n_audio() != 0) {
+
+ AudioBuffer& outbuf (_output->ports().nth_audio_port(0)->get_audio_buffer (nframes));
+ Sample* in = _input->ports().nth_audio_port(0)->get_audio_buffer (nframes).data();
+ Sample* out = outbuf.data();
+
+ _mtdm->process (nframes, in, out);
+
+ outbuf.is_silent (false);
+ }
+
+ return;
+
+ } else if (_latency_flush_frames) {
+
+ /* wait for the entire input buffer to drain before picking up input again so that we can't
+ hear the remnants of whatever MTDM pumped into the pipeline.
+ */
+
+ silence (nframes);
+
+ if (_latency_flush_frames > nframes) {
+ _latency_flush_frames -= nframes;
+ } else {
+ _latency_flush_frames = 0;
+ }
+
+ return;
+ }
+
if (!_active && !_pending_active) {
/* deliver silence */
silence (nframes);
@@ -151,7 +221,11 @@ PortInsert::signal_latency() const
need to take that into account too.
*/
- return _session.engine().frames_per_cycle() + _input->signal_latency();
+ if (_measured_latency == 0) {
+ return _session.engine().frames_per_cycle() + _input->signal_latency();
+ } else {
+ return _measured_latency;
+ }
}
bool
diff --git a/libs/ardour/port_set.cc b/libs/ardour/port_set.cc
index b96e45662b..7648db00cb 100644
--- a/libs/ardour/port_set.cc
+++ b/libs/ardour/port_set.cc
@@ -16,6 +16,8 @@
675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/ustring.h>
+
#include "ardour/port_set.h"
#include "ardour/midi_port.h"
#include "ardour/audio_port.h"
@@ -30,7 +32,41 @@ PortSet::PortSet()
static bool sort_ports_by_name (Port* a, Port* b)
{
- return (a->name() < b->name());
+ Glib::ustring aname (a->name());
+ Glib::ustring bname (b->name());
+
+ Glib::ustring::size_type last_digit_position_a = aname.size();
+ Glib::ustring::const_reverse_iterator r_iterator = aname.rbegin();
+
+ while (r_iterator!= aname.rend() && Glib::Unicode::isdigit(*r_iterator)) {
+ r_iterator++;
+ last_digit_position_a--;
+ }
+
+ Glib::ustring::size_type last_digit_position_b = bname.size();
+ r_iterator = bname.rbegin();
+
+ while (r_iterator != bname.rend() && Glib::Unicode::isdigit(*r_iterator)) {
+ r_iterator++;
+ last_digit_position_b--;
+ }
+
+ // if some of the names don't have a number as posfix, compare as strings
+
+ if (last_digit_position_a == aname.size() or last_digit_position_b == bname.size()) {
+ return aname < bname;
+ }
+
+ const std::string prefix_a = aname.substr(0, last_digit_position_a - 1);
+ const unsigned int posfix_a = std::atoi(aname.substr(last_digit_position_a, aname.size() - last_digit_position_a).c_str());
+ const std::string prefix_b = bname.substr(0, last_digit_position_b - 1);
+ const unsigned int posfix_b = std::atoi(bname.substr(last_digit_position_b, bname.size() - last_digit_position_b).c_str());
+
+ if (prefix_a != prefix_b) {
+ return aname < bname;
+ } else {
+ return posfix_a < posfix_b;
+ }
}
void