diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/source_factory.h | 6 | ||||
-rw-r--r-- | libs/ardour/audio_diskstream.cc | 2 | ||||
-rw-r--r-- | libs/ardour/audiofilesource.cc | 4 | ||||
-rw-r--r-- | libs/ardour/file_source.cc | 11 | ||||
-rw-r--r-- | libs/ardour/filter.cc | 2 | ||||
-rw-r--r-- | libs/ardour/import.cc | 6 | ||||
-rw-r--r-- | libs/ardour/midi_source.cc | 2 | ||||
-rw-r--r-- | libs/ardour/session.cc | 6 | ||||
-rw-r--r-- | libs/ardour/source_factory.cc | 20 |
9 files changed, 28 insertions, 31 deletions
diff --git a/libs/ardour/ardour/source_factory.h b/libs/ardour/ardour/source_factory.h index 387a40aff3..c94f783b44 100644 --- a/libs/ardour/ardour/source_factory.h +++ b/libs/ardour/ardour/source_factory.h @@ -46,14 +46,14 @@ class SourceFactory { static boost::shared_ptr<Source> createSilent (Session&, const XMLNode& node, framecnt_t nframes, float sample_rate); - static boost::shared_ptr<Source> createReadable + static boost::shared_ptr<Source> createExternal (DataType type, Session&, - const std::string& path, + const std::string& path, int chn, Source::Flag flags, bool announce = true, bool async = false); static boost::shared_ptr<Source> createWritable (DataType type, Session&, - const std::string& path, const std::string& origin, + const std::string& path, bool destructive, framecnt_t rate, bool announce = true, bool async = false); diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index 24687c766f..c302e06681 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -2168,7 +2168,7 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node) fs = boost::dynamic_pointer_cast<AudioFileSource> ( SourceFactory::createWritable ( DataType::AUDIO, _session, - prop->value(), string(), false, _session.frame_rate())); + prop->value(), false, _session.frame_rate())); } catch (failed_constructor& err) { diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index 2486d45ca1..e7d69d2258 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -95,8 +95,6 @@ AudioFileSource::AudioFileSource (Session& s, const string& path, Source::Flag f /* note that external files have their own path as "origin" */ , FileSource (s, DataType::AUDIO, path, path, flags) { - /* note that origin remains empty */ - if (init (_path, true)) { throw failed_constructor (); } @@ -322,7 +320,7 @@ int AudioFileSource::setup_peakfile () { if (!(_flags & NoPeakFile)) { - return initialize_peakfile (_file_is_new, _path); + return initialize_peakfile (_origin.empty(), _path); } else { return 0; } diff --git a/libs/ardour/file_source.cc b/libs/ardour/file_source.cc index 8c207feea7..e3a442b0de 100644 --- a/libs/ardour/file_source.cc +++ b/libs/ardour/file_source.cc @@ -55,8 +55,8 @@ PBD::Signal3<int,std::string,std::string,std::vector<std::string> > FileSource:: FileSource::FileSource (Session& session, DataType type, const string& path, const string& origin, Source::Flag flag) : Source(session, type, path, flag) - , _path(path) - , _file_is_new(true) + , _path (path) + , _file_is_new (!origin.empty()) // origin empty => new file VS. origin !empty => new file , _channel (0) , _origin (origin) , _open (false) @@ -133,11 +133,12 @@ FileSource::init (const string& pathstr, bool must_exist) } set_within_session_from_path (_path); - _name = Glib::path_get_basename (_path); - if (_file_is_new && must_exist) { - return -1; + if (must_exist) { + if (!Glib::file_test (_path, Glib::FILE_TEST_EXISTS)) { + throw MissingSource (pathstr, _type); + } } return 0; diff --git a/libs/ardour/filter.cc b/libs/ardour/filter.cc index 67aa840cad..b085ec946b 100644 --- a/libs/ardour/filter.cc +++ b/libs/ardour/filter.cc @@ -71,7 +71,7 @@ Filter::make_new_sources (boost::shared_ptr<Region> region, SourceList& nsrcs, s try { nsrcs.push_back (boost::dynamic_pointer_cast<Source> ( SourceFactory::createWritable (region->data_type(), session, - path, string(), false, session.frame_rate()))); + path, false, session.frame_rate()))); } catch (failed_constructor& err) { diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc index 07c7958ad7..047b46f553 100644 --- a/libs/ardour/import.cc +++ b/libs/ardour/import.cc @@ -214,8 +214,7 @@ map_existing_mono_sources (const vector<string>& new_paths, Session& /*sess*/, } static bool -create_mono_sources_for_writing (const string& origin, - const vector<string>& new_paths, +create_mono_sources_for_writing (const vector<string>& new_paths, Session& sess, uint samplerate, vector<boost::shared_ptr<Source> >& 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); } @@ -527,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 diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc index 30dc23f998..124d3f7c9b 100644 --- a/libs/ardour/midi_source.cc +++ b/libs/ardour/midi_source.cc @@ -355,7 +355,7 @@ MidiSource::clone (const string& path, Evoral::MusicalTime begin, Evoral::Musica boost::shared_ptr<MidiSource> newsrc = boost::dynamic_pointer_cast<MidiSource>( SourceFactory::createWritable(DataType::MIDI, _session, - newpath, string(), false, _session.frame_rate())); + newpath, false, _session.frame_rate())); newsrc->set_timeline_position(_timeline_position); newsrc->copy_interpolation_from (this); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index cb743cca62..75303251d8 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -3381,7 +3381,7 @@ Session::create_audio_source_for_session (size_t n_chans, string const & n, uint const string path = new_source_path_from_name(DataType::AUDIO, name); return boost::dynamic_pointer_cast<AudioFileSource> ( - SourceFactory::createWritable (DataType::AUDIO, *this, path, string(), destructive, frame_rate())); + SourceFactory::createWritable (DataType::AUDIO, *this, path, destructive, frame_rate())); } /** Return a unique name based on \a base for a new internal MIDI source */ @@ -3457,7 +3457,7 @@ Session::create_midi_source_for_session (Track* track, string const & n) return boost::dynamic_pointer_cast<SMFSource> ( SourceFactory::createWritable ( - DataType::MIDI, *this, path, string(), false, frame_rate())); + DataType::MIDI, *this, path, false, frame_rate())); } @@ -4009,7 +4009,7 @@ Session::write_one_track (AudioTrack& track, framepos_t start, framepos_t end, try { fsource = boost::dynamic_pointer_cast<AudioFileSource> ( - SourceFactory::createWritable (DataType::AUDIO, *this, buf, string(), false, frame_rate())); + SourceFactory::createWritable (DataType::AUDIO, *this, buf, false, frame_rate())); } catch (failed_constructor& err) { diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index da5980599d..5e1a7d40d9 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -218,11 +218,11 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks) } boost::shared_ptr<Source> -SourceFactory::createReadable (DataType type, Session& s, const string& path, +SourceFactory::createExternal (DataType type, Session& s, const string& path, int chn, Source::Flag flags, bool announce, bool defer_peaks) { if (type == DataType::AUDIO) { - + if (!(flags & Destructive)) { try { @@ -291,19 +291,19 @@ SourceFactory::createReadable (DataType type, Session& s, const string& path, } boost::shared_ptr<Source> -SourceFactory::createWritable (DataType type, Session& s, const std::string& path, const std::string& origin, +SourceFactory::createWritable (DataType type, Session& s, const std::string& path, bool destructive, framecnt_t rate, bool announce, bool defer_peaks) { /* this might throw failed_constructor(), which is OK */ if (type == DataType::AUDIO) { - Source* src = new SndFileSource (s, path, origin, - s.config.get_native_file_data_format(), - s.config.get_native_file_header_format(), - rate, - (destructive - ? Source::Flag (SndFileSource::default_writable_flags | Source::Destructive) - : SndFileSource::default_writable_flags)); + Source* src = new SndFileSource (s, path, string(), + s.config.get_native_file_data_format(), + s.config.get_native_file_header_format(), + rate, + (destructive + ? Source::Flag (SndFileSource::default_writable_flags | Source::Destructive) + : SndFileSource::default_writable_flags)); #ifdef BOOST_SP_ENABLE_DEBUG_HOOKS // boost_debug_shared_ptr_mark_interesting (src, "Source"); #endif |