X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fimport.cc;h=047b46f55305d5ff68d3beda87e0623ce60abe7d;hb=2b80aee20a01f70afe9997fd39c4ca8d19c8caf8;hp=2ae51cd47143ff73e3d8ed4af4d8385045d9ea49;hpb=de2d3057b5393eb17ab1e4d7d4bbf79c8f3c7836;p=ardour.git diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc index 2ae51cd471..047b46f553 100644 --- a/libs/ardour/import.cc +++ b/libs/ardour/import.cc @@ -184,7 +184,7 @@ get_paths_for_new_sources (HeaderFormat hf, const bool allow_replacing, const st const DataType type = SMFSource::safe_midi_file_extension (import_file_path) ? DataType::MIDI : DataType::AUDIO; std::string filepath = (type == DataType::MIDI) - ? sdir.midi_path().to_string() : sdir.sound_path().to_string(); + ? sdir.midi_path() : sdir.sound_path(); filepath = Glib::build_filename (filepath, get_non_existent_filename (hf, type, allow_replacing, filepath, basename, n, channels)); @@ -214,8 +214,7 @@ map_existing_mono_sources (const vector& new_paths, Session& /*sess*/, } static bool -create_mono_sources_for_writing (const string& origin, - const vector& new_paths, +create_mono_sources_for_writing (const vector& new_paths, Session& sess, uint samplerate, vector >& newfiles, framepos_t timeline_position) @@ -229,7 +228,6 @@ create_mono_sources_for_writing (const string& origin, source = SourceFactory::createWritable (type, sess, i->c_str(), - origin, false, // destructive samplerate); } @@ -420,10 +418,11 @@ write_midi_data_to_new_files (Evoral::SMF* source, ImportStatus& status, first = false; } - smfs->append_event_unlocked_beats(Evoral::Event(0, - (double)t / (double)source->ppqn(), - size, - buf)); + smfs->append_event_unlocked_beats( + Evoral::Event(0, + (double)t / (double)source->ppqn(), + size, + buf)); if (status.progress < 0.99) { status.progress += 0.01; @@ -451,7 +450,7 @@ write_midi_data_to_new_files (Evoral::SMF* source, ImportStatus& status, } } catch (...) { - error << string_compose (_("MIDI file %1 was not readable (no reason available"), source->file_path()) << endmsg; + error << string_compose (_("MIDI file %1 was not readable (no reason available)"), source->file_path()) << endmsg; } if (buf) { @@ -526,7 +525,7 @@ Session::import_files (ImportStatus& status) fatal << "THIS IS NOT IMPLEMENTED YET, IT SHOULD NEVER GET CALLED!!! DYING!" << endmsg; status.cancel = !map_existing_mono_sources (new_paths, *this, frame_rate(), newfiles, this); } else { - status.cancel = !create_mono_sources_for_writing (*p, new_paths, *this, frame_rate(), newfiles, natural_position); + status.cancel = !create_mono_sources_for_writing (new_paths, *this, frame_rate(), newfiles, natural_position); } // copy on cancel/failure so that any files that were created will be removed below @@ -582,7 +581,15 @@ Session::import_files (ImportStatus& status) boost::shared_ptr fs = boost::dynamic_pointer_cast(*x); if (fs) { - fs->mark_immutable (); + /* Only audio files should be marked as + immutable - we may need to rewrite MIDI + files at any time. + */ + if (boost::dynamic_pointer_cast (fs)) { + fs->mark_immutable (); + } else { + fs->mark_immutable_except_write (); + } fs->mark_nonremovable (); }