summaryrefslogtreecommitdiff
path: root/libs/ardour/smf_source.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-04-28 10:37:17 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2014-04-28 10:37:17 -0400
commitf5276a104c2d544cf537db9e9b8de9022de7ad56 (patch)
treef3beefb305a8364fd9603f32ef7129e6f4fe9768 /libs/ardour/smf_source.cc
parent16a8762dd494adb68756b8d549f349ed7bdccd9b (diff)
add new SMFSource constructor to be used for existing-external files. Fixes #5919. Needs merging with CC
Diffstat (limited to 'libs/ardour/smf_source.cc')
-rw-r--r--libs/ardour/smf_source.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc
index 90e50e6f44..d52923c302 100644
--- a/libs/ardour/smf_source.cc
+++ b/libs/ardour/smf_source.cc
@@ -82,6 +82,39 @@ SMFSource::SMFSource (Session& s, const string& path, Source::Flag flags)
_open = true;
}
+/** Constructor used for external-to-session files. File must exist. */
+SMFSource::SMFSource (Session& s, const string& path)
+ : Source(s, DataType::MIDI, path, Source::Flag (0))
+ , MidiSource(s, path, Source::Flag (0))
+ , FileSource(s, DataType::MIDI, path, string(), Source::Flag (0))
+ , Evoral::SMF()
+ , _last_ev_time_beats(0.0)
+ , _last_ev_time_frames(0)
+ , _smf_last_read_end (0)
+ , _smf_last_read_time (0)
+{
+ /* note that origin remains empty */
+
+ if (init (_path, false)) {
+ throw failed_constructor ();
+ }
+
+ assert (Glib::file_test (_path, Glib::FILE_TEST_EXISTS));
+ existence_check ();
+
+ /* file is not opened until write */
+
+ if (_flags & Writable) {
+ return;
+ }
+
+ if (open (_path)) {
+ throw failed_constructor ();
+ }
+
+ _open = true;
+}
+
/** Constructor used for existing internal-to-session files. */
SMFSource::SMFSource (Session& s, const XMLNode& node, bool must_exist)
: Source(s, node)