X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fplaylist.h;h=aa661b8588401a43604d5c236fd1a03458b3b7bb;hb=8713667ec1a6cc9ba56c07f763e5a422cc47fbef;hp=ad7210f48fc7f45fea511fa69d93e0da9557fff9;hpb=449aab3c465bbbf66d221fac3d7ea559f1720357;p=ardour.git diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index ad7210f48f..aa661b8588 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000 Paul Davis + Copyright (C) 2000 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -33,31 +34,35 @@ #include -#include -#include -#include +#include "pbd/undo.h" +#include "pbd/stateful.h" +#include "pbd/statefuldestructible.h" -#include -#include -#include -#include -#include +#include "evoral/types.hpp" + +#include "ardour/ardour.h" +#include "ardour/session_object.h" +#include "ardour/crossfade_compare.h" +#include "ardour/location.h" +#include "ardour/data_type.h" namespace ARDOUR { class Session; class Region; -class Playlist : public SessionObject, public boost::enable_shared_from_this { +class Playlist : public SessionObject, + public boost::noncopyable, + public boost::enable_shared_from_this { public: - typedef list > RegionList; + typedef std::list > RegionList; Playlist (Session&, const XMLNode&, DataType type, bool hidden = false); - Playlist (Session&, string name, DataType type, bool hidden = false); - Playlist (boost::shared_ptr, string name, bool hidden = false); - Playlist (boost::shared_ptr, nframes_t start, nframes_t cnt, string name, bool hidden = false); + Playlist (Session&, std::string name, DataType type, bool hidden = false); + Playlist (boost::shared_ptr, std::string name, bool hidden = false); + Playlist (boost::shared_ptr, nframes_t start, nframes_t cnt, std::string name, bool hidden = false); - virtual ~Playlist (); + virtual ~Playlist (); void set_region_ownership (); @@ -68,7 +73,7 @@ class Playlist : public SessionObject, public boost::enable_shared_from_this, nframes_t position, float times = 1); + void add_region (boost::shared_ptr, nframes_t position, float times = 1, bool auto_partition = false); void remove_region (boost::shared_ptr); void get_equivalent_regions (boost::shared_ptr, std::vector >&); void get_region_list_equivalent_regions (boost::shared_ptr, std::vector >&); @@ -94,14 +99,14 @@ class Playlist : public SessionObject, public boost::enable_shared_from_this, nframes_t position); void split (nframes64_t at); void shift (nframes64_t at, nframes64_t distance, bool move_intersected, bool ignore_music_glue); - void partition (nframes_t start, nframes_t end, bool just_top_level); + void partition (nframes_t start, nframes_t end, bool cut = false); void duplicate (boost::shared_ptr, nframes_t position, float times); void nudge_after (nframes_t start, nframes_t distance, bool forwards); void shuffle (boost::shared_ptr, int dir); void update_after_tempo_map_change (); - boost::shared_ptr cut (list&, bool result_is_hidden = true); - boost::shared_ptr copy (list&, bool result_is_hidden = true); + boost::shared_ptr cut (std::list&, bool result_is_hidden = true); + boost::shared_ptr copy (std::list&, bool result_is_hidden = true); int paste (boost::shared_ptr, nframes_t position, float times); RegionList* regions_at (nframes_t frame); @@ -109,25 +114,28 @@ class Playlist : public SessionObject, public boost::enable_shared_from_this find_region (const PBD::ID&) const; boost::shared_ptr top_region_at (nframes_t frame); + boost::shared_ptr top_unmuted_region_at (nframes_t frame); boost::shared_ptr find_next_region (nframes_t frame, RegionPoint point, int dir); nframes64_t find_next_region_boundary (nframes64_t frame, int dir); bool region_is_shuffle_constrained (boost::shared_ptr); nframes64_t find_next_transient (nframes64_t position, int dir); - template void foreach_region (T *t, void (T::*func)(boost::shared_ptr, void *), void *arg); - template void foreach_region (T *t, void (T::*func)(boost::shared_ptr)); + void foreach_region (sigc::slot >); XMLNode& get_state (); - int set_state (const XMLNode&); + int set_state (const XMLNode&, int version); XMLNode& get_template (); sigc::signal InUse; sigc::signal Modified; + sigc::signal > RegionAdded; + sigc::signal > RegionRemoved; sigc::signal NameChanged; sigc::signal LengthChanged; + sigc::signal > const &> RangesMoved; - static string bump_name (string old_name, Session&); + static std::string bump_name (std::string old_name, Session&); void freeze (); void thaw (); @@ -140,10 +148,10 @@ class Playlist : public SessionObject, public boost::enable_shared_from_this) = 0; /* special case function used by UI selection objects, which have playlists that actually own the regions @@ -152,42 +160,50 @@ class Playlist : public SessionObject, public boost::enable_shared_from_thisregion_lock.lock(); - if (block_notify) { - playlist->delay_notifications(); - } - } - ~RegionLock() { - playlist->region_lock.unlock(); - if (block_notify) { - playlist->release_notifications (); - } - } - Playlist *playlist; - bool block_notify; + RegionLock (Playlist *pl, bool do_block_notify = true) : playlist (pl), block_notify (do_block_notify) { + playlist->region_lock.lock(); + if (block_notify) { + playlist->delay_notifications(); + } + } + ~RegionLock() { + playlist->region_lock.unlock(); + if (block_notify) { + playlist->release_notifications (); + } + } + Playlist *playlist; + bool block_notify; }; friend class RegionLock; RegionList regions; /* the current list of regions in the playlist */ std::set > all_regions; /* all regions ever added to this playlist */ + std::list region_state_changed_connections; DataType _type; mutable gint block_notifications; mutable gint ignore_state_changes; - mutable Glib::Mutex region_lock; + mutable Glib::RecMutex region_lock; std::set > pending_adds; std::set > pending_removes; RegionList pending_bounds; bool pending_modified; bool pending_length; + std::list< Evoral::RangeMove > pending_range_moves; bool save_on_thaw; - string last_save_reason; + std::string last_save_reason; uint32_t in_set_state; bool first_set_state; bool _hidden; @@ -203,20 +219,22 @@ class Playlist : public SessionObject, public boost::enable_shared_from_this); void mark_session_dirty(); @@ -245,18 +264,18 @@ class Playlist : public SessionObject, public boost::enable_shared_from_this exclude); void splice_unlocked (nframes_t at, nframes64_t distance, boost::shared_ptr exclude); - virtual void finalize_split_region (boost::shared_ptr original, boost::shared_ptr left, boost::shared_ptr right) {} - - virtual void check_dependents (boost::shared_ptr region, bool norefresh) {} - virtual void refresh_dependents (boost::shared_ptr region) {} - virtual void remove_dependents (boost::shared_ptr region) {} + virtual void finalize_split_region (boost::shared_ptr /*original*/, boost::shared_ptr /*left*/, boost::shared_ptr /*right*/) {} + + virtual void check_dependents (boost::shared_ptr /*region*/, bool /*norefresh*/) {} + virtual void refresh_dependents (boost::shared_ptr /*region*/) {} + virtual void remove_dependents (boost::shared_ptr /*region*/) {} virtual XMLNode& state (bool); boost::shared_ptr region_by_id (PBD::ID); - void add_region_internal (boost::shared_ptr, nframes_t position); - + bool add_region_internal (boost::shared_ptr, nframes_t position); + int remove_region_internal (boost::shared_ptr); RegionList *find_regions_at (nframes_t frame); void copy_regions (RegionList&) const; @@ -264,14 +283,14 @@ class Playlist : public SessionObject, public boost::enable_shared_from_this cut_copy (boost::shared_ptr (Playlist::*pmf)(nframes_t, nframes_t, bool), - list& ranges, bool result_is_hidden); + boost::shared_ptr cut_copy (boost::shared_ptr (Playlist::*pmf)(nframes_t, nframes_t, bool), + std::list& ranges, bool result_is_hidden); boost::shared_ptr cut (nframes_t start, nframes_t cnt, bool result_is_hidden); boost::shared_ptr copy (nframes_t start, nframes_t cnt, bool result_is_hidden); int move_region_to_layer (layer_t, boost::shared_ptr r, int dir); void relayer (); - + void unset_freeze_parent (Playlist*); void unset_freeze_child (Playlist*);