#include "pbd/pthread_utils.h"
#include "pbd/enumwriter.h"
-#include "ardour/playlist.h"
+#include "ardour/debug.h"
#include "ardour/session.h"
#include "ardour/source.h"
#include "ardour/transient_detector.h"
{
_analysed = false;
_timestamp = 0;
- _in_use = 0;
fix_writable_flags ();
}
{
_timestamp = 0;
_analysed = false;
- _in_use = 0;
if (set_state (node, Stateful::loading_state_version) || _type == DataType::NIL) {
throw failed_constructor();
Source::~Source ()
{
- notify_callbacks ();
+ DEBUG_TRACE (DEBUG::Destruction, string_compose ("Source %1 destructor %2\n", _name, this));
}
-
void
Source::fix_writable_flags ()
{
}
int
-Source::set_state (const XMLNode& node, int version)
+Source::set_state (const XMLNode& node, int /*version*/)
{
const XMLProperty* prop;
return 0;
}
-void
-Source::add_playlist (boost::shared_ptr<Playlist> pl)
-{
- std::pair<PlaylistMap::iterator,bool> res;
- std::pair<boost::shared_ptr<Playlist>, uint32_t> newpair (pl, 1);
- Glib::Mutex::Lock lm (_playlist_lock);
-
- res = _playlists.insert (newpair);
-
- if (!res.second) {
- /* it already existed, bump count */
- res.first->second++;
- }
-
- pl->GoingAway.connect (bind (
- mem_fun (*this, &Source::remove_playlist),
- boost::weak_ptr<Playlist> (pl)));
-}
-
-void
-Source::remove_playlist (boost::weak_ptr<Playlist> wpl)
-{
- boost::shared_ptr<Playlist> pl (wpl.lock());
-
- if (!pl) {
- return;
- }
-
- PlaylistMap::iterator x;
- Glib::Mutex::Lock lm (_playlist_lock);
-
- if ((x = _playlists.find (pl)) != _playlists.end()) {
- if (x->second > 1) {
- x->second--;
- } else {
- _playlists.erase (x);
- }
- }
-}
-
-uint32_t
-Source::used () const
-{
- return _playlists.size();
-}
-
bool
Source::has_been_analysed() const
{
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;
}