From 022818b4a796f52c0a91eea42e65aec0bc7bed43 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 17 Feb 2009 02:11:49 +0000 Subject: Fix the horrible mess that was anything related to sources and paths. Most significant changes: - Factor out FileSource from AudioFileSource, use for SMFSource too - Explicitly pass embedded rather than mysterious name mangling or whatever - Destroy a ton of duplicated or very-nearly-duplicated code - Clean up and document all that weird source stuff in session.cc git-svn-id: svn://localhost/ardour2/branches/3.0@4609 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/source_factory.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'libs/ardour/source_factory.cc') diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index 2d2d6917bd..db5e7d313b 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -179,7 +179,8 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks) } boost::shared_ptr -SourceFactory::createReadable (DataType type, Session& s, string path, int chn, Source::Flag flags, bool announce, bool defer_peaks) +SourceFactory::createReadable (DataType type, Session& s, const string& path, bool embedded, + int chn, Source::Flag flags, bool announce, bool defer_peaks) { if (type == DataType::AUDIO) { @@ -187,7 +188,7 @@ SourceFactory::createReadable (DataType type, Session& s, string path, int chn, try { - boost::shared_ptr ret (new SndFileSource (s, path, chn, flags)); + boost::shared_ptr ret (new SndFileSource (s, path, embedded, chn, flags)); if (setup_peakfile (ret, defer_peaks)) { return boost::shared_ptr(); @@ -203,7 +204,7 @@ SourceFactory::createReadable (DataType type, Session& s, string path, int chn, catch (failed_constructor& err) { #ifdef USE_COREAUDIO_FOR_FILES - boost::shared_ptr ret (new CoreAudioSource (s, path, chn, flags)); + boost::shared_ptr ret (new CoreAudioSource (s, path, embedded, chn, flags)); if (setup_peakfile (ret, defer_peaks)) { return boost::shared_ptr(); } @@ -224,8 +225,7 @@ SourceFactory::createReadable (DataType type, Session& s, string path, int chn, } else if (type == DataType::MIDI) { - // FIXME: flags? - boost::shared_ptr ret (new SMFSource (s, path, SMFSource::Flag(0))); + boost::shared_ptr ret (new SMFSource (s, path, embedded, SMFSource::Flag(0))); if (announce) { SourceCreated (ret); @@ -239,12 +239,13 @@ SourceFactory::createReadable (DataType type, Session& s, string path, int chn, } boost::shared_ptr -SourceFactory::createWritable (DataType type, Session& s, std::string path, bool destructive, nframes_t rate, bool announce, bool defer_peaks) +SourceFactory::createWritable (DataType type, Session& s, const std::string& path, bool embedded, + bool destructive, nframes_t rate, bool announce, bool defer_peaks) { /* this might throw failed_constructor(), which is OK */ if (type == DataType::AUDIO) { - boost::shared_ptr ret (new SndFileSource (s, path, + boost::shared_ptr ret (new SndFileSource (s, path, embedded, Config->get_native_file_data_format(), Config->get_native_file_header_format(), rate, @@ -265,7 +266,7 @@ SourceFactory::createWritable (DataType type, Session& s, std::string path, bool } else if (type == DataType::MIDI) { - boost::shared_ptr ret (new SMFSource (s, path)); + boost::shared_ptr ret (new SMFSource (s, path, embedded, Source::Flag(0))); // no analysis data - this is a new file @@ -278,3 +279,4 @@ SourceFactory::createWritable (DataType type, Session& s, std::string path, bool return boost::shared_ptr (); } + -- cgit v1.2.3