vector<string> new_paths;
const string basename = basename_nosuffix (import_file_path);
- SessionDirectory sdir(session_dir);
-
- for (uint n = 0; n < channels; ++n) {
+ for (uint32_t n = 0; n < channels; ++n) {
const DataType type = SMFSource::safe_midi_file_extension (import_file_path) ? DataType::MIDI : DataType::AUDIO;
+ string filepath;
- std::string filepath = (type == DataType::MIDI)
- ? sdir.midi_path() : sdir.sound_path();
+ switch (type) {
+ case DataType::MIDI:
+ filepath = new_midi_source_path (basename);
+ break;
+ case DataType::AUDIO:
+ filepath = new_audio_source_path (basename, channels, n, false, false);
+ break;
+ }
+
+ if (filepath.empty()) {
+ error << string_compose (_("Cannot find new filename for imported file %1"), import_file_path) << endmsg;
+ return vector<string>();
+ }
- filepath = Glib::build_filename (filepath,
- get_non_existent_filename (hf, type, allow_replacing, filepath, basename, n, channels));
new_paths.push_back (filepath);
}
progress_multiplier = 0.5;
progress_base = 0.5;
}
-
+
- uint32_t read_count = 0;
+ framecnt_t read_count = 0;
while (!status.cancel) {
return;
}
}
-
++
+ if (channels == 0) {
+ error << _("Import: file contains no channels.") << endmsg;
+ continue;
+ }
- vector<string> new_paths = get_paths_for_new_sources (config.get_native_file_header_format(),
- status.replace_existing_source, *p,
- get_best_session_directory_for_new_source (),
- channels);
+ vector<string> new_paths = get_paths_for_new_sources (status.replace_existing_source, *p, channels);
Sources newfiles;
framepos_t natural_position = source ? source->natural_position() : 0;
#include <boost/algorithm/string/erase.hpp>
+ #include "pbd/convert.h"
#include "pbd/error.h"
#include "pbd/boost_debug.h"
-#include "pbd/pathscanner.h"
#include "pbd/stl_delete.h"
#include "pbd/basename.h"
#include "pbd/stacktrace.h"
framepos_t position;
framecnt_t this_chunk;
framepos_t to_do;
+ framepos_t latency_skip;
BufferSet buffers;
- SessionDirectory sdir(get_best_session_directory_for_new_source ());
- const string sound_dir = sdir.sound_path();
framepos_t len = end - start;
bool need_block_size_reset = false;
- string ext;
ChanCount const max_proc = track.max_processor_streams ();
+ string legal_playlist_name;
+ string possible_path;
if (end <= start) {
error << string_compose (_("Cannot write a range where end <= start (e.g. %1 <= %2)"),
goto out;
}
- ext = native_header_format_extension (config.get_native_file_header_format(), DataType::AUDIO);
-
+ legal_playlist_name = legalize_for_path (playlist->name());
+
for (uint32_t chan_n = 0; chan_n < diskstream_channels.n_audio(); ++chan_n) {
- for (x = 0; x < 99999; ++x) {
- possible_path = Glib::build_filename (sound_dir, string_compose ("%1-%2-bounce-%3%4", legal_playlist_name.c_str(), chan_n, x+1, ext.c_str()));
- if (!Glib::file_test (possible_path, Glib::FILE_TEST_EXISTS)) {
- break;
- }
- }
-
- if (x == 99999) {
- error << string_compose (_("too many bounced versions of playlist \"%1\""), playlist->name()) << endmsg;
+ string base_name = string_compose ("%1-%2-bounce", playlist->name(), chan_n);
- string path = new_audio_source_path (base_name, diskstream_channels.n_audio(), chan_n, false, true);
++ string path = new_audio_source_path (legal_playlist_name, diskstream_channels.n_audio(), chan_n, false, true);
+
+ if (path.empty()) {
goto out;
}