summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r--libs/ardour/ardour/automatable.h2
-rw-r--r--libs/ardour/ardour/automation_event.h7
-rw-r--r--libs/ardour/ardour/midi_event.h23
-rw-r--r--libs/ardour/ardour/midi_model.h35
-rw-r--r--libs/ardour/ardour/midi_ring_buffer.h2
5 files changed, 51 insertions, 18 deletions
diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h
index 574d7af129..fe47614a1f 100644
--- a/libs/ardour/ardour/automatable.h
+++ b/libs/ardour/ardour/automatable.h
@@ -52,7 +52,7 @@ public:
boost::shared_ptr<AutomationControl> control_factory(boost::shared_ptr<AutomationList> list);
typedef std::map<Parameter,boost::shared_ptr<AutomationControl> > Controls;
- Controls& controls() { return _controls; }
+ Controls& controls() { return _controls; }
const Controls& controls() const { return _controls; }
virtual void add_control(boost::shared_ptr<AutomationControl>);
diff --git a/libs/ardour/ardour/automation_event.h b/libs/ardour/ardour/automation_event.h
index e2a98e50b0..1831f5ca4d 100644
--- a/libs/ardour/ardour/automation_event.h
+++ b/libs/ardour/ardour/automation_event.h
@@ -234,7 +234,8 @@ class AutomationList : public PBD::StatefulDestructible
*/
double unlocked_eval (double x) const;
- bool rt_safe_earliest_event (double start, double end, double& x, double& y) const;
+ bool rt_safe_earliest_event (double start, double end, double& x, double& y, bool start_inclusive=false) const;
+ bool rt_safe_earliest_event_unlocked (double start, double end, double& x, double& y, bool start_inclusive=false) const;
Curve& curve() { return *_curve; }
const Curve& curve() const { return *_curve; }
@@ -256,8 +257,8 @@ class AutomationList : public PBD::StatefulDestructible
void build_search_cache_if_necessary(double start, double end) const;
- bool rt_safe_earliest_event_discrete (double start, double end, double& x, double& y) const;
- bool rt_safe_earliest_event_linear (double start, double end, double& x, double& y) const;
+ bool rt_safe_earliest_event_discrete_unlocked (double start, double end, double& x, double& y, bool inclusive) const;
+ bool rt_safe_earliest_event_linear_unlocked (double start, double end, double& x, double& y, bool inclusive) const;
AutomationList* cut_copy_clear (double, double, int op);
diff --git a/libs/ardour/ardour/midi_event.h b/libs/ardour/ardour/midi_event.h
index a04a19cec8..bd16440d05 100644
--- a/libs/ardour/ardour/midi_event.h
+++ b/libs/ardour/ardour/midi_event.h
@@ -96,16 +96,35 @@ struct MidiEvent {
_size = copy._size;
return *this;
}
+
+ inline bool operator==(const MidiEvent& other) const {
+ if (_time != other._time)
+ return false;
+
+ if (_size != other._size)
+ return false;
+
+ if (_buffer == other._buffer)
+ return true;
+
+ for (size_t i=0; i < _size; ++i)
+ if (_buffer[i] != other._buffer[i])
+ return false;
+
+ return true;
+ }
+
+ inline bool operator!=(const MidiEvent& other) const { return ! operator==(other); }
inline bool owns_buffer() const { return _owns_buffer; }
- inline void set_buffer(Byte* buf) {
+ inline void set_buffer(Byte* buf, bool own) {
if (_owns_buffer) {
free(_buffer);
_buffer = NULL;
}
_buffer = buf;
- _owns_buffer = false;
+ _owns_buffer = own;
}
#else
diff --git a/libs/ardour/ardour/midi_model.h b/libs/ardour/ardour/midi_model.h
index 41382b1be3..6337ca8e65 100644
--- a/libs/ardour/ardour/midi_model.h
+++ b/libs/ardour/ardour/midi_model.h
@@ -55,8 +55,8 @@ public:
// This is crap.
void write_lock() { _lock.writer_lock(); _automation_lock.lock(); }
void write_unlock() { _lock.writer_unlock(); _automation_lock.unlock(); }
- void read_lock() const { _lock.reader_lock(); _automation_lock.lock(); }
- void read_unlock() const { _lock.reader_unlock(); _automation_lock.unlock(); }
+ void read_lock() const { _lock.reader_lock(); /*_automation_lock.lock();*/ }
+ void read_unlock() const { _lock.reader_unlock(); /*_automation_lock.unlock();*/ }
void clear() { _notes.clear(); }
@@ -140,33 +140,41 @@ public:
/** Read iterator */
class const_iterator {
public:
- const_iterator(MidiModel& model, double t);
+ const_iterator(const MidiModel& model, double t);
~const_iterator();
- const MidiEvent& operator*() const { return _event; }
+ const MidiEvent& operator*() const { return _event; }
+ const MidiEvent* operator->() const { return &_event; }
const const_iterator& operator++(); // prefix only
+ bool operator==(const const_iterator& other) const;
+ bool operator!=(const const_iterator& other) const { return ! operator==(other); }
private:
- const MidiModel& _model;
+ const MidiModel* _model;
MidiEvent _event;
typedef std::priority_queue<const Note*,std::vector<const Note*>, LaterNoteEndComparator>
ActiveNotes;
mutable ActiveNotes _active_notes;
- Notes::iterator _note_iter;
-
- std::vector<MidiControlIterator> _control_iters;
+ bool _is_end;
+ bool _locked;
+ Notes::const_iterator _note_iter;
+ std::vector<MidiControlIterator> _control_iters;
+ std::vector<MidiControlIterator>::iterator _control_iter;
};
+ const_iterator begin() const { return const_iterator(*this, 0); }
+ const const_iterator& end() const { return _end_iter; }
+
private:
friend class DeltaCommand;
void add_note_unlocked(const Note& note);
void remove_note_unlocked(const Note& note);
friend class const_iterator;
- bool control_to_midi_event(MidiEvent& ev, const MidiControlIterator& iter);
+ bool control_to_midi_event(MidiEvent& ev, const MidiControlIterator& iter) const;
#ifndef NDEBUG
bool is_sorted() const;
@@ -185,14 +193,19 @@ private:
WriteNotes _write_notes;
bool _writing;
bool _edited;
-
+
+ const const_iterator _end_iter;
+
+ mutable nframes_t _next_read;
+ mutable const_iterator _read_iter;
+
// note state for read():
// (TODO: Remove and replace with iterator)
typedef std::priority_queue<const Note*,std::vector<const Note*>,
LaterNoteEndComparator> ActiveNotes;
- mutable ActiveNotes _active_notes;
+ //mutable ActiveNotes _active_notes;
};
} /* namespace ARDOUR */
diff --git a/libs/ardour/ardour/midi_ring_buffer.h b/libs/ardour/ardour/midi_ring_buffer.h
index 9389f962fc..a0078061ee 100644
--- a/libs/ardour/ardour/midi_ring_buffer.h
+++ b/libs/ardour/ardour/midi_ring_buffer.h
@@ -342,7 +342,7 @@ MidiRingBuffer::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes_t
}
} else {
- printf("MRB - SKIPPING EVENT (with time %f)\n", ev.time());
+ printf("MRB - SKIPPING EVENT AT TIME %f\n", ev.time());
}
}