summaryrefslogtreecommitdiff
path: root/libs/ardour/source_factory.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-02-17 02:11:49 +0000
committerDavid Robillard <d@drobilla.net>2009-02-17 02:11:49 +0000
commit022818b4a796f52c0a91eea42e65aec0bc7bed43 (patch)
treef82bde33d44c7b3e16af7e837536665e17fe0189 /libs/ardour/source_factory.cc
parent4565b73a3993b0cb5ccb9170e276180f2b5c1372 (diff)
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
Diffstat (limited to 'libs/ardour/source_factory.cc')
-rw-r--r--libs/ardour/source_factory.cc18
1 files changed, 10 insertions, 8 deletions
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<Source>
-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<Source> ret (new SndFileSource (s, path, chn, flags));
+ boost::shared_ptr<Source> ret (new SndFileSource (s, path, embedded, chn, flags));
if (setup_peakfile (ret, defer_peaks)) {
return boost::shared_ptr<Source>();
@@ -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<Source> ret (new CoreAudioSource (s, path, chn, flags));
+ boost::shared_ptr<Source> ret (new CoreAudioSource (s, path, embedded, chn, flags));
if (setup_peakfile (ret, defer_peaks)) {
return boost::shared_ptr<Source>();
}
@@ -224,8 +225,7 @@ SourceFactory::createReadable (DataType type, Session& s, string path, int chn,
} else if (type == DataType::MIDI) {
- // FIXME: flags?
- boost::shared_ptr<Source> ret (new SMFSource (s, path, SMFSource::Flag(0)));
+ boost::shared_ptr<Source> 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<Source>
-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<Source> ret (new SndFileSource (s, path,
+ boost::shared_ptr<Source> 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<Source> ret (new SMFSource (s, path));
+ boost::shared_ptr<Source> 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<Source> ();
}
+