summaryrefslogtreecommitdiff
path: root/libs/evoral/src/SMF.cpp
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-06-02 11:32:13 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2014-06-02 11:32:13 -0400
commit8c9749e42faf7808034ed8b7afce4a2fe6dc6f33 (patch)
tree823af8a96f4e0b2a404f5e52eadf4f46e1d10229 /libs/evoral/src/SMF.cpp
parentf6d29abfc75c460b9e35717f2907e4e61bf38058 (diff)
parent08a1409b1f5b5558d2eccc28a3ae4cbd44391812 (diff)
merge with master and fix 4 conflicts by hand
Diffstat (limited to 'libs/evoral/src/SMF.cpp')
-rw-r--r--libs/evoral/src/SMF.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/libs/evoral/src/SMF.cpp b/libs/evoral/src/SMF.cpp
index 51ccda583e..dc3512a0f6 100644
--- a/libs/evoral/src/SMF.cpp
+++ b/libs/evoral/src/SMF.cpp
@@ -71,6 +71,28 @@ SMF::seek_to_track(int track)
}
}
+/** Attempt to open the SMF file just to see if it is valid.
+ *
+ * \return true on success
+ * false on failure
+ */
+bool
+SMF::test(const std::string& path)
+{
+ PBD::StdioFileDescriptor d (path, "r");
+ FILE* f = d.allocate ();
+ if (f == 0) {
+ return false;
+ }
+
+ smf_t* test_smf;
+ if ((test_smf = smf_load (f)) == NULL) {
+ return false;
+ }
+ smf_delete (test_smf);
+ return true;
+}
+
/** Attempt to open the SMF file for reading and/or writing.
*
* \return 0 on success