23 #ifndef EVORAL_SEQUENCE_HPP
24 #define EVORAL_SEQUENCE_HPP
33 #include <glibmm/threads.h>
45 template<
typename Time>
class EventSink;
46 template<
typename Time>
class Note;
47 template<
typename Time>
class Event;
59 std::shared_ptr<const ControlList>
list;
68 template<
typename Time>
77 : sequence_lock(new
Glib::
Threads::RWLock::WriterLock(s))
89 typedef typename std::shared_ptr<Evoral::Note<Time> >
NotePtr;
90 typedef typename std::weak_ptr<Evoral::Note<Time> >
WeakNotePtr;
91 typedef typename std::shared_ptr<const Evoral::Note<Time> >
constNotePtr;
92 typedef typename std::set<WeakNotePtr, std::owner_less<WeakNotePtr> >
WeakActiveNotes;
94 typedef std::shared_ptr<Glib::Threads::RWLock::ReaderLock>
ReadLock;
117 inline size_t n_notes()
const {
return _notes.size(); }
121 const std::shared_ptr<
const Note<Time> >& b) {
122 return a->time() < b->time();
127 const std::shared_ptr<
const Note<Time> > b)
const {
128 return a->note() < b->note();
134 const std::shared_ptr<
const Note<Time> > b)
const {
135 return a->time() < b->time();
140 struct LaterNoteComparator {
142 inline bool operator()(
const std::shared_ptr<
const Note<Time> > a,
143 const std::shared_ptr<
const Note<Time> > b)
const {
144 return a->
time() > b->time();
152 const std::shared_ptr<
const Note<Time> > b)
const {
153 return a->end_time() > b->end_time();
157 typedef std::multiset<NotePtr, EarlierNoteComparator>
Notes;
197 return a->time() < b->time();
201 typedef std::multiset<SysExPtr, EarlierSysExComparator>
SysExes;
210 return a->time() < b->time();
214 typedef std::multiset<PatchChangePtr, EarlierPatchChangeComparator>
PatchChanges;
229 std::set<Evoral::Parameter>
const & filtered,
232 inline bool valid()
const {
return !_is_end && _event; }
237 const std::shared_ptr< const Event<Time> >
operator->()
const {
return _event; }
277 bool force_discrete =
false,
278 const std::set<Evoral::Parameter>& f = std::set<Evoral::Parameter>(),
280 return const_iterator (*
this, t, force_discrete, f, active_notes);
324 mutable Glib::Threads::RWLock
_lock;
331 typedef std::multiset<NotePtr, NoteNumberComparator>
Pitches;
358 typedef std::multiset<NotePtr, EarlierNoteComparator>
WriteNotes;
std::ostream & operator<<(std::ostream &o, const Evoral::Sequence< Time > &s)
std::shared_ptr< const ControlList > list
ControlIterator(std::shared_ptr< const ControlList > al, Temporal::timepos_t const &ax, double ay)
virtual bool controls_empty() const
const Event< Time > & operator*() const
void get_active_notes(WeakActiveNotes &) const
const_iterator & operator=(const const_iterator &other)
ControlIterators _control_iters
Time choose_next(Time earliest_t)
const Sequence< Time > * _seq
int _active_patch_change_message
PatchChanges::const_iterator _patch_change_iter
SysExes::const_iterator _sysex_iter
bool operator==(const const_iterator &other) const
std::vector< ControlIterator > ControlIterators
const std::shared_ptr< const Event< Time > > operator->() const
ActiveNotes _active_notes
const const_iterator & operator++()
Notes::const_iterator _note_iter
bool operator!=(const const_iterator &other) const
ControlIterators::iterator _control_iter
const_iterator(const Sequence< Time > &seq, Time t, bool force_discrete, std::set< Evoral::Parameter > const &filtered, WeakActiveNotes const *active_notes=0)
void invalidate(bool preserve_notes)
std::shared_ptr< Event< Time > > _event
PatchChanges::const_iterator patch_change_lower_bound(Time t) const
std::shared_ptr< const Event< Time > > constSysExPtr
bool overlapping_pitches_accepted() const
const_iterator begin(Time t=Time(), bool force_discrete=false, const std::set< Evoral::Parameter > &f=std::set< Evoral::Parameter >(), WeakActiveNotes const *active_notes=0) const
OverlapPitchResolution _overlap_pitch_resolution
bool add_note_unlocked(const NotePtr note, void *arg=0)
std::multiset< NotePtr, EarlierNoteComparator > WriteNotes
Notes::const_iterator note_lower_bound(Time t) const
void set_notes(const typename Sequence< Time >::Notes &n)
std::shared_ptr< const Evoral::Note< Time > > constNotePtr
SysExes::iterator sysex_lower_bound(Time t)
static bool note_time_comparator(const std::shared_ptr< const Note< Time > > &a, const std::shared_ptr< const Note< Time > > &b)
const Pitches & pitches(uint8_t chan) const
void set_duration(Time const &)
void append_note_on_unlocked(const Event< Time > &event, Evoral::event_id_t)
std::shared_ptr< PatchChange< Time > > PatchChangePtr
bool _overlapping_pitches_accepted
const PatchChanges & patch_changes() const
void get_notes(Notes &, NoteOperator, uint8_t val, int chan_mask=0) const
const const_iterator _end_iter
OverlapPitchResolution overlap_pitch_resolution() const
std::priority_queue< NotePtr, std::deque< NotePtr >, LaterNoteEndComparator > ActiveNotes
std::shared_ptr< const PatchChange< Time > > constPatchChangePtr
uint8_t highest_note() const
Notes::iterator note_lower_bound(Time t)
const SysExes & sysexes() const
virtual ReadLock read_lock() const
PatchChanges & patch_changes()
const const_iterator & end() const
void dump(std::ostream &, const_iterator x, uint32_t limit=0) const
void append_sysex_unlocked(const Event< Time > &ev, Evoral::event_id_t)
void remove_note_unlocked(const constNotePtr note)
PatchChanges _patch_changes
void end_write(StuckNoteOption, Time when=Time())
void remove_overlapping_notes()
std::multiset< SysExPtr, EarlierSysExComparator > SysExes
PatchChanges::iterator patch_change_lower_bound(Time t)
@ VelocityGreaterThanOrEqual
@ VelocityLessThanOrEqual
@ PitchGreaterThanOrEqual
void overlapping_pitches_accepted(bool yn)
void add_sysex_unlocked(const SysExPtr)
void trim_overlapping_notes()
bool contains(const NotePtr &ev) const
std::multiset< NotePtr, NoteNumberComparator > Pitches
virtual WriteLock write_lock()
uint8_t lowest_note() const
bool control_to_midi_event(std::shared_ptr< Event< Time > > &ev, const ControlIterator &iter) const
const Notes & notes() const
Sequence(const Sequence< Time > &other)
std::multiset< NotePtr, EarlierNoteComparator > Notes
std::shared_ptr< Glib::Threads::RWLock::ReaderLock > ReadLock
void get_notes_by_velocity(Notes &, NoteOperator, uint8_t val, int chan_mask=0) const
void update_duration_unlocked(Time const &, bool can_shorten=false)
std::set< WeakNotePtr, std::owner_less< WeakNotePtr > > WeakActiveNotes
void remove_duplicate_notes()
void append(const Event< Time > &ev, Evoral::event_id_t evid)
bool contains_unlocked(const NotePtr &ev) const
SysExes::const_iterator sysex_lower_bound(Time t) const
Glib::Threads::RWLock _lock
void remove_sysex_unlocked(const SysExPtr)
const TypeMap & type_map() const
void append_patch_change_unlocked(const PatchChange< Time > &, Evoral::event_id_t)
const TypeMap & _type_map
Sequence(const TypeMap &type_map)
void append_control_unlocked(const Parameter ¶m, Time time, double value, Evoral::event_id_t)
void append_note_off_unlocked(const Event< Time > &event)
std::shared_ptr< Event< Time > > SysExPtr
std::shared_ptr< Evoral::Note< Time > > NotePtr
std::weak_ptr< Evoral::Note< Time > > WeakNotePtr
void get_notes_by_pitch(Notes &, NoteOperator, uint8_t val, int chan_mask=0) const
void remove_patch_change_unlocked(const constPatchChangePtr)
void set_overlap_pitch_resolution(OverlapPitchResolution opr)
Pitches & pitches(uint8_t chan)
virtual void control_list_marked_dirty()
void add_patch_change_unlocked(const PatchChangePtr)
std::multiset< PatchChangePtr, EarlierPatchChangeComparator > PatchChanges
std::shared_ptr< WriteLockImpl > WriteLock
virtual int resolve_overlaps_unlocked(const NotePtr, void *=0)
bool operator==(const ProcessorSelection &a, const ProcessorSelection &b)
bool operator()(const std::shared_ptr< const Note< Time > > a, const std::shared_ptr< const Note< Time > > b) const
bool operator()(const std::shared_ptr< const Note< Time > > a, const std::shared_ptr< const Note< Time > > b) const
const Note< Time > * value_type
bool operator()(const std::shared_ptr< const Note< Time > > a, const std::shared_ptr< const Note< Time > > b) const
Glib::Threads::Mutex::Lock * control_lock
WriteLockImpl(Glib::Threads::RWLock &s, Glib::Threads::Mutex &c)
Glib::Threads::RWLock::WriterLock * sequence_lock