2 Copyright (C) 2003 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.
21 #ifndef __ardour_audio_playlist_h__
22 #define __ardour_audio_playlist_h__
27 #include <ardour/ardour.h>
28 #include <ardour/playlist.h>
37 class AudioPlaylist : public ARDOUR::Playlist
40 typedef std::list<Crossfade*> Crossfades;
44 struct State : public ARDOUR::StateManager::State {
46 std::list<UndoAction> region_states;
48 Crossfades crossfades;
49 std::list<UndoAction> crossfade_states;
51 State (std::string why) : ARDOUR::StateManager::State (why) {}
56 AudioPlaylist (Session&, const XMLNode&, bool hidden = false);
57 AudioPlaylist (Session&, string name, bool hidden = false);
58 AudioPlaylist (const AudioPlaylist&, string name, bool hidden = false);
59 AudioPlaylist (const AudioPlaylist&, jack_nframes_t start, jack_nframes_t cnt, string name, bool hidden = false);
61 void clear (bool with_delete = false, bool with_save = true);
63 jack_nframes_t read (Sample *dst, Sample *mixdown, float *gain_buffer, char * workbuf, jack_nframes_t start, jack_nframes_t cnt, uint32_t chan_n=0);
65 int set_state (const XMLNode&);
66 UndoAction get_memento() const;
68 sigc::signal<void,Crossfade *> NewCrossfade;
70 template<class T> void foreach_crossfade (T *t, void (T::*func)(Crossfade *));
71 void crossfades_at (jack_nframes_t frame, Crossfades&);
73 template<class T> void apply_to_history (T& obj, void (T::*method)(const ARDOUR::StateManager::StateMap&, state_id_t)) {
74 RegionLock rlock (this);
75 (obj.*method) (states, _current_state_id);
78 bool destroy_region (Region*);
80 void get_equivalent_regions (const AudioRegion&, std::vector<AudioRegion*>&);
81 void get_region_list_equivalent_regions (const AudioRegion&, std::vector<AudioRegion*>&);
83 void drop_all_states ();
87 /* state management */
89 StateManager::State* state_factory (std::string) const;
90 Change restore_state (StateManager::State&);
91 void send_state_change (Change);
93 /* playlist "callbacks" */
94 void notify_crossfade_added (Crossfade *);
95 void flush_notifications ();
97 void finalize_split_region (Region *orig, Region *left, Region *right);
99 void refresh_dependents (Region& region);
100 void check_dependents (Region& region, bool norefresh);
101 void remove_dependents (Region& region);
104 ~AudioPlaylist (); /* public should use unref() */
107 Crossfades _crossfades;
108 Crossfades _pending_xfade_adds;
110 void crossfade_invalidated (Crossfade*);
111 XMLNode& state (bool full_state);
114 bool region_changed (Change, Region*);
115 void crossfade_changed (Change);
116 void add_crossfade (Crossfade&);
119 } /* namespace ARDOUR */
121 #endif /* __ardour_audio_playlist_h__ */