summaryrefslogtreecommitdiff
path: root/libs/evoral/src
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-07-21 13:02:58 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-07-21 13:02:58 +0000
commit6ef49a0b86e746e8f0f8617998a2a3bb781576cd (patch)
treed3b1f9fcc4ef6048774ce9461102708d1334f68d /libs/evoral/src
parent1fd56c5476a4628dcf25d64c2950811c395bcfac (diff)
force creation of MIDI (SMF) files on disk whenever an SMF object is created, to avoid "source exists but no file don disk exists" issue
git-svn-id: svn://localhost/ardour2/branches/3.0@7459 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/evoral/src')
-rw-r--r--libs/evoral/src/SMF.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/libs/evoral/src/SMF.cpp b/libs/evoral/src/SMF.cpp
index ae3c8781a5..210692f114 100644
--- a/libs/evoral/src/SMF.cpp
+++ b/libs/evoral/src/SMF.cpp
@@ -128,11 +128,12 @@ SMF::create(const std::string& path, int track, uint16_t ppqn) THROW_FILE_ERROR
_file_path = path;
_smf = smf_new();
- if (smf_set_ppqn(_smf, ppqn) != 0) {
- throw FileError();
- }
if (_smf == NULL) {
+ return -1;
+ }
+
+ if (smf_set_ppqn(_smf, ppqn) != 0) {
return -1;
}
@@ -147,6 +148,21 @@ SMF::create(const std::string& path, int track, uint16_t ppqn) THROW_FILE_ERROR
return -2;
_smf_track->next_event_number = 0;
+
+ {
+ /* put a stub file on disk */
+
+ PBD::StdioFileDescriptor d (_file_path, "w+");
+ FILE* f = d.allocate ();
+ if (f == 0) {
+ return -1;
+ }
+
+ if (smf_save (_smf, f)) {
+ return -1;
+ }
+ }
+
_empty = true;
return 0;