blob: ab4573c88359b4f1d4c5cb9e90f57a9231c35888 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
#include "test_util.h"
#include <iostream>
#include <cstdlib>
#include <glib.h>
#include "pbd/failed_constructor.h"
#include "pbd/timing.h"
#include "ardour/ardour.h"
#include "ardour/audioengine.h"
#include "ardour/session.h"
#include "test_ui.h"
using namespace std;
using namespace ARDOUR;
static const char* localedir = LOCALEDIR;
static const int sleep_seconds = 2;
static
void
pause_for_effect()
{
// It may be useful to pause to make it easier to see what is happening in a
// visual tool like massif visualizer
std::cerr << "pausing for " << sleep_seconds << " seconds" << std::endl;
g_usleep(sleep_seconds*1000000);
}
int main (int argc, char* argv[])
{
if (argc != 3) {
cerr << "Syntax: " << argv[0] << " <dir> <snapshot-name>\n";
exit (EXIT_FAILURE);
}
std::cerr << "ARDOUR::init" << std::endl;
PBD::Timing ardour_init_timing;
ARDOUR::init (false, true, localedir);
ardour_init_timing.update();
TestUI* test_ui = new TestUI();
std::cerr << "ARDOUR::init time : " << ardour_init_timing.elapsed()
<< " usecs" << std::endl;
std::cerr << "Creating Dummy backend" << std::endl;
create_and_start_dummy_backend ();
std::cerr << "Loading session: " << argv[2] << std::endl;
PBD::Timing load_session_timing;
Session* s = 0;
try {
s = load_session (argv[1], argv[2]);
} catch (failed_constructor& e) {
cerr << "failed_constructor: " << e.what() << "\n";
exit (EXIT_FAILURE);
} catch (AudioEngine::PortRegistrationFailure& e) {
cerr << "PortRegistrationFailure: " << e.what() << "\n";
exit (EXIT_FAILURE);
} catch (exception& e) {
cerr << "exception: " << e.what() << "\n";
exit (EXIT_FAILURE);
} catch (...) {
cerr << "unknown exception.\n";
exit (EXIT_FAILURE);
}
load_session_timing.update();
std::cerr << "Loading session time : " << load_session_timing.elapsed()
<< " usecs" << std::endl;
PBD::Timing save_session_timing;
pause_for_effect ();
std::cerr << "Saving session: " << argv[2] << std::endl;
s->save_state("");
save_session_timing.update();
std::cerr << "Saving session time : " << save_session_timing.elapsed()
<< " usecs" << std::endl;
std::cerr << "AudioEngine::remove_session" << std::endl;
AudioEngine::instance()->remove_session ();
PBD::Timing destroy_session_timing;
delete s;
destroy_session_timing.update();
std::cerr << "Destroy session time : " << destroy_session_timing.elapsed()
<< " usecs" << std::endl;
AudioEngine::instance()->stop ();
AudioEngine::destroy ();
delete test_ui;
ARDOUR::cleanup ();
return 0;
}
|