2 Copyright (C) 2006 Paul Davis
3 Written by Dave Robillard, 2006
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_midi_playlist_h__
21 #define __ardour_midi_playlist_h__
26 #include <ardour/ardour.h>
27 #include <ardour/playlist.h>
38 class MidiPlaylist : public ARDOUR::Playlist
42 struct State : public ARDOUR::StateManager::State
45 std::list<UndoAction> region_states;
47 State (std::string why) : ARDOUR::StateManager::State (why)
53 MidiPlaylist (Session&, const XMLNode&, bool hidden = false);
54 MidiPlaylist (Session&, string name, bool hidden = false);
55 MidiPlaylist (const MidiPlaylist&, string name, bool hidden = false);
56 MidiPlaylist (const MidiPlaylist&, jack_nframes_t start, jack_nframes_t cnt,
57 string name, bool hidden = false);
59 jack_nframes_t read (MidiRingBuffer& buf,
60 jack_nframes_t start, jack_nframes_t cnt, uint32_t chan_n=0);
62 int set_state (const XMLNode&);
63 UndoAction get_memento() const;
66 void apply_to_history (T& obj, void (T::*method)(const ARDOUR::StateManager::StateMap&, state_id_t))
68 RegionLock rlock (this);
69 (obj.*method) (states, _current_state_id);
72 bool destroy_region (boost::shared_ptr<Region>);
74 void drop_all_states ();
78 /* state management */
80 StateManager::State* state_factory (std::string) const;
81 Change restore_state (StateManager::State&);
82 void send_state_change (Change);
84 /* playlist "callbacks" */
85 void flush_notifications ();
87 void finalize_split_region (boost::shared_ptr<Region> original, boost::shared_ptr<Region> left, boost::shared_ptr<Region> right);
89 void check_dependents (boost::shared_ptr<Region> region, bool norefresh);
90 void refresh_dependents (boost::shared_ptr<Region> region);
91 void remove_dependents (boost::shared_ptr<Region> region);
94 ~MidiPlaylist (); /* public should use unref() */
97 XMLNode& state (bool full_state);
100 bool region_changed (Change, boost::shared_ptr<Region>);
103 } /* namespace ARDOUR */
105 #endif /* __ardour_midi_playlist_h__ */