Browse Source

Define a JackShutdownCallback type, various callback related cleanup.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2949 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.90
sletz 15 years ago
parent
commit
e291f37568
5 changed files with 24 additions and 15 deletions
  1. +13
    -10
      common/JackAPI.cpp
  2. +0
    -2
      common/JackClient.h
  3. +1
    -1
      common/jack/jack.h
  4. +8
    -0
      common/jack/types.h
  5. +2
    -2
      posix/JackFifo.cpp

+ 13
- 10
common/JackAPI.cpp View File

@@ -45,6 +45,9 @@ extern "C"
{
#endif

typedef void (*print_function)(const char *);
typedef void *(*thread_routine)(void*);

EXPORT
void
jack_get_version(
@@ -72,7 +75,7 @@ extern "C"
EXPORT void jack_internal_client_close (const char *client_name);
EXPORT int jack_is_realtime (jack_client_t *client);
EXPORT void jack_on_shutdown (jack_client_t *client,
void (*function)(void *arg), void *arg);
JackShutdownCallback shutdown_callback, void *arg);
EXPORT int jack_set_process_callback (jack_client_t *client,
JackProcessCallback process_callback,
void *arg);
@@ -179,8 +182,8 @@ extern "C"
EXPORT jack_nframes_t jack_last_frame_time (const jack_client_t *client);
EXPORT float jack_cpu_load (jack_client_t *client);
EXPORT pthread_t jack_client_thread_id (jack_client_t *);
EXPORT void jack_set_error_function (void (*func)(const char *));
EXPORT void jack_set_info_function (void (*func)(const char *));
EXPORT void jack_set_error_function (print_function);
EXPORT void jack_set_info_function (print_function);

EXPORT float jack_get_max_delayed_usecs (jack_client_t *client);
EXPORT float jack_get_xrun_delayed_usecs (jack_client_t *client);
@@ -215,7 +218,7 @@ extern "C"
pthread_t *thread,
int priority,
int realtime, // boolean
void *(*start_routine)(void*),
thread_routine routine,
void *arg);
EXPORT int jack_drop_real_time_scheduling (pthread_t thread);
@@ -272,12 +275,12 @@ static inline void WaitGraphChange()
}
}

EXPORT void jack_set_error_function (void (*func)(const char *))
EXPORT void jack_set_error_function (print_function func)
{
jack_error_callback = func;
}

EXPORT void jack_set_info_function (void (*func)(const char *))
EXPORT void jack_set_info_function (print_function func)
{
jack_info_callback = func;
}
@@ -798,7 +801,7 @@ EXPORT int jack_is_realtime(jack_client_t* ext_client)
}
}

EXPORT void jack_on_shutdown(jack_client_t* ext_client, void (*function)(void* arg), void* arg)
EXPORT void jack_on_shutdown(jack_client_t* ext_client, JackShutdownCallback callback, void* arg)
{
#ifdef __CLIENTDEBUG__
JackLibGlobals::CheckContext();
@@ -807,7 +810,7 @@ EXPORT void jack_on_shutdown(jack_client_t* ext_client, void (*function)(void* a
if (client == NULL) {
jack_error("jack_on_shutdown called with a NULL client");
} else {
client->OnShutdown(function, arg);
client->OnShutdown(callback, arg);
}
}

@@ -1724,10 +1727,10 @@ EXPORT int jack_client_create_thread(jack_client_t* client,
pthread_t *thread,
int priority,
int realtime, /* boolean */
void *(*start_routine)(void*),
thread_routine routine,
void *arg)
{
return JackThread::StartImp(thread, priority, realtime, start_routine, arg);
return JackThread::StartImp(thread, priority, realtime, routine, arg);
}

EXPORT int jack_drop_real_time_scheduling(pthread_t thread)


+ 0
- 2
common/JackClient.h View File

@@ -40,8 +40,6 @@ class JackEngine;
struct JackClientControl;
struct JackEngineControl;

typedef void (*JackShutdownCallback)(void *arg);

/*!
\brief The base class for clients: share part of the implementation for JackInternalClient and JackLibClient.
*/


+ 1
- 1
common/jack/jack.h View File

@@ -193,7 +193,7 @@ extern "C"
* on. It should be called before jack_client_activate().
*/
void jack_on_shutdown (jack_client_t *client,
void (*function)(void *arg), void *arg);
JackShutdownCallback shutdown_callback, void *arg);

/**
* Tell the Jack server to call @a process_callback whenever there is


+ 8
- 0
common/jack/types.h View File

@@ -214,6 +214,14 @@ typedef int (*JackPortRenameCallback)(jack_port_id_t port, const char* new_name,
*/
typedef void (*JackFreewheelCallback)(int starting, void *arg);

/**
* Prototype for the client supplied function that is called
* whenever jackd is shutdown.
*
* @param arg pointer to a client supplied structure
*/
typedef void (*JackShutdownCallback)(void *arg);

/**
* Used for the type argument of jack_port_register() for default
* audio ports and midi ports.


+ 2
- 2
posix/JackFifo.cpp View File

@@ -113,8 +113,8 @@ bool JackFifo::TimedWait(long usec)
return Wait();
} else {
jack_error("JackFifo::TimedWait name = %s usec = %ld err = %s", fName, usec, strerror(errno));
// Wait failure but we still continue...
return true;
// Wait failure but we still continue...
return true;
}
}
#endif


Loading…
Cancel
Save