diff options
author | David Robillard <d@drobilla.net> | 2007-07-28 07:09:21 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-07-28 07:09:21 +0000 |
commit | 6e167cb1a835cb0b44990cc4c2b2a47db9dd2b9e (patch) | |
tree | e31d6aac9c2ca21a46f18a24822b47c2003aee4c /libs/ardour/midi_source.cc | |
parent | 71452634a711cfeae4cf7eb9fbe7667210a071f1 (diff) |
Playback from MIDI model, playback of clicked-in events.
Note the diskstream chunk size affects reading of clicked-in, so you may need to seek away and back again to have new events read (this will be fixed).
git-svn-id: svn://localhost/ardour2/trunk@2183 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_source.cc')
-rw-r--r-- | libs/ardour/midi_source.cc | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc index f2a3121be2..238bf4f481 100644 --- a/libs/ardour/midi_source.cc +++ b/libs/ardour/midi_source.cc @@ -99,7 +99,13 @@ nframes_t MidiSource::read (MidiRingBuffer& dst, nframes_t start, nframes_t cnt, nframes_t stamp_offset) const { Glib::Mutex::Lock lm (_lock); - return read_unlocked (dst, start, cnt, stamp_offset); + if (_model_loaded && _model) { + /*const size_t n_events = */_model->read(dst, start, cnt, stamp_offset); + //cout << "Read " << n_events << " events from model." << endl; + return cnt; + } else { + return read_unlocked (dst, start, cnt, stamp_offset); + } } nframes_t @@ -119,3 +125,26 @@ MidiSource::file_changed (string path) return ( !e1 ); } +void +MidiSource::mark_streaming_midi_write_started (NoteMode mode) +{ + if (_model) { + _model->set_note_mode(mode); + _model->start_write(); + } +} + +void +MidiSource::mark_streaming_write_started () +{ + if (_model) + _model->start_write(); +} + +void +MidiSource::mark_streaming_write_completed () +{ + if (_model) + _model->end_write(false); // FIXME: param? +} + |