_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;
}
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;
SMF::close() THROW_FILE_ERROR
{
if (_smf) {
-#if 0
- /* XXX why would we automatically save-on-close?
- */
-
- PBD::StdioFileDescriptor d (_file_path, "w+");
- FILE* f = d.allocate ();
- if (f == 0) {
- throw FileError ();
- }
-
- cerr << "CLOSE: Save SMF to " << _file_path << endl;
-
- if (smf_save(_smf, f) != 0) {
- throw FileError();
- }
-#endif
smf_delete(_smf);
_smf = 0;
_smf_track = 0;