summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/midi_source.h
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-04-13 10:29:07 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2014-04-14 02:17:30 -0400
commit343b06d8d3522d6b017d887ca754c91aec2430fd (patch)
tree81aa51fa0fea6826e62480314c1ac78b112b3a9a /libs/ardour/ardour/midi_source.h
parentd2a31ab6eed8b3e8f34dbc1caf2285bb64777f55 (diff)
dramatic change in logic and naming for operations related to adding a MIDI region on demand and cloning/unlinking
Existing code would cause data loss due to creation of two Source objects referring the same path, one with removable flags and one without. Careful code review suggested a variety of thinkos, function naming problems and other confusion that caused this. I have tried ot extensively comment what is going on with these operations, because it is one key area in which MIDI differs from audio: with audio, capture is the only way to add a new audio region, but for MIDI there are GUI input events that can add a new region.
Diffstat (limited to 'libs/ardour/ardour/midi_source.h')
-rw-r--r--libs/ardour/ardour/midi_source.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h
index ba50102ec9..07a32c5bfc 100644
--- a/libs/ardour/ardour/midi_source.h
+++ b/libs/ardour/ardour/midi_source.h
@@ -49,9 +49,21 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha
MidiSource (Session& session, const XMLNode&);
virtual ~MidiSource ();
- boost::shared_ptr<MidiSource> clone (const std::string& path,
- Evoral::MusicalTime begin = Evoral::MinMusicalTime,
- Evoral::MusicalTime end = Evoral::MaxMusicalTime);
+ /** Write the data in the given time range to another MidiSource
+ * \param newsrc MidiSource to which data will be written. Should be a
+ * new, empty source. If it already has contents, the results are
+ * undefined. Source must be writable.
+ *
+ * \param begin time of earliest event that can be written.
+ * \param end time of latest event that can be written.
+ *
+ * Returns zero on success, non-zero if the write failed for any
+ * reason.
+ *
+ */
+ int write_to (boost::shared_ptr<MidiSource> newsrc,
+ Evoral::MusicalTime begin = Evoral::MinMusicalTime,
+ Evoral::MusicalTime end = Evoral::MaxMusicalTime);
/** Read the data in a given time range from the MIDI source.
* All time stamps in parameters are in audio frames (even if the source has tempo time).