Drop references held by any GUI Lua script after execution
[ardour.git] / session_utils / common.h
1 /*
2  * Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18
19 #ifndef _session_utils_common_h_
20 #define _session_utils_common_h_
21
22 #include "pbd/transmitter.h"
23 #include "pbd/receiver.h"
24
25 #include "ardour/ardour.h"
26 #include "ardour/session.h"
27
28 class TestReceiver : public Receiver
29 {
30   protected:
31     void receive (Transmitter::Channel chn, const char * str);
32 };
33
34 namespace SessionUtils {
35
36         /** initialize libardour */
37         void init (bool print_log = true);
38
39         /** clean up, stop Processing Engine
40          * @param s Session to close (may me NULL)
41          */
42         void cleanup ();
43
44         /** @param dir Session directory.
45          *  @param state Session state file, without .ardour suffix.
46          *  @returns an ardour session object (free with \ref unload_session) or NULL
47          */
48         ARDOUR::Session* load_session (std::string dir, std::string state, bool exit_at_failure = true);
49
50         /** @param dir Session directory.
51          *  @param state Session state file, without .ardour suffix.
52          *  @returns an ardour session object (free with \ref unload_session) or NULL on error
53          */
54         ARDOUR::Session* create_session (std::string dir, std::string state, float sample_rate);
55
56         /** close session and stop engine
57          * @param s Session to close (may me NULL)
58          */
59         void unload_session (ARDOUR::Session *s);
60
61 };
62
63 #endif /* _session_utils_misc_h_ */