diff options
author | David Robillard <d@drobilla.net> | 2009-02-15 17:30:42 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-02-15 17:30:42 +0000 |
commit | ecaf107ed3dd2bb3443a92fc3dd9cf566d3439e3 (patch) | |
tree | 2d858fb36efa6c4a6ca26c85d7b09cf6fb6b2ed0 /libs/ardour/ardour/midi_source.h | |
parent | 425966a69611d531f1d4d6c947d76708c8c7962e (diff) |
The Big Change: Store time in MidiModel as tempo time, not frame time.
The time stamp of an event is now always tempo, from file to model and
back again. Frame time is only relevant at playback or recording time,
in the audio thread (MidiModel and MidiBuffer).
I think perhaps we don't need to change the actual time from double (which is
convenient for math), it is the time base conversion that caused problems.
Using a correct equality comparison (i.e. not == which is not correct for
floating point) should probably make the undo issues go away, in 99.99% of
cases anyway.
There's almost certainly some regressions in here somewhere, but they do not
seem to be time related. The bugs I'm hitting in testing are old ones that
seem unrelated now, so it's checkpoint time.
This sets us up for fancy things like tempo map import and tempo/meter changes
halfway through MIDI regions, but for now it's still assumed that the tempo
at the start of the region is valid for the duration of the entire region.
git-svn-id: svn://localhost/ardour2/branches/3.0@4582 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour/midi_source.h')
-rw-r--r-- | libs/ardour/ardour/midi_source.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index 2126b4b162..f5c660d9cb 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -57,10 +57,12 @@ class MidiSource : public Source virtual uint32_t n_channels () const { return 1; } // FIXME: integrate this with the Readable::read interface somehow - virtual nframes_t midi_read (MidiRingBuffer<nframes_t>& dst, nframes_t start, nframes_t cnt, nframes_t stamp_offset, nframes_t negative_stamp_offset) const; + virtual nframes_t midi_read (MidiRingBuffer<nframes_t>& dst, nframes_t start, nframes_t cnt, + nframes_t stamp_offset, nframes_t negative_stamp_offset) const; virtual nframes_t midi_write (MidiRingBuffer<nframes_t>& src, nframes_t cnt); - virtual void append_event_unlocked(EventTimeUnit unit, const Evoral::Event<TimeType>& ev) = 0; + virtual void append_event_unlocked_beats(const Evoral::Event<double>& ev) = 0; + virtual void append_event_unlocked_frames(const Evoral::Event<nframes_t>& ev) = 0; virtual void mark_for_remove() = 0; virtual void mark_streaming_midi_write_started (NoteMode mode, nframes_t start_time); @@ -95,6 +97,7 @@ class MidiSource : public Source boost::shared_ptr<MidiModel> model() { return _model; } void set_model(boost::shared_ptr<MidiModel> m) { _model = m; } + void drop_model() { _model.reset(); } protected: virtual void flush_midi() = 0; |