merge (w/fix) with master

This commit is contained in:
Paul Davis
2014-02-04 14:21:35 -05:00
9 changed files with 39 additions and 30 deletions

View File

@@ -159,7 +159,9 @@ PluginUIWindow::PluginUIWindow (
PluginUIWindow::~PluginUIWindow ()
{
#ifndef NDEBUG
cerr << "PluginWindow deleted for " << this << endl;
#endif
delete _pluginui;
}

View File

@@ -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) {
@@ -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; }

View File

@@ -47,16 +47,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; }
@@ -81,12 +74,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;
};

View File

@@ -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<TimeType> >;
uint8_t* _data; ///< timestamp, event, timestamp, event, ...
pframes_t _size;
};

View File

@@ -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;
}

View File

@@ -242,7 +242,7 @@ RouteExportChannel::read (Sample const *& data, framecnt_t frames) const
#ifndef NDEBUG
(void) frames;
#else
assert (frames <= (framecnt_t) buffer.size());
assert (frames <= (framecnt_t) buffer.capacity());
#endif
data = buffer.data();
}

View File

@@ -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;

View File

@@ -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());
@@ -1383,7 +1386,16 @@ Route::remove_processor (boost::shared_ptr<Processor> 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 */
@@ -1403,7 +1415,12 @@ Route::remove_processor (boost::shared_ptr<Processor> 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;
@@ -3069,6 +3086,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 ();
@@ -3154,12 +3172,16 @@ Route::listen_position_changed ()
boost::shared_ptr<CapturingProcessor>
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);
}
@@ -4139,7 +4161,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);

View File

@@ -407,7 +407,7 @@ VBAPanner::describe_parameter (Evoral::Parameter p)
{
switch (p.type()) {
case PanAzimuthAutomation:
return _("Direction");
return _("Azimuth");
case PanWidthAutomation:
return _("Width");
case PanElevationAutomation: