merge with master.
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 1 Jul 2014 13:46:18 +0000 (09:46 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 1 Jul 2014 13:46:18 +0000 (09:46 -0400)
Manually resolved conflicts in import.cc and session.cc

13 files changed:
1  2 
gtk2_ardour/editor.h
gtk2_ardour/editor_audio_import.cc
libs/ardour/ardour/file_source.h
libs/ardour/ardour/session.h
libs/ardour/ardour/smf_source.h
libs/ardour/audiofilesource.cc
libs/ardour/diskstream.cc
libs/ardour/file_source.cc
libs/ardour/import.cc
libs/ardour/midi_diskstream.cc
libs/ardour/session.cc
libs/ardour/session_state.cc
libs/ardour/smf_source.cc

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 04a62b06e1c8c1aa66da8f5e9724101fe8c1f0b3,6f7b3d0616dd467b7035a8c9c7e027bf9b8abbe0..e86e500ed93ff6d12308e5c8db4b289a749c5aee
@@@ -178,17 -122,25 +123,25 @@@ Session::get_paths_for_new_sources (boo
        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);
        }
  
@@@ -324,8 -276,8 +277,8 @@@ write_audio_data_to_new_files (Importab
                progress_multiplier = 0.5;
                progress_base = 0.5;
        }
 -      
 +
-       uint32_t read_count = 0;
+       framecnt_t read_count = 0;
  
        while (!status.cancel) {
  
@@@ -521,16 -465,8 +474,13 @@@ Session::import_files (ImportStatus& st
                                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;
  
Simple merge
index 36c43f0c069200fd34a6ebbeb3b953685cbd309b,0e4a10f76b8eb5197135373eeefb6e1cddd99262..ae39d7c46841959ee6fcc7243590c09d9d419f0e
  
  #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"
@@@ -4200,16 -4113,10 +4185,13 @@@ Session::write_one_track (AudioTrack& t
        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;
                }
  
Simple merge
Simple merge