Ardour  9.0-pre0-582-g084a23a80d
session_playlists.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
3  * Copyright (C) 2009-2016 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2016-2019 Robin Gareus <robin@gareus.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #pragma once
22 
23 #include <memory>
24 #include <set>
25 #include <vector>
26 #include <string>
27 
28 #include <glibmm/threads.h>
29 
31 #include "ardour/types.h"
32 
33 #include "temporal/domain_swap.h"
34 
35 #include "pbd/signals.h"
36 
37 class XMLNode;
38 
39 namespace PBD {
40  class ID;
41 }
42 
43 namespace ARDOUR {
44 
45 class Playlist;
46 class Region;
47 class Source;
48 class Session;
49 class Crossfade;
50 class Track;
51 
53 {
54 public:
56 
57  std::shared_ptr<Playlist> for_pgroup (std::string name, const PBD::ID& for_track);
58  std::shared_ptr<Playlist> by_name (std::string name);
59  std::shared_ptr<Playlist> by_id (const PBD::ID&);
60  uint32_t source_use_count (std::shared_ptr<const Source> src) const;
61  uint32_t region_use_count (std::shared_ptr<Region> region) const;
62  template<class T> void foreach (T *obj, void (T::*func)(std::shared_ptr<Playlist>));
63  void foreach (std::function<void(std::shared_ptr<const Playlist>)> functor, bool incl_unused = true);
64  void get (std::vector<std::shared_ptr<Playlist> >&) const;
65  void unassigned (std::list<std::shared_ptr<Playlist> > & list);
66  void destroy_region (std::shared_ptr<Region>);
67  std::shared_ptr<Crossfade> find_crossfade (const PBD::ID &);
69  std::vector<std::shared_ptr<Playlist> > playlists_for_pgroup (std::string pgroup);
70  std::vector<std::shared_ptr<Playlist> > playlists_for_track (std::shared_ptr<Track>) const;
71  std::vector<std::shared_ptr<Playlist> > get_used () const;
72  std::vector<std::shared_ptr<Playlist> > get_unused () const;
73  uint32_t n_playlists() const;
74 
77 
78 private:
79  friend class Session;
80 
81  bool add (std::shared_ptr<Playlist>);
82  void remove (std::shared_ptr<Playlist>);
83  void remove_weak (std::weak_ptr<Playlist>);
84  void track (bool, std::weak_ptr<Playlist>);
85  void update_tracking ();
86 
88 
89  void find_equivalent_playlist_regions (std::shared_ptr<Region>, std::vector<std::shared_ptr<Region> >& result);
91  void add_state (XMLNode*, bool save_template, bool include_unused) const;
92  bool maybe_delete_unused (std::function<int(std::shared_ptr<Playlist>)>);
93  int load (Session &, const XMLNode&);
94  int load_unused (Session &, const XMLNode&);
95  std::shared_ptr<Playlist> XMLPlaylistFactory (Session &, const XMLNode&);
96 
97  mutable Glib::Threads::Mutex lock;
98 
101 };
102 
103 }
104 
std::shared_ptr< Playlist > by_id(const PBD::ID &)
void update_orig_2X(PBD::ID, PBD::ID)
std::vector< std::shared_ptr< Playlist > > playlists_for_track(std::shared_ptr< Track >) const
void track(bool, std::weak_ptr< Playlist >)
void remove(std::shared_ptr< Playlist >)
bool maybe_delete_unused(std::function< int(std::shared_ptr< Playlist >)>)
void destroy_region(std::shared_ptr< Region >)
int load(Session &, const XMLNode &)
Glib::Threads::Mutex lock
void finish_domain_bounce(Temporal::DomainBounceInfo &)
void unassigned(std::list< std::shared_ptr< Playlist > > &list)
void find_equivalent_playlist_regions(std::shared_ptr< Region >, std::vector< std::shared_ptr< Region > > &result)
std::shared_ptr< Crossfade > find_crossfade(const PBD::ID &)
void add_state(XMLNode *, bool save_template, bool include_unused) const
uint32_t region_use_count(std::shared_ptr< Region > region) const
std::vector< std::shared_ptr< Playlist > > get_unused() const
std::vector< std::shared_ptr< Playlist > > get_used() const
void remove_weak(std::weak_ptr< Playlist >)
std::vector< std::shared_ptr< Playlist > > playlists_for_pgroup(std::string pgroup)
std::shared_ptr< Playlist > XMLPlaylistFactory(Session &, const XMLNode &)
std::shared_ptr< Playlist > by_name(std::string name)
std::shared_ptr< Playlist > for_pgroup(std::string name, const PBD::ID &for_track)
bool add(std::shared_ptr< Playlist >)
uint32_t source_use_count(std::shared_ptr< const Source > src) const
uint32_t n_playlists() const
void start_domain_bounce(Temporal::DomainBounceInfo &)
void get(std::vector< std::shared_ptr< Playlist > > &) const
int load_unused(Session &, const XMLNode &)
Definition: id.h:34
Definition: xml++.h:114
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBARDOUR_API
PBD::PropertyDescriptor< bool > region
std::set< std::shared_ptr< Playlist > > PlaylistSet
Definition: axis_view.h:42