do not allow smf_source's reads to stomp on cached read_end position in parent class...
[ardour.git] / libs / evoral / evoral / Sequence.hpp
index 30c1c1f0ca8e9360cf794ea3a4ca6401a393d6bc..df8c48a1b6047d5567224de7e5b9ddf5e1ea262e 100644 (file)
@@ -63,8 +63,6 @@ class Sequence : virtual public ControlSet {
 public:
        Sequence(const TypeMap& type_map, size_t size=0);
        
-       bool read_locked() { return _read_iter.locked(); }
-
        void write_lock();
        void write_unlock();
 
@@ -87,13 +85,21 @@ public:
        inline const boost::shared_ptr< Note<Time> >       note_at(size_t i)       { return _notes[i]; }
 
        inline size_t n_notes() const { return _notes.size(); }
-       inline bool   empty()   const { return _notes.size() == 0 && ControlSet::empty(); }
+       inline bool   empty()   const { return _notes.size() == 0 && ControlSet::controls_empty(); }
 
        inline static bool note_time_comparator(const boost::shared_ptr< const Note<Time> >& a,
                                                const boost::shared_ptr< const Note<Time> >& b) { 
                return a->time() < b->time();
        }
 
+       struct LaterNoteComparator {
+               typedef const Note<Time>* value_type;
+               inline bool operator()(const boost::shared_ptr< const Note<Time> > a,
+                                      const boost::shared_ptr< const Note<Time> > b) const { 
+                       return a->time() > b->time();
+               }
+       };
+
        struct LaterNoteEndComparator {
                typedef const Note<Time>* value_type;
                inline bool operator()(const boost::shared_ptr< const Note<Time> > a,
@@ -106,6 +112,8 @@ public:
        inline       Notes& notes()       { return _notes; }
        inline const Notes& notes() const { return _notes; }
 
+        void set_notes (const std::vector<boost::shared_ptr<Note<Time> > >&);
+
        typedef std::vector< boost::shared_ptr< Event<Time> > > SysExes;
        inline       SysExes& sysexes()       { return _sysexes; }
        inline const SysExes& sysexes() const { return _sysexes; }
@@ -126,6 +134,8 @@ public:
                
                inline bool valid() const { return !_is_end && _event; }
                inline bool locked() const { return _locked; }
+               
+               void invalidate();
 
                const Event<Time>& operator*()  const { return *_event;  }
                const boost::shared_ptr< Event<Time> > operator->() const  { return _event; }
@@ -159,9 +169,6 @@ public:
        const_iterator        begin(Time t=0) const { return const_iterator(*this, t); }
        const const_iterator& end()           const { return _end_iter; }
        
-       void read_seek(Time t) { _read_iter = begin(t); }
-       Time read_time() const { return _read_iter.valid() ? _read_iter->time() : 0.0; }
-
        bool control_to_midi_event(boost::shared_ptr< Event<Time> >& ev,
                                   const ControlIterator&            iter) const;
        
@@ -175,8 +182,7 @@ public:
        uint8_t highest_note() const { return _highest_note; }
        
 protected:
-       mutable const_iterator _read_iter;
-       bool                   _edited;
+       bool _edited;
 
 private:
        friend class const_iterator;