attempt to remove confusion and errors caused by unclear semantics of _is_embedded...
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 30 Nov 2009 13:16:38 +0000 (13:16 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 30 Nov 2009 13:16:38 +0000 (13:16 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6213 d708f5d6-7413-0410-9779-e7cbd77b26cf

22 files changed:
gtk2_ardour/sfdb_ui.cc
libs/ardour/ardour/audiofilesource.h
libs/ardour/ardour/coreaudiosource.h
libs/ardour/ardour/file_source.h
libs/ardour/ardour/session.h
libs/ardour/ardour/smf_source.h
libs/ardour/ardour/sndfilesource.h
libs/ardour/ardour/source_factory.h
libs/ardour/audio_diskstream.cc
libs/ardour/audiofilesource.cc
libs/ardour/coreaudiosource.cc
libs/ardour/file_source.cc
libs/ardour/filter.cc
libs/ardour/import.cc
libs/ardour/midi_source.cc
libs/ardour/session.cc
libs/ardour/session_midi.cc
libs/ardour/session_state.cc
libs/ardour/smf_source.cc
libs/ardour/sndfilesource.cc
libs/ardour/source.cc
libs/ardour/source_factory.cc

index bc2f115ed92e1c89429c4231162bc138319c8e25..151ac4d7d4264c1d8a9ef00acf9fb87ba06877b1 100644 (file)
@@ -330,7 +330,7 @@ SoundFileBox::audition ()
                try {
                        afs = boost::dynamic_pointer_cast<AudioFileSource> (
                                        SourceFactory::createReadable (DataType::AUDIO, *_session,
-                                                       path, false, n, Source::Flag (0), false));
+                                                       path, n, Source::Flag (0), false));
 
                        srclist.push_back(afs);
 
index 95c7db438528a303b5ee86bffab33e9583cdd4df..6c04ebffb16bc2b51b1ace1ac403df8597c58309 100644 (file)
@@ -88,10 +88,10 @@ public:
 
 protected:
        /** Constructor to be called for existing external-to-session files */
-       AudioFileSource (Session&, const Glib::ustring& path, bool embedded, Source::Flag flags);
+       AudioFileSource (Session&, const Glib::ustring& path, Source::Flag flags);
 
        /** Constructor to be called for new in-session files */
-       AudioFileSource (Session&, const Glib::ustring& path, bool embedded, Source::Flag flags,
+       AudioFileSource (Session&, const Glib::ustring& path, Source::Flag flags,
                        SampleFormat samp_format, HeaderFormat hdr_format);
 
        /** Constructor to be called for existing in-session files */
index 7720ca739583c042673f64ba2af750e4dd61040f..c8de8304c2dc0f522de9e079ad72ce9214fd4095 100644 (file)
@@ -50,7 +50,7 @@ class CoreAudioSource : public AudioFileSource {
        mutable CAAudioFile af;
        uint16_t n_channels;
 
-       void init ();
+       void init_cafile ();
        int safe_read (Sample*, nframes_t start, nframes_t cnt, AudioBufferList&) const;
 };
 
index 4b17881a0bbc814b736b1f7b76e13efb4ad621ac..76c3c57e36501fea37a37d7a1c8ff76442982c23 100644 (file)
@@ -42,9 +42,9 @@ public:
        void mark_take (const Glib::ustring& id);
        void mark_immutable ();
 
-       const Glib::ustring& take_id ()     const { return _take_id; }
-       bool                 is_embedded () const { return _is_embedded; }
-       uint16_t             channel()      const { return _channel; }
+       const Glib::ustring& take_id ()        const { return _take_id; }
+       bool                 within_session () const { return _within_session; }
+       uint16_t             channel()         const { return _channel; }
 
        int set_state (const XMLNode&, int version);
 
@@ -58,7 +58,7 @@ public:
 
 protected:
        FileSource (Session& session, DataType type,
-                       const Glib::ustring& path, bool embedded,
+                       const Glib::ustring& path, 
                        Source::Flag flags = Source::Flag(0));
 
        FileSource (Session& session, const XMLNode& node, bool must_exist);
@@ -66,8 +66,7 @@ protected:
        virtual int init (const Glib::ustring& idstr, bool must_exist);
 
        virtual int move_dependents_to_trash() { return 0; }
-
-       void set_embedded_from_name();
+       void set_within_session_from_path (const std::string&);
 
        bool removable () const;
 
@@ -75,7 +74,7 @@ protected:
        Glib::ustring _take_id;
        bool          _file_is_new;
        uint16_t      _channel;
-       bool          _is_embedded;
+       bool          _within_session;
 
        static std::map<DataType, Glib::ustring> search_paths;
 };
index bfbbabe8778e4d51d99cc539d2bd07fcf3fd0dcb..da985d2ce7d306434aa2563564859857dec445bb 100644 (file)
@@ -252,6 +252,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
        std::string name() const { return _name; }
        std::string snap_name() const { return _current_snapshot_name; }
        std::string raid_path () const;
+       bool path_is_within_session (const std::string&);
 
        void set_snap_name ();
 
index 5ded3537e9e508b87b6a5ad6326637ddf3629b19..44080a8cff898cd6b0b3219393edba66d78d6b25 100644 (file)
@@ -37,7 +37,7 @@ template<typename T> class MidiRingBuffer;
 class SMFSource : public MidiSource, public FileSource, public Evoral::SMF {
 public:
        /** Constructor for existing external-to-session files */
-       SMFSource (Session& session, const Glib::ustring& path, bool embedded,
+       SMFSource (Session& session, const Glib::ustring& path, 
                        Source::Flag flags = Source::Flag(0));
 
        /** Constructor for existing in-session files */
index 7983b2e340f1d5b44bc7ecec9e8fda223941ad07..45d535e9166f3a09fca861fb8dbca53a55c5f8c3 100644 (file)
@@ -30,10 +30,10 @@ namespace ARDOUR {
 class SndFileSource : public AudioFileSource {
   public:
        /** Constructor to be called for existing external-to-session files */
-       SndFileSource (Session&, const Glib::ustring& path, bool embedded, int chn, Flag flags);
+       SndFileSource (Session&, const Glib::ustring& path, int chn, Flag flags);
 
        /* Constructor to be called for new in-session files */
-       SndFileSource (Session&, const Glib::ustring& path, bool embedded,
+       SndFileSource (Session&, const Glib::ustring& path, 
                        SampleFormat samp_format, HeaderFormat hdr_format, nframes_t rate,
                        Flag flags = SndFileSource::default_writable_flags);
 
index 8d53a3c865d6d13ec44d43a2b00d28f468f22764..21af4ece75499309413819194788d8732a90b960 100644 (file)
@@ -45,11 +45,11 @@ class SourceFactory {
                        nframes_t nframes, float sample_rate);
 
        static boost::shared_ptr<Source> createReadable (DataType type, Session&,
-                       const std::string& path, bool embedded,
+                       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, bool embedded,
+                       const std::string& path, 
                        bool destructive, nframes_t rate, bool announce = true, bool async = false);
 
        static Glib::Cond*                               PeaksToBuild;
index 7ef971642d5f65a55d84c90db5c084be9cfc5bee..6c96f5c598fae3f89b4f84ffb34d298421f6cab7 100644 (file)
@@ -1922,7 +1922,6 @@ AudioDiskstream::use_new_write_source (uint32_t n)
        /* until we write, this file is considered removable */
 
        chan->write_source->mark_for_remove ();
-       cerr << "New write source " << chan->write_source->path() << " flags " << enum_2_string (chan->write_source->flags()) << endl;
 
        return 0;
 }
@@ -2172,8 +2171,7 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node)
                        try {
                                fs = boost::dynamic_pointer_cast<AudioFileSource> (
                                                SourceFactory::createWritable (DataType::AUDIO, _session,
-                                                               prop->value(), true,
-                                                               false, _session.frame_rate()));
+                                                               prop->value(), false, _session.frame_rate()));
                        }
 
                        catch (failed_constructor& err) {
index f2f09b71fc8262e666d28f6382b2765e8154f90e..b840c3a7c9a76373820e43e516c09155a898423a 100644 (file)
@@ -92,31 +92,30 @@ struct SizedSampleBuffer {
 Glib::StaticPrivate<SizedSampleBuffer> thread_interleave_buffer = GLIBMM_STATIC_PRIVATE_INIT;
 
 /** Constructor used for existing internal-to-session files. */
-AudioFileSource::AudioFileSource (Session& s, const ustring& path, bool embedded, Source::Flag flags)
+AudioFileSource::AudioFileSource (Session& s, const ustring& path, Source::Flag flags)
        : Source (s, DataType::AUDIO, path, flags)
        , AudioSource (s, path)
-       , FileSource (s, DataType::AUDIO, path, embedded, flags)
+       , FileSource (s, DataType::AUDIO, path, flags)
 {
-       if (init (path, true)) {
+       if (init (_path, true)) {
                throw failed_constructor ();
        }
+
 }
 
 /** Constructor used for new internal-to-session files. */
-AudioFileSource::AudioFileSource (Session& s, const ustring& path, bool embedded, Source::Flag flags,
+AudioFileSource::AudioFileSource (Session& s, const ustring& path, Source::Flag flags,
                                  SampleFormat /*samp_format*/, HeaderFormat /*hdr_format*/)
        : Source (s, DataType::AUDIO, path, flags)
        , AudioSource (s, path)
-       , FileSource (s, DataType::AUDIO, path, embedded, flags)
+       , FileSource (s, DataType::AUDIO, path, flags)
 {
-       _is_embedded = false;
-
-       if (init (path, false)) {
+       if (init (_path, false)) {
                throw failed_constructor ();
        }
 }
 
-/** Constructor used for existing internal-to-session files.  File must exist. */
+/** Constructor used for existing internal-to-session files via XML.  File must exist. */
 AudioFileSource::AudioFileSource (Session& s, const XMLNode& node, bool must_exist)
        : Source (s, node)
        , AudioSource (s, node)
@@ -125,8 +124,8 @@ AudioFileSource::AudioFileSource (Session& s, const XMLNode& node, bool must_exi
        if (set_state (node, Stateful::loading_state_version)) {
                throw failed_constructor ();
        }
-
-       if (init (_name, must_exist)) {
+       
+       if (init (_path, must_exist)) {
                throw failed_constructor ();
        }
 }
@@ -170,7 +169,7 @@ AudioFileSource::find_broken_peakfile (ustring peak_path, ustring audio_path)
 
        if (Glib::file_test (str, Glib::FILE_TEST_EXISTS)) {
 
-               if (is_embedded()) {
+               if (!within_session()) {
 
                        /* it would be nice to rename it but the nature of
                           the bug means that we can't reliably use it.
index eac6426520104727491060531158dcada3a344ff..a4da378aa43d43f6bf89479701753cea7af239f6 100644 (file)
@@ -41,7 +41,7 @@ CoreAudioSource::CoreAudioSource (Session& s, const XMLNode& node)
        : Source (s, node)
        , AudioFileSource (s, node)
 {
-       init ();
+       init_cafile ();
 }
 
 CoreAudioSource::CoreAudioSource (Session& s, const string& path, bool, int chn, Flag flags)
@@ -51,11 +51,11 @@ CoreAudioSource::CoreAudioSource (Session& s, const string& path, bool, int chn,
                        Source::Flag (flags & ~(Writable|Removable|RemovableIfEmpty|RemoveAtDestroy)))
 {
        _channel = chn;
-       init ();
+       init_cafile ();
 }
 
 void
-CoreAudioSource::init ()
+CoreAudioSource::init_cafile ()
 {
        /* note that we temporarily truncated _id at the colon */
        try {
index 08ba0eb23e9098d74828e4324e97e117dbf8ffa2..caddc12b5bdd8b6c3b1f4c7c3f402ca1be8d13cb 100644 (file)
@@ -55,22 +55,26 @@ static const std::string PATH_SEP = "/"; // I don't do windows
 
 map<DataType, ustring> FileSource::search_paths;
 
-FileSource::FileSource (Session& session, DataType type,
-               const ustring& path, bool embedded, Source::Flag flag)
+FileSource::FileSource (Session& session, DataType type, const ustring& path, Source::Flag flag)
        : Source(session, type, path, flag)
        , _path(path)
        , _file_is_new(true)
        , _channel (0)
-       , _is_embedded(embedded)
 {
+       set_within_session_from_path (path);
 }
 
 FileSource::FileSource (Session& session, const XMLNode& node, bool /*must_exist*/)
        : Source(session, node)
        , _file_is_new (false)
 {
+       /* this setting of _path is temporary - we expect derived classes
+          to call ::init() which will actually locate the file
+          and reset _path and _within_session correctly.
+       */
+
        _path = _name;
-       set_embedded_from_name();
+       _within_session = true;
 }
 
 bool
@@ -90,9 +94,9 @@ FileSource::init (const ustring& pathstr, bool must_exist)
                throw MissingSource ();
        }
 
-       /* XXX is this necessary? or even wise? */
+       set_within_session_from_path (pathstr);
 
-       if (_is_embedded) {
+       if (_within_session) {
                _name = Glib::path_get_basename (_name);
        }
 
@@ -103,12 +107,6 @@ FileSource::init (const ustring& pathstr, bool must_exist)
        return 0;
 }
 
-void
-FileSource::set_embedded_from_name ()
-{
-       _is_embedded = (_name.find(PATH_SEP) != string::npos);
-}
-
 int
 FileSource::set_state (const XMLNode& node, int /*version*/)
 {
@@ -120,8 +118,6 @@ FileSource::set_state (const XMLNode& node, int /*version*/)
                _channel = 0;
        }
 
-       set_embedded_from_name();
-
        return 0;
 }
 
@@ -136,12 +132,7 @@ FileSource::mark_take (const ustring& id)
 int
 FileSource::move_to_trash (const ustring& trash_dir_name)
 {
-       if (is_embedded()) {
-               cerr << "tried to move an embedded region to trash" << endl;
-               return -1;
-       }
-
-       if (!writable()) {
+       if (!within_session() || !writable()) {
                return -1;
        }
 
@@ -202,7 +193,7 @@ FileSource::move_to_trash (const ustring& trash_dir_name)
 
 /** Find the actual source file based on \a filename.
  *
- * If the source is embedded, \a filename should be a simple filename (no slashes).
+ * If the source is within the session tree, \a filename should be a simple filename (no slashes).
  * If the source is external, \a filename should be a full path.
  * In either case, found_path is set to the complete absolute path of the source file.
  * \return true iff the file was found.
@@ -426,3 +417,8 @@ FileSource::mark_immutable ()
        }
 }
 
+void
+FileSource::set_within_session_from_path (const std::string& path)
+{
+       _within_session = _session.path_is_within_session (path);
+}
index 53a28c8691b55b3a9ffff1136ff06127e67ec0ef..fc659b3ab82447bacf162eeff8c3119932e11593 100644 (file)
@@ -70,8 +70,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, true,
-                                       false, session.frame_rate())));
+                                                              path, false, session.frame_rate())));
                }
 
                catch (failed_constructor& err) {
index e2f52fe28f7082a158a4d927f26a2926e70dfafb..c980c49c02eb752334c25cdc31a64d39e08c4a02 100644 (file)
@@ -224,8 +224,9 @@ create_mono_sources_for_writing (const vector<string>& new_paths, Session& sess,
                        const DataType type = ((*i).rfind(".mid") != string::npos)
                                ? DataType::MIDI : DataType::AUDIO;
 
+
                        source = SourceFactory::createWritable (type, sess,
-                                       i->c_str(), true,
+                                       i->c_str(),
                                        false, // destructive
                                        samplerate);
                }
@@ -435,7 +436,7 @@ Session::import_audiofiles (ImportStatus& status)
                nframes64_t natural_position = source ? source->natural_position() : 0;
 
                if (status.replace_existing_source) {
-                       fatal << "THIS IS NOT IMPLEMENTED YET, IT SHOULD NEVER GET CALLED!!! DYING!" << endl;
+                       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 (new_paths, *this, frame_rate(), newfiles, natural_position);
index 709aa6739a7a20a12992fb8c78fb2eb715b4e893..2ece2f53cead56abe618e4777ea5d96555834350 100644 (file)
@@ -249,7 +249,7 @@ MidiSource::session_saved()
 
                boost::shared_ptr<MidiSource> newsrc = boost::dynamic_pointer_cast<MidiSource>(
                                SourceFactory::createWritable(DataType::MIDI, _session,
-                                               newpath, true, false, _session.frame_rate()));
+                                               newpath, false, _session.frame_rate()));
 
                newsrc->set_timeline_position(_timeline_position);
                _model->write_to(newsrc);
index 598d9b01b5058ff7b8613ff95282ccb6e5df233c..79d7ccf84cf29c93da770c65851e9ec78790bb8f 100644 (file)
@@ -3221,7 +3221,7 @@ Session::change_source_path_by_name (string path, string oldname, string newname
        return path;
 }
 
-/** Return the full path (in some session directory) for a new embedded source.
+/** Return the full path (in some session directory) for a new within-session source.
  * \a name must be a session-unique name that does not contain slashes
  *         (e.g. as returned by new_*_source_name)
  */
@@ -3342,7 +3342,7 @@ Session::new_audio_source_name (const string& base, uint32_t nchan, uint32_t cha
        return Glib::path_get_basename(buf);
 }
 
-/** Create a new embedded audio source */
+/** Create a new within-session audio source */
 boost::shared_ptr<AudioFileSource>
 Session::create_audio_source_for_session (AudioDiskstream& ds, uint32_t chan, bool destructive)
 {
@@ -3351,7 +3351,7 @@ Session::create_audio_source_for_session (AudioDiskstream& ds, uint32_t chan, bo
        const string path    = new_source_path_from_name(DataType::AUDIO, name);
 
        return boost::dynamic_pointer_cast<AudioFileSource> (
-               SourceFactory::createWritable (DataType::AUDIO, *this, path, true, 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 */
@@ -3403,7 +3403,7 @@ Session::new_midi_source_name (const string& base)
 }
 
 
-/** Create a new embedded MIDI source */
+/** Create a new within-session MIDI source */
 boost::shared_ptr<MidiSource>
 Session::create_midi_source_for_session (MidiDiskstream& ds)
 {
@@ -3412,7 +3412,7 @@ Session::create_midi_source_for_session (MidiDiskstream& ds)
 
        return boost::dynamic_pointer_cast<SMFSource> (
                        SourceFactory::createWritable (
-                                       DataType::MIDI, *this, path, true, false, frame_rate()));
+                                       DataType::MIDI, *this, path, false, frame_rate()));
 }
 
 
@@ -4233,7 +4233,7 @@ Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end,
 
                try {
                        fsource = boost::dynamic_pointer_cast<AudioFileSource> (
-                               SourceFactory::createWritable (DataType::AUDIO, *this, buf, true, false, frame_rate()));
+                               SourceFactory::createWritable (DataType::AUDIO, *this, buf, false, frame_rate()));
                }
 
                catch (failed_constructor& err) {
index 2e8915cdb5f20776b3419e3ad728f073d7c5ae56..6ff058f3a62893cffa7984c51eb46d51b1bcc576 100644 (file)
@@ -512,29 +512,6 @@ Session::spp_stop (Parser&, nframes_t /*timestamp*/)
                request_stop ();
        }
 }
-/*
-void
-Session::midi_clock_start (Parser& ignored, nframes_t timestamp)
-{
-        if (config.get_external_sync() && (config.get_sync_source() == MIDIClock)) {
-               request_transport_speed (1.0);
-       }
-}
-
-void
-Session::midi_clock_continue (Parser& parser, nframes_t timestamp)
-{
-       midi_clock_start (parser, 0);
-}
-
-void
-Session::midi_clock_stop (Parser& ignored, nframes_t timestamp)
-{
-       if (config.get_external_sync() && (config.get_slave_source() == MIDIClock)) {
-               request_stop ();
-       }
-}
-*/
 
 void
 Session::mmc_deferred_play (MIDI::MachineControl &/*mmc*/)
index 1664b0b9f91fc2ee687259015337fae65836e82c..86a317d1d120227d9cb03d2c18f51081a40e8926 100644 (file)
@@ -435,6 +435,17 @@ Session::setup_raid_path (string path)
        last_rr_session_dir = session_dirs.begin();
 }
 
+bool
+Session::path_is_within_session (const std::string& path)
+{
+       for (vector<space_and_path>::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) {
+               if (path.find ((*i).path) == 0) {
+                       return true;
+               }
+       }
+       return false;
+}
+
 int
 Session::ensure_subdirs ()
 {
index 57be02b618fa4ba0d0c3f2d167cc770f0f6b70bb..f48fc301f71cd7d77de994c964814a8b91e29d06 100644 (file)
@@ -49,16 +49,16 @@ using namespace ARDOUR;
 using namespace Glib;
 
 /** Constructor used for new internal-to-session files.  File cannot exist. */
-SMFSource::SMFSource (Session& s, const ustring& path, bool embedded, Source::Flag flags)
+SMFSource::SMFSource (Session& s, const ustring& path, Source::Flag flags)
        : Source(s, DataType::MIDI, path, flags)
        , MidiSource(s, path)
-       , FileSource(s, DataType::MIDI, path, embedded, flags)
+       , FileSource(s, DataType::MIDI, path, flags)
        , Evoral::SMF()
        , _last_ev_time_beats(0.0)
        , _last_ev_time_frames(0)
        , _smf_last_read_end (0)
 {
-       if (init(_name, false)) {
+       if (init(_path, false)) {
                throw failed_constructor ();
        }
 
@@ -82,7 +82,7 @@ SMFSource::SMFSource (Session& s, const XMLNode& node, bool must_exist)
                throw failed_constructor ();
        }
 
-       if (init(_name, true)) {
+       if (init(_path, true)) {
                throw failed_constructor ();
        }
 
index 1b8b01b85a994c91737c71d7755cb0136d8b2b50..5836bdd95cc3ad2d9ede2b3ea13de2c4c7a73e5e 100644 (file)
@@ -67,10 +67,9 @@ SndFileSource::SndFileSource (Session& s, const XMLNode& node)
 }
 
 /** Files created this way are never writable or removable */
-SndFileSource::SndFileSource (Session& s, const ustring& path, bool embedded, int chn, Flag flags)
+SndFileSource::SndFileSource (Session& s, const ustring& path, int chn, Flag flags)
        : Source(s, DataType::AUDIO, path, flags)
-       , AudioFileSource (s, path, embedded,
-                       Flag (flags & ~(Writable|Removable|RemovableIfEmpty|RemoveAtDestroy)))
+       , AudioFileSource (s, path, Flag (flags & ~(Writable|Removable|RemovableIfEmpty|RemoveAtDestroy)))
 {
        _channel = chn;
 
@@ -82,10 +81,10 @@ SndFileSource::SndFileSource (Session& s, const ustring& path, bool embedded, in
 }
 
 /** This constructor is used to construct new files, not open existing ones. */
-SndFileSource::SndFileSource (Session& s, const ustring& path, bool embedded,
+SndFileSource::SndFileSource (Session& s, const ustring& path, 
                SampleFormat sfmt, HeaderFormat hf, nframes_t rate, Flag flags)
        : Source(s, DataType::AUDIO, path, flags)
-       , AudioFileSource (s, path, embedded, flags, sfmt, hf)
+       , AudioFileSource (s, path, flags, sfmt, hf)
 {
        int fmt = 0;
 
@@ -178,12 +177,6 @@ SndFileSource::init_sndfile ()
        sf = 0;
        _broadcast_info = 0;
 
-       if (is_embedded()) {
-               _name = _path;
-       } else {
-               _name = Glib::path_get_basename (_path);
-       }
-
        /* although libsndfile says we don't need to set this,
           valgrind and source code shows us that we do.
        */
index 790b7f6c3e9cb85f2698658f71cbf4bb6b1eee0f..958bc2c1b5d623e4e885d3d962a8ab27f8767659 100644 (file)
@@ -239,10 +239,12 @@ Source::check_for_analysis_data_on_disk ()
 void
 Source::mark_for_remove ()
 {
-       // This operation is not allowed for sources for destructive tracks or embedded files.
-       // Fortunately mark_for_remove() is never called for embedded files. This function
-       // must be fixed if that ever happens.
-       if (_flags & Destructive) {
+       // This operation is not allowed for sources for destructive tracks or out-of-session files.
+
+       /* XXX need a way to detect _within_session() condition here - move it from FileSource? 
+        */
+
+       if ((_flags & Destructive)) { 
                return;
        }
 
index 999ae667dd1a8c8e44393e2b56f778c9119205ea..6753a0738f57ce318938148b12e02d4e2843f4f3 100644 (file)
@@ -191,8 +191,8 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
 }
 
 boost::shared_ptr<Source>
-SourceFactory::createReadable (DataType type, Session& s, const string& path, bool embedded,
-               int chn, Source::Flag flags, bool announce, bool defer_peaks)
+SourceFactory::createReadable (DataType type, Session& s, const string& path,
+                              int chn, Source::Flag flags, bool announce, bool defer_peaks)
 {
        if (type == DataType::AUDIO) {
 
@@ -200,7 +200,7 @@ SourceFactory::createReadable (DataType type, Session& s, const string& path, bo
 
                        try {
 
-                               Source* src = new SndFileSource (s, path, embedded, chn, flags);
+                               Source* src = new SndFileSource (s, path, chn, flags);
                                // boost_debug_shared_ptr_mark_interesting (src, typeid(src).name());
                                boost::shared_ptr<Source> ret (src);
                                
@@ -218,7 +218,7 @@ SourceFactory::createReadable (DataType type, Session& s, const string& path, bo
                        catch (failed_constructor& err) {
 #ifdef USE_COREAUDIO_FOR_FILES
 
-                               Source* src = new CoreAudioSource (s, path, embedded, chn, flags);
+                               Source* src = new CoreAudioSource (s, path, chn, flags);
                                // boost_debug_shared_ptr_mark_interesting (src, typeid(src).name());
                                boost::shared_ptr<Source> ret (src);
                                if (setup_peakfile (ret, defer_peaks)) {
@@ -241,7 +241,7 @@ SourceFactory::createReadable (DataType type, Session& s, const string& path, bo
 
        } else if (type == DataType::MIDI) {
                
-               Source* src = new SMFSource (s, path, embedded, SMFSource::Flag(0));
+               Source* src = new SMFSource (s, path, SMFSource::Flag(0));
                // boost_debug_shared_ptr_mark_interesting (src, typeid(src).name());
                boost::shared_ptr<Source> ret (src);
 
@@ -257,13 +257,13 @@ SourceFactory::createReadable (DataType type, Session& s, const string& path, bo
 }
 
 boost::shared_ptr<Source>
-SourceFactory::createWritable (DataType type, Session& s, const std::string& path, bool embedded,
-               bool destructive, nframes_t rate, bool announce, bool defer_peaks)
+SourceFactory::createWritable (DataType type, Session& s, const std::string& path, 
+                              bool destructive, nframes_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, embedded,
+               Source* src = new SndFileSource (s, path, 
                                s.config.get_native_file_data_format(),
                                s.config.get_native_file_header_format(),
                                rate,
@@ -286,7 +286,7 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat
 
        } else if (type == DataType::MIDI) {
 
-               Source* src = new SMFSource (s, path, embedded, Source::Flag(0));
+               Source* src = new SMFSource (s, path, Source::Flag(0));
                // boost_debug_shared_ptr_mark_interesting (src, typeid(src).name());
                boost::shared_ptr<Source> ret (src);