diff options
author | David Robillard <d@drobilla.net> | 2009-02-17 02:11:49 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-02-17 02:11:49 +0000 |
commit | 022818b4a796f52c0a91eea42e65aec0bc7bed43 (patch) | |
tree | f82bde33d44c7b3e16af7e837536665e17fe0189 /libs/ardour/sndfilesource.cc | |
parent | 4565b73a3993b0cb5ccb9170e276180f2b5c1372 (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/sndfilesource.cc')
-rw-r--r-- | libs/ardour/sndfilesource.cc | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index 8d89f2aa92..d651d40970 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -50,38 +50,40 @@ const Source::Flag SndFileSource::default_writable_flags = Source::Flag ( Source::CanRename ); SndFileSource::SndFileSource (Session& s, const XMLNode& node) - : AudioFileSource (s, node) + : Source(s, node) + , AudioFileSource (s, node) { - init (); + init_sndfile (); if (open()) { throw failed_constructor (); } } -SndFileSource::SndFileSource (Session& s, ustring path, int chn, Flag flags) - /* files created this way are never writable or removable */ - : AudioFileSource (s, path, Flag (flags & ~(Writable|Removable|RemovableIfEmpty|RemoveAtDestroy))) +/** Files created this way are never writable or removable */ +SndFileSource::SndFileSource (Session& s, const ustring& path, bool embedded, int chn, Flag flags) + : Source(s, DataType::AUDIO, path, flags) + , AudioFileSource (s, path, embedded, + Flag (flags & ~(Writable|Removable|RemovableIfEmpty|RemoveAtDestroy))) { _channel = chn; - init (); + init_sndfile (); if (open()) { throw failed_constructor (); } } -SndFileSource::SndFileSource (Session& s, ustring path, SampleFormat sfmt, HeaderFormat hf, nframes_t rate, Flag flags) - : AudioFileSource (s, path, flags, sfmt, hf) +/** This constructor is used to construct new files, not open existing ones. */ +SndFileSource::SndFileSource (Session& s, const ustring& path, bool embedded, + SampleFormat sfmt, HeaderFormat hf, nframes_t rate, Flag flags) + : Source(s, DataType::AUDIO, path, flags) + , AudioFileSource (s, path, embedded, flags, sfmt, hf) { int fmt = 0; - init (); - - /* this constructor is used to construct new files, not open - existing ones. - */ + init_sndfile (); _file_is_new = true; @@ -161,7 +163,7 @@ SndFileSource::SndFileSource (Session& s, ustring path, SampleFormat sfmt, Heade } void -SndFileSource::init () +SndFileSource::init_sndfile () { ustring file; @@ -191,7 +193,8 @@ SndFileSource::init () _timeline_position = header_position_offset; } - AudioFileSource::HeaderPositionOffsetChanged.connect (mem_fun (*this, &SndFileSource::handle_header_position_change)); + AudioFileSource::HeaderPositionOffsetChanged.connect ( + mem_fun (*this, &SndFileSource::handle_header_position_change)); } int |