aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-08-11 20:43:54 -0700
committerChris Robinson <[email protected]>2016-08-11 20:43:54 -0700
commit9a60184bf63640f0b12b9e4a894b98e83212d229 (patch)
tree83b236fcdeb5c703d4149364749bab55ff01b1d5
parent56d3598020f553681ec88b830c21218556a80a84 (diff)
Set a JACK error message handler when initializing the backend
JACK2 will print error messages to stderr if it fails to connect to a server. Users who don't normally use JACK but have the client lib installed will get those messages even though OpenAL Soft will continue on to find a working backend without trouble. So to avoid it, set an error message handler that'll log them as warnings. This isn't that great because there's no way to tell whether the error messages are due to the server not running, or some other problem. And it resets the callback to the default afterward even if it may have been set to something else before. JACK2, which is what needs this workaround in the first place, doesn't export the jack_error_callback pointer to properly save and restore it.
-rw-r--r--Alc/backends/jack.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Alc/backends/jack.c b/Alc/backends/jack.c
index 517f99a4..283df297 100644
--- a/Alc/backends/jack.c
+++ b/Alc/backends/jack.c
@@ -54,6 +54,7 @@ static const ALCchar jackDevice[] = "JACK Default";
MAGIC(jack_get_ports); \
MAGIC(jack_free); \
MAGIC(jack_get_sample_rate); \
+ MAGIC(jack_set_error_function); \
MAGIC(jack_set_process_callback); \
MAGIC(jack_set_buffer_size_callback); \
MAGIC(jack_set_buffer_size); \
@@ -78,6 +79,7 @@ JACK_FUNCS(MAKE_FUNC);
#define jack_get_ports pjack_get_ports
#define jack_free pjack_free
#define jack_get_sample_rate pjack_get_sample_rate
+#define jack_set_error_function pjack_set_error_function
#define jack_set_process_callback pjack_set_process_callback
#define jack_set_buffer_size_callback pjack_set_buffer_size_callback
#define jack_set_buffer_size pjack_set_buffer_size
@@ -537,6 +539,11 @@ static void ALCjackPlayback_unlock(ALCjackPlayback *self)
}
+static void jack_msg_handler(const char *message)
+{
+ WARN("%s\n", message);
+}
+
typedef struct ALCjackBackendFactory {
DERIVE_FROM_TYPE(ALCbackendFactory);
} ALCjackBackendFactory;
@@ -552,7 +559,10 @@ static ALCboolean ALCjackBackendFactory_init(ALCjackBackendFactory* UNUSED(self)
if(!GetConfigValueBool(NULL, "jack", "spawn-server", 0))
ClientOptions |= JackNoStartServer;
+
+ jack_set_error_function(jack_msg_handler);
client = jack_client_open("alsoft", ClientOptions, &status, NULL);
+ jack_set_error_function(NULL);
if(client == NULL)
{
WARN("jack_client_open() failed, 0x%02x\n", status);