Fix MIDI region loading.

Add model loading and destroying to SMFSource.
Load and display MIDI region data on session load.


git-svn-id: svn://localhost/ardour2/trunk@1947 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2007-06-03 20:06:01 +00:00
parent 41c128155a
commit b0e91bfa08
14 changed files with 187 additions and 126 deletions

View file

@ -754,3 +754,33 @@ SMFSource::read_var_len() const
return value;
}
void
SMFSource::load_model(bool lock)
{
if (lock)
Glib::Mutex::Lock lm (_lock);
_model.clear();
fseek(_fd, _header_size, 0);
nframes_t time = 0;
MidiEvent ev;
int ret;
while ((ret = read_event(ev)) >= 0) {
time += ev.time;
ev.time = time;
if (ret > 0) { // didn't skip (meta) event
_model.append(ev);
}
}
}
void
SMFSource::destroy_model()
{
_model.clear();
}