proper solution for variable-args jack_client_open()
This commit is contained in:
parent
9239a49a32
commit
a6ceff61dd
|
@ -74,7 +74,7 @@ JackConnection::JackConnection (const std::string& arg1, const std::string& arg2
|
|||
}
|
||||
|
||||
jack_status_t status;
|
||||
jack_client_t* c = jack_client_open1 ("ardourprobe", JackNoStartServer, &status);
|
||||
jack_client_t* c = jack_client_open ("ardourprobe", JackNoStartServer, &status);
|
||||
|
||||
if (status == 0) {
|
||||
jack_client_close (c);
|
||||
|
@ -114,7 +114,7 @@ JackConnection::open ()
|
|||
get_jack_server_dir_paths (dirs);
|
||||
set_path_env_for_jack_autostart (dirs);
|
||||
|
||||
if ((_jack = jack_client_open2 (_client_name.c_str(), JackSessionID, &status, session_uuid.c_str())) == 0) {
|
||||
if ((_jack = jack_client_open (_client_name.c_str(), JackSessionID, &status, session_uuid.c_str())) == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -180,25 +180,16 @@ int have_libjack (void) {
|
|||
* (jack ringbuffer may be an exception for some apps)
|
||||
*/
|
||||
|
||||
/* expand ellipsis for jack-session */
|
||||
jack_client_t * WJACK_client_open2 (const char *client_name, jack_options_t options, jack_status_t *status, const char *uuid) {
|
||||
if (_j._client_open) {
|
||||
return ((jack_client_t* (*)(const char *, jack_options_t, jack_status_t *, ...))(_j._client_open))(client_name, options, status, uuid);
|
||||
} else {
|
||||
WJACK_WARNING(client_open);
|
||||
if (status) *status = (jack_status_t)0;
|
||||
return NULL;
|
||||
}
|
||||
/* dedicated support for jack_client_open(,..) variable arg function macro */
|
||||
func_t WJACK_get_client_open(void) {
|
||||
return _j._client_open;
|
||||
}
|
||||
|
||||
jack_client_t * WJACK_client_open1 (const char *client_name, jack_options_t options, jack_status_t *status) {
|
||||
if (_j._client_open) {
|
||||
return ((jack_client_t* (*)(const char *, jack_options_t, jack_status_t *, ...))_j._client_open)(client_name, options, status);
|
||||
} else {
|
||||
WJACK_WARNING(client_open);
|
||||
if (status) *status = (jack_status_t)0;
|
||||
return NULL;
|
||||
}
|
||||
/* callback to set status */
|
||||
jack_client_t * WJACK_no_client_open (const char *client_name, jack_options_t options, jack_status_t *status, ...) {
|
||||
WJACK_WARNING(client_open);
|
||||
if (status) { *status = JackFailure; }
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
@ -48,7 +48,6 @@ int have_libjack(void);
|
|||
#ifdef USE_WEAK_JACK
|
||||
|
||||
/* <jack/jack.h> */
|
||||
#define jack_client_open WJACK_client_openX
|
||||
#define jack_client_close WJACK_client_close
|
||||
#define jack_get_client_name WJACK_get_client_name
|
||||
#define jack_get_sample_rate WJACK_get_sample_rate
|
||||
|
@ -153,34 +152,7 @@ int have_libjack(void);
|
|||
#define jack_client_stop_thread WJACK_client_stop_thread
|
||||
#define jack_client_kill_thread WJACK_client_kill_thread
|
||||
|
||||
/* var-args hack */
|
||||
#define jack_client_open1 WJACK_client_open1
|
||||
#define jack_client_open2 WJACK_client_open2
|
||||
|
||||
#include <jack/types.h> // needed for jack_client_open abstraction
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
jack_client_t * WJACK_client_open1 (
|
||||
const char *client_name,
|
||||
jack_options_t options, jack_status_t *status);
|
||||
|
||||
jack_client_t * WJACK_client_open2 (
|
||||
const char *client_name,
|
||||
jack_options_t options, jack_status_t *status, const char *uuid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#else /* directly use JACK API */
|
||||
|
||||
/* var-args hack */
|
||||
#define jack_client_open1 jack_client_open
|
||||
#define jack_client_open2 jack_client_open
|
||||
#define jack_client_open WJACK_client_client_openXXX
|
||||
|
||||
#endif // end USE_WEAK_JACK
|
||||
|
||||
|
@ -191,4 +163,28 @@ jack_client_t * WJACK_client_open2 (
|
|||
#include <jack/session.h>
|
||||
#include <jack/thread.h>
|
||||
|
||||
#ifdef USE_WEAK_JACK
|
||||
|
||||
#undef jack_client_open
|
||||
|
||||
/* var-args hack */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void (* WJACK_get_client_open (void)) (void);
|
||||
jack_client_t * WJACK_no_client_open (const char *client_name, jack_options_t options, jack_status_t *status, ...);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define jack_client_open(...) \
|
||||
( \
|
||||
(WJACK_get_client_open() != NULL) \
|
||||
? ((jack_client_t* (*)(const char *, jack_options_t, jack_status_t *, ...))(WJACK_get_client_open()))(__VA_ARGS__) \
|
||||
: WJACK_no_client_open(__VA_ARGS__) \
|
||||
)
|
||||
|
||||
#endif // end USE_WEAK_JACK
|
||||
|
||||
#endif // _WEAK_JACK_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user