Use nframes_t for timestamps of real (jack) time MIDI events (i.e. in MidiBuffer and MidiRingBuffer).

Use iterator interface of Sequence to read events in a MIDISource rather than Sequence::read, avoiding timestamp confusion.
Disable no longer useful Sequence::read.


git-svn-id: svn://localhost/ardour2/branches/3.0@4570 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2009-02-15 01:24:26 +00:00
parent aefa9f0938
commit 5a48f99f72
19 changed files with 99 additions and 58 deletions

View file

@ -69,6 +69,15 @@ static ostream& errorout = cerr;
// Read iterator (const_iterator)
template<typename Time>
Sequence<Time>::const_iterator::const_iterator()
: _seq(NULL)
, _is_end(true)
, _locked(false)
{
_event = boost::shared_ptr< Event<Time> >(new Event<Time>());
}
template<typename Time>
Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t)
: _seq(&seq)
@ -395,8 +404,13 @@ template<typename Time>
typename Sequence<Time>::const_iterator&
Sequence<Time>::const_iterator::operator=(const const_iterator& other)
{
if (_locked && _seq != other._seq) {
_seq->read_unlock();
if (_seq != other._seq) {
if (_locked) {
_seq->read_unlock();
}
if (other._locked) {
other._seq->read_lock();
}
}
_seq = other._seq;
@ -434,7 +448,7 @@ Sequence<Time>::Sequence(const TypeMap& type_map, size_t size)
, _notes(size)
, _writing(false)
, _end_iter(*this, DBL_MAX)
, _next_read(UINT32_MAX)
// , _next_read(UINT32_MAX)
, _percussive(false)
, _lowest_note(127)
, _highest_note(0)
@ -446,6 +460,7 @@ Sequence<Time>::Sequence(const TypeMap& type_map, size_t size)
assert( ! _end_iter._locked);
}
#if 0
/** Read events in frame range \a start .. \a (start + dur) into \a dst,
* adding \a offset to each event's timestamp.
* \return number of events written to \a dst
@ -497,6 +512,7 @@ Sequence<Time>::read(EventSink<Time>& dst, Time start, Time dur, Time offset) co
return read_events;
}
#endif
/** Write the controller event pointed to by \a iter to \a ev.
* The buffer of \a ev will be allocated or resized as necessary.
@ -582,7 +598,7 @@ Sequence<Time>::clear()
_notes.clear();
for (Controls::iterator li = _controls.begin(); li != _controls.end(); ++li)
li->second->list()->clear();
_next_read = 0;
// _next_read = 0;
_read_iter = end();
_lock.writer_unlock();
}