Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <iostream>
#include <boost/scoped_ptr.hpp>
-#include <jack/session.h>
+
+#include <glibmm/timer.h>
#include "pbd/epa.h"
using std::cerr;
using std::endl;
+bool JackConnection::_in_control = false;
+
static void jack_halted_callback (void* arg)
{
JackConnection* jc = static_cast<JackConnection*> (arg);
: _jack (0)
, _client_name (arg1)
, session_uuid (arg2)
+ , _probed_buffer_size (0)
+ , _probed_sample_rate (0)
{
-}
-
-JackConnection::~JackConnection ()
-{
- close ();
-}
+ /* See if the server is already up
+ */
-bool
-JackConnection::server_running ()
-{
EnvironmentalProtectionAgency* global_epa = EnvironmentalProtectionAgency::get_global_epa ();
boost::scoped_ptr<EnvironmentalProtectionAgency> current_epa;
jack_client_t* c = jack_client_open ("ardourprobe", JackNoStartServer, &status);
if (status == 0) {
+ _probed_buffer_size = jack_get_buffer_size(c);
+ _probed_sample_rate = jack_get_sample_rate(c);
jack_client_close (c);
- return true;
+ _in_control = false;
+ } else {
+ _in_control = true;
}
+}
- return false;
+JackConnection::~JackConnection ()
+{
+ close ();
}
int
{
GET_PRIVATE_JACK_POINTER_RET (_jack, -1);
- if (_priv_jack) {
+ if (_priv_jack) {
int ret = jack_client_close (_priv_jack);
_jack = 0;
+
+ /* If we started JACK, it will be closing down */
+ Glib::usleep (500000);
+
Disconnected (""); /* EMIT SIGNAL */
+
return ret;
}
JackConnection::halted_callback ()
{
_jack = 0;
- cerr << "JACK HALTED\n";
+ std::cerr << "JACK HALTED\n";
Disconnected ("");
}
JackConnection::halted_info_callback (jack_status_t /*status*/, const char* reason)
{
_jack = 0;
- cerr << "JACK HALTED: " << reason << endl;
+ std::cerr << "JACK HALTED: " << reason << std::endl;
Disconnected (reason);
}