diff options
author | David Robillard <d@drobilla.net> | 2006-08-16 20:36:14 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-08-16 20:36:14 +0000 |
commit | 7250433f50236a05fc652fa41c23bf53fbf6a0fd (patch) | |
tree | 0371dfe1b6ce5a9eb1769d10505a6ca658ca1a7b /libs/ardour/midi_playlist.cc | |
parent | 5952c48a848926edb02b5d630e36cc461c893964 (diff) |
Progress on the disk side of things:
- MidiRingBuffer implementation
- MidiDiskstream reading from playlists
- MidiPlaylist reading from regions
- MidiRegions returning random notes for the time being, but the inter-thread stuff works..
Horrible awful mess, not really commit worthy, but I need to move machines.
Nothing to see here.. :)
git-svn-id: svn://localhost/ardour2/branches/midi@835 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_playlist.cc')
-rw-r--r-- | libs/ardour/midi_playlist.cc | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/libs/ardour/midi_playlist.cc b/libs/ardour/midi_playlist.cc index 582df6f5be..051203e55e 100644 --- a/libs/ardour/midi_playlist.cc +++ b/libs/ardour/midi_playlist.cc @@ -30,6 +30,7 @@ #include <ardour/midi_playlist.h> #include <ardour/midi_region.h> #include <ardour/session.h> +#include <ardour/midi_ring_buffer.h> #include <pbd/error.h> @@ -118,8 +119,8 @@ MidiPlaylist::MidiPlaylist (const MidiPlaylist& other, string name, bool hidden) } } -MidiPlaylist::MidiPlaylist (const MidiPlaylist& other, jack_nframes_t start, jack_nframes_t cnt, string name, bool hidden) - : Playlist (other, start, cnt, name, hidden) +MidiPlaylist::MidiPlaylist (const MidiPlaylist& other, jack_nframes_t start, jack_nframes_t dur, string name, bool hidden) + : Playlist (other, start, dur, name, hidden) { save_state (_("initial state")); @@ -168,10 +169,10 @@ struct RegionSortByLayer } }; -/** FIXME: semantics of return value? */ +/** Returns the number of frames in time duration read (eg could be large when 0 events are read) */ jack_nframes_t -MidiPlaylist::read (MidiBuffer& buf, jack_nframes_t start, - jack_nframes_t cnt, unsigned chan_n) +MidiPlaylist::read (MidiRingBuffer& dst, jack_nframes_t start, + jack_nframes_t dur, unsigned chan_n) { /* this function is never called from a realtime thread, so its OK to block (for short intervals). @@ -180,11 +181,11 @@ MidiPlaylist::read (MidiBuffer& buf, jack_nframes_t start, Glib::Mutex::Lock rm (region_lock); jack_nframes_t ret = 0; - jack_nframes_t end = start + cnt - 1; - jack_nframes_t read_frames = 0; - jack_nframes_t skip_frames = 0; + jack_nframes_t end = start + dur - 1; + //jack_nframes_t read_frames = 0; + //jack_nframes_t skip_frames = 0; - _read_data_count = 0; + //_read_data_count = 0; vector<MidiRegion*> regs; // relevent regions overlapping start <--> end @@ -199,13 +200,15 @@ MidiPlaylist::read (MidiBuffer& buf, jack_nframes_t start, sort(regs.begin(), regs.end(), layer_cmp); for (vector<MidiRegion*>::iterator i = regs.begin(); i != regs.end(); ++i) { - (*i)->read_at (buf, start, cnt, chan_n, read_frames, skip_frames); - ret += (*i)->read_data_count(); + // FIXME: ensure time is monotonic here + (*i)->read_at (dst, start, dur, chan_n, 0, 0);// FIXME read_frames, skip_frames); + ret += (*i)->read_data_count(); } _read_data_count += ret; - return ret; + //return ret; FIXME? + return dur; } @@ -386,8 +389,7 @@ MidiPlaylist::drop_all_states () /* delete every region that is left - these are all things that are part of our "history" */ - for (set - <Region *>::iterator ar = all_regions.begin(); ar != all_regions.end(); ++ar) { + for (set<Region *>::iterator ar = all_regions.begin(); ar != all_regions.end(); ++ar) { (*ar)->unlock_sources (); delete *ar; } @@ -587,6 +589,8 @@ MidiPlaylist::region_changed (Change what_changed, Region* region) return false; } + // Feeling rather uninterested today, but thanks for the heads up anyway! + Change our_interests = Change (/*MidiRegion::FadeInChanged| MidiRegion::FadeOutChanged| MidiRegion::FadeInActiveChanged| |