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 drop_all_states ();
84 /* state management */
86 StateManager::State* state_factory (std::string) const;
87 Change restore_state (StateManager::State&);
88 void send_state_change (Change);
90 /* playlist "callbacks" */
91 void notify_crossfade_added (Crossfade *);
92 void flush_notifications ();
94 void finalize_split_region (Region *orig, Region *left, Region *right);
96 void refresh_dependents (Region& region);
97 void check_dependents (Region& region, bool norefresh);
98 void remove_dependents (Region& region);
101 ~AudioPlaylist (); /* public should use unref() */
104 Crossfades _crossfades;
105 Crossfades _pending_xfade_adds;
107 void crossfade_invalidated (Crossfade*);
108 XMLNode& state (bool full_state);
111 bool region_changed (Change, Region*);
112 void crossfade_changed (Change);
113 void add_crossfade (Crossfade&);
116 } /* namespace ARDOUR */
118 #endif /* __ardour_audio_playlist_h__ */