summaryrefslogtreecommitdiff
path: root/libs/ardour/test/profiling/load_session.cc
blob: 41dc48ef2fe2260712729f41058073975317e61c (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
#include "test_util.h"
#include "pbd/failed_constructor.h"
#include "ardour/ardour.h"
#include "ardour/audioengine.h"
#include "ardour/session.h"
#include <iostream>
#include <cstdlib>

using namespace std;
using namespace ARDOUR;

static const char* localedir = LOCALEDIR;

int main (int argc, char* argv[])
{
	if (argc != 3) {
		cerr << "Syntax: " << argv[0] << " <dir> <snapshot-name>\n";
		exit (EXIT_FAILURE);
	}

	ARDOUR::init (false, true, localedir);

	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);
	}

	AudioEngine::instance()->remove_session ();
	delete s;
	AudioEngine::instance()->stop ();

	AudioEngine::destroy ();

	return 0;
}