ardour
lots_of_regions.cc
Go to the documentation of this file.
1 #include "test_util.h"
2 #include "ardour/ardour.h"
3 #include "ardour/midi_track.h"
4 #include "ardour/midi_region.h"
5 #include "ardour/session.h"
6 #include "ardour/playlist.h"
8 
9 using namespace std;
10 using namespace ARDOUR;
11 using namespace PBD;
12 
13 static const char* localedir = LOCALEDIR;
14 
15 int
16 main (int argc, char* argv[])
17 {
18  ARDOUR::init (false, true, localedir);
19  Session* session = load_session ("../libs/ardour/test/profiling/sessions/1region", "1region");
20 
21  assert (session->get_routes()->size() == 2);
22 
23  /* Find the track */
25  assert (track);
26 
27  /* And the playlist */
28  boost::shared_ptr<Playlist> playlist = track->playlist ();
29  assert (playlist);
30 
31  /* And the region */
33  assert (region);
34 
35  /* Duplicate it a lot */
36  session->begin_reversible_command ("foo");
37  playlist->clear_changes ();
38  playlist->duplicate (region, region->last_frame(), 1000);
39  session->add_command (new StatefulDiffCommand (playlist));
40  session->commit_reversible_command ();
41 
42  /* Undo that */
43  session->undo (1);
44 
45  /* And do it again */
46  session->begin_reversible_command ("foo");
47  playlist->clear_changes ();
48  playlist->duplicate (region, region->last_frame(), 1000);
49  session->add_command (new StatefulDiffCommand (playlist));
50  session->commit_reversible_command ();
51 }
void begin_reversible_command(const std::string &cmd_name)
Session * load_session(string dir, string state)
Definition: test_util.cc:125
void undo(uint32_t n)
Definition: session.h:767
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r)
Definition: shared_ptr.hpp:396
void add_command(Command *const cmd)
Definition: session.h:787
Definition: Beats.hpp:239
static const char * localedir
Container rlist() const
Definition: amp.h:29
void commit_reversible_command(Command *cmd=0)
boost::shared_ptr< RouteList > get_routes() const
Definition: session.h:229
void duplicate(boost::shared_ptr< Region >, framepos_t position, float times)
Definition: playlist.cc:1246
const RegionListProperty & region_list() const
Definition: playlist.h:163
Definition: debug.h:30
int main(int argc, char *argv[])
void clear_changes()
Definition: stateful.cc:184
LIBARDOUR_API bool init(bool with_vst, bool try_optimization, const char *localedir)
Definition: globals.cc:376
framepos_t last_frame() const
Definition: region.h:142