From 12576a9f296d2f2fe6e7e57f9d7a1922aa38a21d Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 1 Feb 2014 23:06:24 +0100 Subject: forward port lv2_evbuf update (from jalv) --- libs/ardour/lv2_evbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/ardour/lv2_evbuf.c b/libs/ardour/lv2_evbuf.c index 8942d19a9b..f0e62d9b65 100644 --- a/libs/ardour/lv2_evbuf.c +++ b/libs/ardour/lv2_evbuf.c @@ -203,7 +203,7 @@ lv2_evbuf_get(LV2_Evbuf_Iterator iter, switch (iter.evbuf->type) { case LV2_EVBUF_EVENT: ebuf = &iter.evbuf->buf.event; - ev = (LV2_Event*)ebuf->data + iter.offset; + ev = (LV2_Event*)((char*)ebuf->data + iter.offset); *frames = ev->frames; *subframes = ev->subframes; *type = ev->type; -- cgit v1.2.3 From 9c0b62e2f3786ccaa2ceda3425d15bf8afc669d0 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 3 Feb 2014 15:09:17 +0100 Subject: fix processor_lock Only WriterLock requires to hold process_lock() as well otherwise Route::process_output_buffers() may deadlock --- libs/ardour/route.cc | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'libs') diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 9e649362ee..71af69fdee 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -419,6 +419,9 @@ Route::process_output_buffers (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, int declick, bool gain_automation_ok) { + /* Caller must hold process lock */ + assert (!AudioEngine::instance()->process_lock().trylock()); + Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK); assert(lm.locked()); @@ -1382,7 +1385,16 @@ Route::remove_processor (boost::shared_ptr processor, ProcessorStream { // TODO once the export point can be configured properly, do something smarter here if (processor == _capturing_processor) { + Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock (), Glib::Threads::NOT_LOCK); + if (need_process_lock) { + lx.acquire(); + } + _capturing_processor.reset(); + + if (need_process_lock) { + lx.release(); + } } /* these can never be removed */ @@ -1402,7 +1414,12 @@ Route::remove_processor (boost::shared_ptr processor, ProcessorStream if (need_process_lock) { lx.acquire(); } - Glib::Threads::RWLock::WriterLock lm (_processor_lock); + + /* Caller must hold process lock */ + assert (!AudioEngine::instance()->process_lock().trylock()); + + Glib::Threads::RWLock::WriterLock lm (_processor_lock); // XXX deadlock after export + ProcessorState pstate (this); ProcessorList::iterator i; @@ -3062,6 +3079,7 @@ Route::set_meter_point (MeterPoint p, bool force) bool meter_was_visible_to_user = _meter->display_to_user (); { + Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ()); Glib::Threads::RWLock::WriterLock lm (_processor_lock); maybe_note_meter_position (); @@ -3147,12 +3165,16 @@ Route::listen_position_changed () boost::shared_ptr Route::add_export_point() { + Glib::Threads::RWLock::ReaderLock lm (_processor_lock); if (!_capturing_processor) { + lm.release(); + Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ()); + Glib::Threads::RWLock::WriterLock lw (_processor_lock); _capturing_processor.reset (new CapturingProcessor (_session)); _capturing_processor->activate (); - configure_processors (0); + configure_processors_unlocked (0); } @@ -4132,7 +4154,7 @@ Route::non_realtime_locate (framepos_t pos) { //Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ()); - Glib::Threads::RWLock::WriterLock lm (_processor_lock); + Glib::Threads::RWLock::ReaderLock lm (_processor_lock); for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { (*i)->transport_located (pos); -- cgit v1.2.3 From 592be26a248bacda5bbe72d2da9e8539e5ce3915 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 3 Feb 2014 16:51:08 +0100 Subject: fix stem-export buffer-size check --- libs/ardour/export_channel.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/ardour/export_channel.cc b/libs/ardour/export_channel.cc index c67f33bb91..0e029a01f7 100644 --- a/libs/ardour/export_channel.cc +++ b/libs/ardour/export_channel.cc @@ -239,7 +239,7 @@ RouteExportChannel::read (Sample const *& data, framecnt_t frames) const { assert(processor); AudioBuffer const & buffer = processor->get_capture_buffers().get_audio (channel); - assert (frames <= (framecnt_t) buffer.size()); + assert (frames <= (framecnt_t) buffer.capacity()); data = buffer.data(); } -- cgit v1.2.3 From 74385d7267756e4101e9ffd59e319da972e72a76 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 3 Feb 2014 16:59:51 +0100 Subject: remove cruft - unused _size in audio-buffers --- libs/ardour/ardour/audio_buffer.h | 5 +---- libs/ardour/ardour/buffer.h | 12 ++---------- libs/ardour/ardour/midi_buffer.h | 3 +++ libs/ardour/audio_buffer.cc | 11 ++--------- 4 files changed, 8 insertions(+), 23 deletions(-) (limited to 'libs') diff --git a/libs/ardour/ardour/audio_buffer.h b/libs/ardour/ardour/audio_buffer.h index c356ed82b9..7752c614d5 100644 --- a/libs/ardour/ardour/audio_buffer.h +++ b/libs/ardour/ardour/audio_buffer.h @@ -173,7 +173,6 @@ public: void set_data (Sample* data, size_t size) { assert(!_owns_data); // prevent leaks _capacity = size; - _size = size; _data = data; _silent = false; _written = false; @@ -185,8 +184,6 @@ public: */ void resize (size_t nframes); - bool empty() const { return _size == 0; } - const Sample* data (framecnt_t offset = 0) const { assert(offset <= _capacity); return _data + offset; @@ -198,7 +195,7 @@ public: return _data + offset; } - bool check_silence (pframes_t, bool, pframes_t&) const; + bool check_silence (pframes_t, pframes_t&) const; void prepare () { _written = false; _silent = false; } bool written() const { return _written; } diff --git a/libs/ardour/ardour/buffer.h b/libs/ardour/ardour/buffer.h index 0d0f5d3758..87f7a90fc3 100644 --- a/libs/ardour/ardour/buffer.h +++ b/libs/ardour/ardour/buffer.h @@ -46,16 +46,9 @@ public: /** Factory function */ static Buffer* create(DataType type, size_t capacity); - /** Maximum capacity of buffer. - * Note in some cases the entire buffer may not contain valid data, use size. */ + /** Maximum capacity of buffer. */ size_t capacity() const { return _capacity; } - /** Amount of valid data in buffer. Use this over capacity almost always. */ - size_t size() const { return _size; } - - /** Return true if the buffer contains no data, false otherwise */ - virtual bool empty() const { return _size == 0; } - /** Type of this buffer. * Based on this you can static cast a Buffer* to the desired type. */ DataType type() const { return _type; } @@ -80,12 +73,11 @@ public: protected: Buffer(DataType type) - : _type(type), _capacity(0), _size(0), _silent (true) + : _type(type), _capacity(0), _silent (true) {} DataType _type; pframes_t _capacity; - pframes_t _size; bool _silent; }; diff --git a/libs/ardour/ardour/midi_buffer.h b/libs/ardour/ardour/midi_buffer.h index 781396a598..c67eef178a 100644 --- a/libs/ardour/ardour/midi_buffer.h +++ b/libs/ardour/ardour/midi_buffer.h @@ -48,6 +48,8 @@ public: uint8_t* reserve(TimeType time, size_t size); void resize(size_t); + size_t size() const { return _size; } + bool empty() const { return _size == 0; } bool merge_in_place(const MidiBuffer &other); @@ -159,6 +161,7 @@ private: friend class iterator_base< const MidiBuffer, const Evoral::MIDIEvent >; uint8_t* _data; ///< timestamp, event, timestamp, event, ... + pframes_t _size; }; diff --git a/libs/ardour/audio_buffer.cc b/libs/ardour/audio_buffer.cc index aa4f64755a..de2c1ddf00 100644 --- a/libs/ardour/audio_buffer.cc +++ b/libs/ardour/audio_buffer.cc @@ -57,12 +57,6 @@ AudioBuffer::resize (size_t size) if (_data && size < _capacity) { /* buffer is already large enough */ - - if (size < _size) { - /* truncate */ - _size = size; - } - return; } @@ -71,14 +65,13 @@ AudioBuffer::resize (size_t size) cache_aligned_malloc ((void**) &_data, sizeof (Sample) * size); _capacity = size; - _size = 0; _silent = false; } bool -AudioBuffer::check_silence (pframes_t nframes, bool wholebuffer, pframes_t& n) const +AudioBuffer::check_silence (pframes_t nframes, pframes_t& n) const { - for (n = 0; (wholebuffer || n < _size) && n < nframes; ++n) { + for (n = 0; n < nframes; ++n) { if (_data[n] != Sample (0)) { return false; } -- cgit v1.2.3 From 591ff9ceb662a0e1f79d4d951d50f86f6acc5de0 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 3 Feb 2014 16:52:36 +0100 Subject: update audio-buffer assert, take offset into account --- libs/ardour/ardour/audio_buffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/ardour/ardour/audio_buffer.h b/libs/ardour/ardour/audio_buffer.h index 7752c614d5..aaad961abb 100644 --- a/libs/ardour/ardour/audio_buffer.h +++ b/libs/ardour/ardour/audio_buffer.h @@ -62,7 +62,7 @@ public: assert(&src != this); assert(_capacity > 0); assert(src.type() == DataType::AUDIO); - assert(len <= _capacity); + assert(dst_offset + len <= _capacity); assert( src_offset <= ((framecnt_t) src.capacity()-len)); memcpy(_data + dst_offset, ((const AudioBuffer&)src).data() + src_offset, sizeof(Sample) * len); if (dst_offset == 0 && src_offset == 0 && len == _capacity) { -- cgit v1.2.3 From 371e8bdb55a85bed86748b46caf3d6edfdd9e3f5 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 3 Feb 2014 19:12:29 +0100 Subject: VBAP nomenclature s/Direction/Azimuth/ --- libs/panners/vbap/vbap.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/panners/vbap/vbap.cc b/libs/panners/vbap/vbap.cc index 8c1390832f..ea2d26fb31 100644 --- a/libs/panners/vbap/vbap.cc +++ b/libs/panners/vbap/vbap.cc @@ -403,7 +403,7 @@ VBAPanner::describe_parameter (Evoral::Parameter p) { switch (p.type()) { case PanAzimuthAutomation: - return _("Direction"); + return _("Azimuth"); case PanWidthAutomation: return _("Width"); case PanElevationAutomation: -- cgit v1.2.3