- case DataType::MIDI:
- /* The MIDI file is actually missing so
- * just create a new one in the same
- * location. Do not announce its
- */
- string fullpath;
-
- if (!Glib::path_is_absolute (err.path)) {
- fullpath = Glib::build_filename (source_search_path (DataType::MIDI).front(), err.path);
- } else {
- /* this should be an unrecoverable error: we would be creating a MIDI file outside
- the session tree.
- */
- return -1;
+ case DataType::MIDI:
+ /* The MIDI file is actually missing so
+ * just create a new one in the same
+ * location. Do not announce its
+ */
+ string fullpath;
+
+ if (!Glib::path_is_absolute (err.path)) {
+ fullpath = Glib::build_filename (source_search_path (DataType::MIDI).front(), err.path);
+ } else {
+ /* this should be an unrecoverable error: we would be creating a MIDI file outside
+ * the session tree.
+ */
+ return -1;
+ }
+ /* Note that we do not announce the source just yet - we need to reset its ID before we do that */
+ source = SourceFactory::createWritable (DataType::MIDI, *this, fullpath, false, _current_frame_rate, false, false);
+ /* reset ID to match the missing one */
+ source->set_id (**niter);
+ /* Now we can announce it */
+ SourceFactory::SourceCreated (source);
+ break;