merge with master, including manual merge conflict resolution
[ardour.git] / libs / ardour / test / load_session.cc
1 #include "test_util.h"
2 #include "pbd/failed_constructor.h"
3 #include "ardour/ardour.h"
4 #include "ardour/audioengine.h"
5 #include "ardour/session.h"
6 #include "midi++/manager.h"
7 #include <iostream>
8 #include <cstdlib>
9
10 using namespace std;
11 using namespace ARDOUR;
12
13 static const char* localedir = LOCALEDIR;
14
15 int main (int argc, char* argv[])
16 {
17         if (argc != 3) {
18                 cerr << "Syntax: " << argv[0] << " <dir> <snapshot-name>\n";
19                 exit (EXIT_FAILURE);
20         }
21
22         ARDOUR::init (false, true, localedir);
23
24         Session* s = 0;
25         
26         try {
27                 s = load_session (argv[1], argv[2]);
28         } catch (failed_constructor& e) {
29                 cerr << "failed_constructor: " << e.what() << "\n";
30                 exit (EXIT_FAILURE);
31         } catch (AudioEngine::PortRegistrationFailure& e) {
32                 cerr << "PortRegistrationFailure: " << e.what() << "\n";
33                 exit (EXIT_FAILURE);
34         } catch (exception& e) {
35                 cerr << "exception: " << e.what() << "\n";
36                 exit (EXIT_FAILURE);
37         } catch (...) {
38                 cerr << "unknown exception.\n";
39                 exit (EXIT_FAILURE);
40         }
41
42         AudioEngine::instance()->remove_session ();
43         delete s;
44         AudioEngine::instance()->stop (true);
45
46         MIDI::Manager::destroy ();
47         AudioEngine::destroy ();
48
49         return 0;
50 }