mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 02:56:35 +01:00
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:
parent
41c128155a
commit
b0e91bfa08
14 changed files with 187 additions and 126 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue