summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-08-16 19:58:34 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-08-16 19:58:34 +0000
commita4d9d09af5853f769e1143c2353806bfb7d89f58 (patch)
tree05dc35268557395124f130ec8b6d8e32c6e49b7b /libs/ardour
parent0b2f156c5850fb1c60aae25df4b9767bd7f92b89 (diff)
forward port 2.X changes up to and including rev 6714
git-svn-id: svn://localhost/ardour2/branches/3.0@7635 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/delivery.h2
-rw-r--r--libs/ardour/ardour/internal_return.h2
-rw-r--r--libs/ardour/ardour/internal_send.h2
-rw-r--r--libs/ardour/ardour/ladspa_plugin.h2
-rw-r--r--libs/ardour/ardour/lv2_plugin.h2
-rw-r--r--libs/ardour/ardour/plugin.h4
-rw-r--r--libs/ardour/ardour/plugin_insert.h3
-rw-r--r--libs/ardour/ardour/port_insert.h1
-rw-r--r--libs/ardour/ardour/processor.h4
-rw-r--r--libs/ardour/ardour/session.h2
-rw-r--r--libs/ardour/ardour/vst_plugin.h2
-rw-r--r--libs/ardour/audioengine.cc4
-rw-r--r--libs/ardour/audiofilesource.cc37
-rw-r--r--libs/ardour/caimportable.cc4
-rw-r--r--libs/ardour/delivery.cc2
-rw-r--r--libs/ardour/internal_return.cc3
-rw-r--r--libs/ardour/internal_send.cc3
-rw-r--r--libs/ardour/midi_model.cc7
-rw-r--r--libs/ardour/midi_track.cc2
-rw-r--r--libs/ardour/plugin_insert.cc18
-rw-r--r--libs/ardour/port_insert.cc33
-rw-r--r--libs/ardour/route.cc4
-rw-r--r--libs/ardour/session.cc23
-rw-r--r--libs/ardour/track.cc2
-rw-r--r--libs/ardour/vst_plugin.cc3
25 files changed, 132 insertions, 39 deletions
diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h
index bb07b9ab25..ec808a9820 100644
--- a/libs/ardour/ardour/delivery.h
+++ b/libs/ardour/ardour/delivery.h
@@ -70,7 +70,7 @@ public:
/* supplemental method used with MIDI */
- void flush (nframes_t nframes, nframes64_t time);
+ void flush_buffers (nframes_t nframes, nframes64_t time);
void transport_stopped ();
void no_outs_cuz_we_no_monitor(bool);
diff --git a/libs/ardour/ardour/internal_return.h b/libs/ardour/ardour/internal_return.h
index 25aba5415d..2b8e618337 100644
--- a/libs/ardour/ardour/internal_return.h
+++ b/libs/ardour/ardour/internal_return.h
@@ -41,7 +41,7 @@ class InternalReturn : public Return
void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool);
bool configure_io (ChanCount in, ChanCount out);
bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
- void set_block_size (nframes_t);
+ int set_block_size (nframes_t);
BufferSet* get_buffers();
void release_buffers();
diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h
index eabe263013..0764982a93 100644
--- a/libs/ardour/ardour/internal_send.h
+++ b/libs/ardour/ardour/internal_send.h
@@ -43,7 +43,7 @@ class InternalSend : public Send
bool feeds (boost::shared_ptr<Route> other) const;
bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
bool configure_io (ChanCount in, ChanCount out);
- void set_block_size (nframes_t);
+ int set_block_size (nframes_t);
boost::shared_ptr<Route> target_route() const { return _send_to; }
const PBD::ID& target_id() const { return _send_to_id; }
diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h
index bdad8009f5..f4da2bf0a0 100644
--- a/libs/ardour/ardour/ladspa_plugin.h
+++ b/libs/ardour/ardour/ladspa_plugin.h
@@ -81,7 +81,7 @@ class LadspaPlugin : public ARDOUR::Plugin
_descriptor->cleanup (_handle);
}
- void set_block_size (nframes_t /*nframes*/) {}
+ int set_block_size (nframes_t /*nframes*/) { return 0; }
int connect_and_run (BufferSet& bufs,
ChanMapping in, ChanMapping out,
diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h
index d42c34a546..329af1151f 100644
--- a/libs/ardour/ardour/lv2_plugin.h
+++ b/libs/ardour/ardour/lv2_plugin.h
@@ -94,7 +94,7 @@ class LV2Plugin : public ARDOUR::Plugin
_instance = NULL;
}
- void set_block_size (nframes_t /*nframes*/) {}
+ int set_block_size (nframes_t /*nframes*/) { return 0; }
int connect_and_run (BufferSet& bufs,
ChanMapping in, ChanMapping out,
diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h
index 8731697906..328f657b57 100644
--- a/libs/ardour/ardour/plugin.h
+++ b/libs/ardour/ardour/plugin.h
@@ -110,7 +110,9 @@ class Plugin : public PBD::StatefulDestructible, public Latent
virtual uint32_t nth_parameter (uint32_t which, bool& ok) const = 0;
virtual void activate () = 0;
virtual void deactivate () = 0;
- virtual void set_block_size (nframes_t nframes) = 0;
+ virtual void flush () { deactivate(); activate(); }
+
+ virtual int set_block_size (nframes_t nframes) = 0;
virtual int connect_and_run (BufferSet& bufs,
ChanMapping in, ChanMapping out,
diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h
index 6656f755cf..e4487eb6c0 100644
--- a/libs/ardour/ardour/plugin_insert.h
+++ b/libs/ardour/ardour/plugin_insert.h
@@ -57,8 +57,9 @@ class PluginInsert : public Processor
void activate ();
void deactivate ();
+ void flush ();
- void set_block_size (nframes_t nframes);
+ int set_block_size (nframes_t nframes);
ChanCount output_streams() const;
ChanCount input_streams() const;
diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h
index 097c96eb94..d30edc7162 100644
--- a/libs/ardour/ardour/port_insert.h
+++ b/libs/ardour/ardour/port_insert.h
@@ -69,6 +69,7 @@ class PortInsert : public IOProcessor
MTDM* mtdm () const { return _mtdm; }
void set_measured_latency (nframes_t);
+ nframes_t latency() const;
private:
/* disallow copy construction */
diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h
index 7d815c4f1c..e95bd57adf 100644
--- a/libs/ardour/ardour/processor.h
+++ b/libs/ardour/ardour/processor.h
@@ -65,7 +65,8 @@ class Processor : public SessionObject, public Automatable, public Latent
virtual void transport_stopped (sframes_t /*frame*/) {}
- virtual void set_block_size (nframes_t /*nframes*/) {}
+ virtual int set_block_size (nframes_t /*nframes*/) { return 0; }
+ virtual bool requires_fixed_sized_buffers() const { return false; }
/** @param result_required true if, on return from this method, bufs is required to contain valid data;
* if false, the method need not bother writing to bufs if it doesn't want to.
@@ -75,6 +76,7 @@ class Processor : public SessionObject, public Automatable, public Latent
virtual void activate () { _pending_active = true; ActiveChanged(); }
virtual void deactivate () { _pending_active = false; ActiveChanged(); }
+ virtual void flush() {}
virtual bool configure_io (ChanCount in, ChanCount out);
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 5a7a692691..4e3b025a4b 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -576,7 +576,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
/* flattening stuff */
- boost::shared_ptr<Region> write_one_track (AudioTrack&, nframes_t start, nframes_t end,
+ boost::shared_ptr<Region> write_one_track (AudioTrack&, framepos_t start, framepos_t end,
bool overwrite, std::vector<boost::shared_ptr<Source> >&, InterThreadInfo& wot,
bool enable_processing = true);
int freeze_all (InterThreadInfo&);
diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h
index 07417baa81..a06c3667f5 100644
--- a/libs/ardour/ardour/vst_plugin.h
+++ b/libs/ardour/ardour/vst_plugin.h
@@ -64,7 +64,7 @@ class VSTPlugin : public ARDOUR::Plugin
uint32_t nth_parameter (uint32_t port, bool& ok) const;
void activate ();
void deactivate ();
- void set_block_size (nframes_t nframes);
+ int set_block_size (nframes_t nframes);
int connect_and_run (BufferSet&,
ChanMapping in, ChanMapping out,
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 301b3e3ce2..12f0254ec2 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -266,6 +266,10 @@ AudioEngine::stop (bool forever)
}
}
+ if (forever) {
+ stop_metering_thread ();
+ }
+
return _running ? -1 : 0;
}
diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc
index c783b47b9b..0ccbaf3154 100644
--- a/libs/ardour/audiofilesource.cc
+++ b/libs/ardour/audiofilesource.cc
@@ -339,27 +339,42 @@ bool
AudioFileSource::safe_audio_file_extension(const ustring& file)
{
const char* suffixes[] = {
- ".wav", ".WAV",
- ".aiff", ".AIFF",
- ".caf", ".CAF",
".aif", ".AIF",
+ ".aifc", ".AIFC",
+ ".aiff", ".AIFF",
".amb", ".AMB",
- ".snd", ".SND",
".au", ".AU",
- ".raw", ".RAW",
- ".sf", ".SF",
+ ".caf", ".CAF",
".cdr", ".CDR",
+ ".flac", ".FLAC",
+ ".htk", ".HTK",
+ ".iff", ".IFF",
+ ".mat", ".MAT",
+ ".oga", ".OGA",
+ ".ogg", ".OGG",
+ ".paf", ".PAF",
+ ".pvf", ".PVF",
+ ".sf", ".SF",
".smp", ".SMP",
+ ".snd", ".SND",
".maud", ".MAUD",
+ ".voc", ".VOC"
".vwe", ".VWE",
- ".paf", ".PAF",
- ".voc", ".VOC",
- ".ogg", ".OGG",
- ".flac", ".FLAC",
+ ".w64", ".W64",
+ ".wav", ".WAV",
#ifdef HAVE_COREAUDIO
- ".mp3", ".MP3",
".aac", ".AAC",
+ ".adts", ".ADTS",
+ ".ac3", ".AC3",
+ ".amr", ".AMR",
+ ".mpa", ".MPA",
+ ".mpeg", ".MPEG",
+ ".mp1", ".MP1",
+ ".mp2", ".MP2",
+ ".mp3", ".MP3",
".mp4", ".MP4",
+ ".m4a", ".M4A",
+ ".sd2", ".SD2", // libsndfile supports sd2 also, but the resource fork is required to open.
#endif // HAVE_COREAUDIO
};
diff --git a/libs/ardour/caimportable.cc b/libs/ardour/caimportable.cc
index f5a70a5f6a..71927c95e5 100644
--- a/libs/ardour/caimportable.cc
+++ b/libs/ardour/caimportable.cc
@@ -24,7 +24,9 @@ CAImportableSource::CAImportableSource (const string& path)
af.SetClientFormat (client_format);
} catch (CAXException& cax) {
- error << string_compose ("CAImportable: %1", cax.mOperation) << endmsg;
+ //Don't report an error here since there is one higher up in import.
+ //Since libsndfile gets tried second, any failures here may show as
+ //invalid errors in the Error log.
throw failed_constructor ();
}
diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc
index e6c93e5297..d5c982c0cc 100644
--- a/libs/ardour/delivery.cc
+++ b/libs/ardour/delivery.cc
@@ -441,7 +441,7 @@ Delivery::transport_stopped (sframes_t frame)
}
void
-Delivery::flush (nframes_t nframes, nframes64_t time)
+Delivery::flush_buffers (nframes_t nframes, nframes64_t time)
{
/* io_lock, not taken: function must be called from Session::process() calltree */
diff --git a/libs/ardour/internal_return.cc b/libs/ardour/internal_return.cc
index 280568131f..e1f39b79a3 100644
--- a/libs/ardour/internal_return.cc
+++ b/libs/ardour/internal_return.cc
@@ -62,10 +62,11 @@ InternalReturn::configure_io (ChanCount in, ChanCount out)
return true;
}
-void
+int
InternalReturn::set_block_size (nframes_t nframes)
{
allocate_buffers (nframes);
+ return 0;
}
void
diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc
index 3662171740..a1425e3059 100644
--- a/libs/ardour/internal_send.cc
+++ b/libs/ardour/internal_send.cc
@@ -145,10 +145,11 @@ InternalSend::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame,
_active = _pending_active;
}
-void
+int
InternalSend::set_block_size (nframes_t nframes)
{
mixbufs.ensure_buffers (_configured_input, nframes);
+ return 0;
}
bool
diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc
index 39daaacdea..c93993aef8 100644
--- a/libs/ardour/midi_model.cc
+++ b/libs/ardour/midi_model.cc
@@ -909,6 +909,8 @@ MidiModel::resolve_overlaps_unlocked (const NotePtr note, void* arg)
TimeType note_time = note->time();
TimeType note_length = note->length();
+ DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 checking overlaps for note %2 @ %3\n", this, (int)note->note(), note->time()));
+
for (Pitches::const_iterator i = p.lower_bound (search_note);
i != p.end() && (*i)->note() == note->note(); ++i) {
@@ -916,6 +918,7 @@ MidiModel::resolve_overlaps_unlocked (const NotePtr note, void* arg)
TimeType eb = (*i)->end_time();
OverlapType overlap = OverlapNone;
+
if ((sb > sa) && (eb <= ea)) {
overlap = OverlapInternal;
} else if ((eb >= sa) && (eb <= ea)) {
@@ -929,7 +932,11 @@ MidiModel::resolve_overlaps_unlocked (const NotePtr note, void* arg)
continue;
}
+ DEBUG_TRACE (DEBUG::Sequence, string_compose ("\toverlap is %1 for (%2,%3) vs (%4,%5)\n", enum_2_string(overlap),
+ sa, ea, sb, eb));
+
if (insert_merge_policy() == InsertMergeReject) {
+ DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 just reject\n", this));
return -1;
}
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc
index 780243f18b..25418ec968 100644
--- a/libs/ardour/midi_track.cc
+++ b/libs/ardour/midi_track.cc
@@ -375,7 +375,7 @@ MidiTrack::roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame
}
- _main_outs->flush (nframes, end_frame - start_frame - 1);
+ _main_outs->flush_buffers (nframes, end_frame - start_frame - 1);
return 0;
}
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index d1f09dd0a8..73655b24b1 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -221,12 +221,16 @@ PluginInsert::parameter_changed (Evoral::Parameter which, float val)
}
}
-void
+int
PluginInsert::set_block_size (nframes_t nframes)
{
+ int ret = 0;
for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
- (*i)->set_block_size (nframes);
+ if ((*i)->set_block_size (nframes) != 0) {
+ ret = -1;
+ }
}
+ return ret;
}
void
@@ -250,6 +254,14 @@ PluginInsert::deactivate ()
}
void
+PluginInsert::flush ()
+{
+ for (vector<boost::shared_ptr<Plugin> >::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
+ (*i)->flush ();
+ }
+}
+
+void
PluginInsert::connect_and_run (BufferSet& bufs, nframes_t nframes, nframes_t offset, bool with_auto, nframes_t now)
{
// Calculate if, and how many frames we need to collect for analysis
@@ -436,7 +448,7 @@ PluginInsert::automation_run (BufferSet& bufs, nframes_t nframes)
return;
}
- if (!find_next_event (now, end, next_event)) {
+ if (!find_next_event (now, end, next_event) || requires_fixed_sized_buffers()) {
/* no events have a time within the relevant range */
diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc
index 7a484e2e67..087d2577ad 100644
--- a/libs/ardour/port_insert.cc
+++ b/libs/ardour/port_insert.cc
@@ -83,6 +83,23 @@ PortInsert::set_measured_latency (nframes_t n)
_measured_latency = n;
}
+nframes_t
+PortInsert::latency() const
+{
+ /* because we deliver and collect within the same cycle,
+ all I/O is necessarily delayed by at least frames_per_cycle().
+
+ if the return port for insert has its own latency, we
+ need to take that into account too.
+ */
+
+ if (_measured_latency == 0) {
+ return _session.engine().frames_per_cycle() + _input->latency();
+ } else {
+ return _measured_latency;
+ }
+}
+
void
PortInsert::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool)
{
@@ -149,6 +166,10 @@ PortInsert::state (bool full)
node.add_property ("type", "port");
snprintf (buf, sizeof (buf), "%" PRIu32, bitslot);
node.add_property ("bitslot", buf);
+ snprintf (buf, sizeof (buf), "%u", _measured_latency);
+ node.add_property("latency", buf);
+ snprintf (buf, sizeof (buf), "%u", _session.get_block_size());
+ node.add_property("block_size", buf);
return node;
}
@@ -183,6 +204,18 @@ PortInsert::set_state (const XMLNode& node, int version)
return -1;
}
+ uint32_t blocksize = 0;
+ if ((prop = node.property ("block_size")) != 0) {
+ sscanf (prop->value().c_str(), "%u", &blocksize);
+ }
+
+ //if the jack period is the same as when the value was saved, we can recall our latency..
+ if ( (_session.get_block_size() == blocksize) && (prop = node.property ("latency")) != 0) {
+ uint32_t latency = 0;
+ sscanf (prop->value().c_str(), "%u", &latency);
+ _measured_latency = latency;
+ }
+
if ((prop = node.property ("bitslot")) == 0) {
bitslot = _session.next_insert_id();
} else {
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 51ceead688..0f9e7ba241 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -2635,6 +2635,7 @@ Route::handle_transport_stopped (bool /*abort_ignored*/, bool did_locate, bool c
if (Config->get_plugins_stop_with_transport() && can_flush_processors) {
(*i)->deactivate ();
(*i)->activate ();
+ (*i)->flush ();
}
(*i)->transport_stopped (now);
@@ -2827,8 +2828,7 @@ Route::flush_processors ()
Glib::RWLock::ReaderLock lm (_processor_lock);
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
- (*i)->deactivate ();
- (*i)->activate ();
+ (*i)->flush ();
}
}
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 2989e14afa..ea4ae4c12c 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -3532,7 +3532,7 @@ Session::freeze_all (InterThreadInfo& itt)
}
boost::shared_ptr<Region>
-Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end,
+Session::write_one_track (AudioTrack& track, framepos_t start, framepos_t end,
bool /*overwrite*/, vector<boost::shared_ptr<Source> >& srcs,
InterThreadInfo& itt, bool enable_processing)
{
@@ -3542,13 +3542,14 @@ Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end,
uint32_t x;
char buf[PATH_MAX+1];
ChanCount nchans(track.n_channels());
- nframes_t position;
- nframes_t this_chunk;
- nframes_t to_do;
+ framepos_t position;
+ framecnt_t this_chunk;
+ framepos_t to_do;
BufferSet buffers;
SessionDirectory sdir(get_best_session_directory_for_new_source ());
const string sound_dir = sdir.sound_path().to_string();
- nframes_t len = end - start;
+ framepos_t len = end - start;
+ bool need_block_size_reset = false;
string ext;
if (end <= start) {
@@ -3557,7 +3558,7 @@ Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end,
return result;
}
- const nframes_t chunk_size = (256 * 1024)/4;
+ const framecnt_t chunk_size = (256 * 1024)/4;
// block all process callback handling
@@ -3604,6 +3605,11 @@ Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end,
srcs.push_back (fsource);
}
+ /* tell redirects that care that we are about to use a much larger blocksize */
+
+ need_block_size_reset = true;
+ track.set_block_size (chunk_size);
+
/* XXX need to flush all redirects */
position = start;
@@ -3694,6 +3700,11 @@ Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end,
}
}
+
+ if (need_block_size_reset) {
+ track.set_block_size (get_block_size());
+ }
+
unblock_processing ();
return result;
diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc
index 0e1248db49..2e7290b77a 100644
--- a/libs/ardour/track.cc
+++ b/libs/ardour/track.cc
@@ -328,7 +328,7 @@ Track::no_roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame,
passthru (start_frame, end_frame, nframes, false);
}
- _main_outs->flush (nframes, end_frame - start_frame - 1);
+ _main_outs->flush_buffers (nframes, end_frame - start_frame - 1);
return 0;
}
diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc
index e3953314b6..b978c7993a 100644
--- a/libs/ardour/vst_plugin.cc
+++ b/libs/ardour/vst_plugin.cc
@@ -107,12 +107,13 @@ VSTPlugin::~VSTPlugin ()
fst_close (_fst);
}
-void
+int
VSTPlugin::set_block_size (nframes_t nframes)
{
deactivate ();
_plugin->dispatcher (_plugin, effSetBlockSize, 0, nframes, NULL, 0.0f);
activate ();
+ return 0;
}
float