summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-11-11 16:23:37 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-11-11 16:23:37 +0000
commit1c5e550e5d48d2580de21cce97192acdefa9afe4 (patch)
tree3eb729bd7e86df09d8a1d2d4892004bd8dc4459b /libs
parent5fc0eca38597428472e1926f8a4bc48cccf54537 (diff)
fix scons tests for various JACK functions; use jack_on_info_shutdown() if its available at compile time
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6061 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/SConscript12
-rw-r--r--libs/ardour/ardour/audioengine.h3
-rw-r--r--libs/ardour/ardour/session.h2
-rw-r--r--libs/ardour/audioengine.cc32
-rw-r--r--libs/ardour/session_transport.cc4
5 files changed, 42 insertions, 11 deletions
diff --git a/libs/ardour/SConscript b/libs/ardour/SConscript
index 60edcdeefe..a965d235b9 100644
--- a/libs/ardour/SConscript
+++ b/libs/ardour/SConscript
@@ -143,7 +143,7 @@ ardour.Merge ([ libraries['jack'] ])
# See if JACK supports jack_client_open()
#
-jack_test_source_file = """
+jack_client_open_source_file = """
#include <jack/jack.h>
int main(int argc, char **argv)
{
@@ -153,7 +153,7 @@ int main(int argc, char **argv)
"""
def CheckJackClientOpen(context):
context.Message('Checking for jack_client_open()...')
- result = context.TryLink(jack_test_source_file, '.c')
+ result = context.TryLink(jack_client_open_source_file, '.c')
context.Result(result)
return result
@@ -161,7 +161,7 @@ def CheckJackClientOpen(context):
# See if JACK supports jack_on_info_shutdown()
#
-jack_test_source_file = """
+jack_on_info_shutdown_source_file = """
#include <jack/jack.h>
void callback (int code, const char* reason, void* arg) { return; }
int main(int argc, char **argv)
@@ -173,7 +173,7 @@ int main(int argc, char **argv)
"""
def CheckJackOnInfoShutdown(context):
context.Message('Checking for jack_on_info_shutdown()...')
- result = context.TryLink(jack_test_source_file, '.c')
+ result = context.TryLink(jack_on_info_shutdown_source_file, '.c')
context.Result(result)
return result
@@ -181,7 +181,7 @@ def CheckJackOnInfoShutdown(context):
# See if JACK supports jack_recompute_total_latencies()
#
-jack_test_source_file = """
+jack_recompute_latencies_source_file = """
#include <jack/jack.h>
int main(int argc, char **argv)
{
@@ -191,7 +191,7 @@ int main(int argc, char **argv)
"""
def CheckJackRecomputeLatencies(context):
context.Message('Checking for jack_recompute_total_latencies()...')
- result = context.TryLink(jack_test_source_file, '.c')
+ result = context.TryLink(jack_recompute_latencies_source_file, '.c')
context.Result(result)
return result
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index 2d2acfed27..81fee6ded1 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -194,7 +194,7 @@ _ the regular process() call to session->process() is not made.
/* this signal is sent if JACK ever disconnects us */
- sigc::signal<void> Halted;
+ sigc::signal<void,const char*> Halted;
/* these two are emitted when the engine itself is
started and stopped
@@ -265,6 +265,7 @@ _ the regular process() call to session->process() is not made.
int connect_to_jack (std::string client_name);
static void halted (void *);
+ static void halted_info (jack_status_t, const char*, void *);
void meter_thread ();
void start_metering_thread ();
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 8cf3ce7c31..7c074c90f6 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -1471,7 +1471,7 @@ class Session : public PBD::StatefulDestructible
void non_realtime_overwrite (int entry_request_count, bool& finished);
void butler_transport_work ();
void post_transport ();
- void engine_halted ();
+ void engine_halted (const char*);
void xrun_recovery ();
TempoMap *_tempo_map;
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 298eb8fa8d..eeb505693f 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -141,7 +141,11 @@ AudioEngine::start ()
_processed_frames = 0;
last_monitor_check = 0;
+#ifdef HAVE_JACK_ON_INFO_SHUTDOWN
+ jack_on_info_shutdown (_priv_jack, halted_info, this);
+#else
jack_on_shutdown (_priv_jack, halted, this);
+#endif
jack_set_graph_order_callback (_priv_jack, _graph_order_callback, this);
jack_set_thread_init_callback (_priv_jack, _thread_init_callback, this);
jack_set_process_callback (_priv_jack, _process_callback, this);
@@ -824,7 +828,33 @@ AudioEngine::halted (void *arg)
ae->_jack = 0;
if (was_running) {
- ae->Halted(); /* EMIT SIGNAL */
+ ae->Halted(""); /* EMIT SIGNAL */
+ }
+}
+
+void
+AudioEngine::halted_info (jack_status_t code, const char* reason, void *arg)
+{
+ /* called from jack shutdown handler */
+
+ AudioEngine* ae = static_cast<AudioEngine *> (arg);
+ bool was_running = ae->_running;
+
+ ae->stop_metering_thread ();
+
+ ae->_running = false;
+ ae->_buffer_size = 0;
+ ae->_frame_rate = 0;
+ ae->_jack = 0;
+
+ if (was_running) {
+ switch (code) {
+ case JackBackendError:
+ ae->Halted(reason); /* EMIT SIGNAL */
+ break;
+ default:
+ ae->Halted(""); /* EMIT SIGNAL */
+ }
}
}
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index 23d7ab8f67..f8a0df9243 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -1278,7 +1278,7 @@ Session::request_roll_at_and_return (nframes_t start, nframes_t return_to)
}
void
-Session::engine_halted ()
+Session::engine_halted (const char* /* reason */)
{
bool ignored;
@@ -1317,7 +1317,7 @@ Session::xrun_recovery ()
to handle things in the same way.
*/
- engine_halted();
+ engine_halted ("");
}
}