Commit 90349ced authored by sletz's avatar sletz
Browse files

Fix in JackAPI.cpp jack_client_new.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4002 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 875c0778
......@@ -56,9 +56,9 @@ extern "C"
const char *
jack_get_version_string();
EXPORT jack_client_t * jack_client_open_aux (const char *client_name,
jack_client_t * jack_client_new_aux (const char *client_name,
jack_options_t options,
jack_status_t *status, va_list ap);
jack_status_t *status);
EXPORT jack_client_t * jack_client_open (const char *client_name,
jack_options_t options,
jack_status_t *status, ...);
......@@ -300,7 +300,7 @@ EXPORT jack_client_t* jack_client_new(const char* client_name)
int options = JackUseExactName;
if (getenv("JACK_START_SERVER") == NULL)
options |= JackNoStartServer;
jack_client_t* res = jack_client_open_aux(client_name, (jack_options_t)options, NULL, NULL);
jack_client_t* res = jack_client_new_aux(client_name, (jack_options_t)options, NULL);
JackGlobals::fOpenMutex->Unlock();
return res;
} catch (std::bad_alloc& e) {
......
......@@ -36,7 +36,10 @@ extern "C"
{
#endif
EXPORT jack_client_t * jack_client_open_aux (const char *client_name,
jack_client_t * jack_client_new_aux (const char *client_name,
jack_options_t options,
jack_status_t *status);
jack_client_t * jack_client_open_aux (const char *client_name,
jack_options_t options,
jack_status_t *status, va_list ap);
EXPORT jack_client_t * jack_client_open (const char *client_name,
......@@ -52,7 +55,60 @@ extern "C"
JackLibGlobals* JackLibGlobals::fGlobals = NULL;
int JackLibGlobals::fClientCount = 0;
EXPORT jack_client_t* jack_client_open_aux(const char* client_name, jack_options_t options, jack_status_t* status, va_list ap)
jack_client_t* jack_client_new_aux(const char* client_name, jack_options_t options, jack_status_t* status)
{
jack_varargs_t va; /* variable arguments */
jack_status_t my_status;
JackClient* client;
if (client_name == NULL) {
jack_error("jack_client_new called with a NULL client_name");
return NULL;
}
jack_log("jack_client_new %s", client_name);
if (status == NULL) /* no status from caller? */
status = &my_status; /* use local status word */
*status = (jack_status_t)0;
/* validate parameters */
if ((options & ~JackOpenOptions)) {
int my_status1 = *status | (JackFailure | JackInvalidOption);
*status = (jack_status_t)my_status1;
return NULL;
}
/* parse variable arguments */
jack_varargs_init(&va);
JackLibGlobals::Init(); // jack library initialisation
if (try_start_server(&va, options, status)) {
jack_error("jack server is not running or cannot be started");
JackLibGlobals::Destroy(); // jack library destruction
return 0;
}
if (JACK_DEBUG) {
client = new JackDebugClient(new JackLibClient(GetSynchroTable())); // Debug mode
} else {
client = new JackLibClient(GetSynchroTable());
}
int res = client->Open(va.server_name, client_name, options, status);
if (res < 0) {
delete client;
JackLibGlobals::Destroy(); // jack library destruction
int my_status1 = (JackFailure | JackServerError);
*status = (jack_status_t)my_status1;
return NULL;
} else {
return (jack_client_t*)client;
}
}
jack_client_t* jack_client_open_aux(const char* client_name, jack_options_t options, jack_status_t* status, va_list ap)
{
jack_varargs_t va; /* variable arguments */
jack_status_t my_status;
......@@ -111,10 +167,10 @@ EXPORT jack_client_t* jack_client_open_aux(const char* client_name, jack_options
EXPORT jack_client_t* jack_client_open(const char* ext_client_name, jack_options_t options, jack_status_t* status, ...)
{
try {
#ifdef __CLIENTDEBUG__
JackGlobals::CheckContext("jack_client_open");
#endif
try {
assert(JackGlobals::fOpenMutex);
JackGlobals::fOpenMutex->Lock();
va_list ap;
......
......@@ -33,7 +33,10 @@ extern "C"
{
#endif
EXPORT jack_client_t * jack_client_open_aux (const char *client_name,
jack_client_t * jack_client_new_aux (const char *client_name,
jack_options_t options,
jack_status_t *status);
jack_client_t * jack_client_open_aux (const char *client_name,
jack_options_t options,
jack_status_t *status, va_list ap);
EXPORT jack_client_t * jack_client_open (const char *client_name,
......@@ -48,7 +51,58 @@ extern "C"
using namespace Jack;
EXPORT jack_client_t* jack_client_open_aux(const char* client_name, jack_options_t options, jack_status_t* status, va_list ap)
jack_client_t* jack_client_new_aux(const char* client_name, jack_options_t options, jack_status_t* status)
{
jack_varargs_t va; /* variable arguments */
jack_status_t my_status;
JackClient* client;
if (client_name == NULL) {
jack_error("jack_client_new called with a NULL client_name");
return NULL;
}
jack_log("jack_client_new %s", client_name);
if (status == NULL) /* no status from caller? */
status = &my_status; /* use local status word */
*status = (jack_status_t)0;
/* validate parameters */
if ((options & ~JackOpenOptions)) {
int my_status1 = *status | (JackFailure | JackInvalidOption);
*status = (jack_status_t)my_status1;
return NULL;
}
/* parse variable arguments */
jack_varargs_init(&va);
if (!JackServerGlobals::Init()) { // jack server initialisation
int my_status1 = (JackFailure | JackServerError);
*status = (jack_status_t)my_status1;
return NULL;
}
if (JACK_DEBUG) {
client = new JackDebugClient(new JackInternalClient(JackServerGlobals::fInstance, GetSynchroTable())); // Debug mode
} else {
client = new JackInternalClient(JackServerGlobals::fInstance, GetSynchroTable());
}
int res = client->Open(va.server_name, client_name, options, status);
if (res < 0) {
delete client;
JackServerGlobals::Destroy(); // jack server destruction
int my_status1 = (JackFailure | JackServerError);
*status = (jack_status_t)my_status1;
return NULL;
} else {
return (jack_client_t*)client;
}
}
jack_client_t* jack_client_open_aux(const char* client_name, jack_options_t options, jack_status_t* status, va_list ap)
{
jack_varargs_t va; /* variable arguments */
jack_status_t my_status;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment