2 Copyright (C) 2009 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_session_playlists_h__
21 #define __ardour_session_playlists_h__
26 #include <glibmm/thread.h>
27 #include <boost/shared_ptr.hpp>
28 #include <boost/function.hpp>
30 #include "pbd/signals.h"
46 class SessionPlaylists : public PBD::ScopedConnectionList
51 boost::shared_ptr<Playlist> by_name (std::string name);
52 boost::shared_ptr<Playlist> by_id (const PBD::ID&);
53 uint32_t source_use_count (boost::shared_ptr<const Source> src) const;
54 uint32_t region_use_count (boost::shared_ptr<Region> region) const;
55 template<class T> void foreach (T *obj, void (T::*func)(boost::shared_ptr<Playlist>));
56 void get (std::vector<boost::shared_ptr<Playlist> >&);
57 void unassigned (std::list<boost::shared_ptr<Playlist> > & list);
58 void destroy_region (boost::shared_ptr<Region>);
59 boost::shared_ptr<Crossfade> find_crossfade (const PBD::ID &);
60 void sync_all_regions_with_regions ();
65 bool add (boost::shared_ptr<Playlist>);
66 void remove (boost::shared_ptr<Playlist>);
67 void remove_weak (boost::weak_ptr<Playlist>);
68 void track (bool, boost::weak_ptr<Playlist>);
70 uint32_t n_playlists() const;
71 void find_equivalent_playlist_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >& result);
72 void update_after_tempo_map_change ();
73 void add_state (XMLNode *, bool);
74 bool maybe_delete_unused (boost::function<int(boost::shared_ptr<Playlist>)>);
75 int load (Session &, const XMLNode&);
76 int load_unused (Session &, const XMLNode&);
77 boost::shared_ptr<Playlist> XMLPlaylistFactory (Session &, const XMLNode&);
79 mutable Glib::Mutex lock;
80 typedef std::set<boost::shared_ptr<Playlist> > List;
82 List unused_playlists;