Only show user-presets in favorite sidebar
[ardour.git] / libs / backends / jack / jack_connection.h
1 #ifndef __libardour_jack_connection_h__
2 #define __libardour_jack_connection_h__
3
4 #include <string>
5 #include "weak_libjack.h"
6
7 #include "pbd/signals.h"
8
9 namespace ARDOUR {
10
11 class JackConnection {
12   public:
13     JackConnection (const std::string& client_name, const std::string& session_uuid);
14     ~JackConnection ();
15
16     const std::string& client_name() const { return _client_name; }
17
18     int open ();
19     int close ();
20     bool connected () const { return _jack != 0; }
21
22     jack_client_t* jack() const { return _jack; }
23
24     PBD::Signal0<void> Connected;
25     PBD::Signal1<void,const char*> Disconnected;
26
27     void halted_callback ();
28     void halted_info_callback (jack_status_t, const char*);
29
30     static bool in_control() { return _in_control; }
31
32     uint32_t probed_buffer_size () const { assert (!connected ()); return _probed_buffer_size; }
33     uint32_t probed_sample_rate () const { assert (!connected ()); return _probed_sample_rate; }
34
35   private:
36     jack_client_t* volatile _jack;
37     std::string _client_name;
38     std::string session_uuid;
39     static bool _in_control;
40     uint32_t _probed_buffer_size; // when not in control
41     uint32_t _probed_sample_rate; // when not in control
42 };
43
44 } // namespace
45
46 #endif /* __libardour_jack_connection_h__ */