summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/atomicity.h4
-rw-r--r--include/bitset.h62
-rw-r--r--include/driver.h178
-rw-r--r--include/driver_interface.h107
-rw-r--r--include/driver_parse.h52
-rw-r--r--include/engine.h320
-rw-r--r--include/hardware.h24
-rw-r--r--include/internal.h600
-rw-r--r--include/intsimd.h44
-rw-r--r--include/memops.h110
-rw-r--r--include/messagebuffer.h18
-rw-r--r--include/pool.h14
-rw-r--r--include/port.h138
-rw-r--r--include/sanitycheck.h4
-rw-r--r--include/shm.h85
-rw-r--r--include/start.h2
-rw-r--r--include/systemtest.h12
-rw-r--r--include/unlock.h12
-rw-r--r--include/varargs.h34
19 files changed, 912 insertions, 908 deletions
diff --git a/include/atomicity.h b/include/atomicity.h
index fb625ec..edf4ada 100644
--- a/include/atomicity.h
+++ b/include/atomicity.h
@@ -1,6 +1,6 @@
/*
Copyright (C) 2004 Jack O'Quin
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ */
#ifndef __jack_atomicity_h__
#define __jack_atomicity_h__
diff --git a/include/bitset.h b/include/bitset.h
index f607815..4c89f9b 100644
--- a/include/bitset.h
+++ b/include/bitset.h
@@ -19,12 +19,12 @@
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -33,8 +33,8 @@
#ifndef __bitset_h__
#define __bitset_h__
-#include <inttypes.h> /* POSIX standard fixed-size types */
-#include <assert.h> /* `#define NDEBUG' to disable */
+#include <inttypes.h> /* POSIX standard fixed-size types */
+#include <assert.h> /* `#define NDEBUG' to disable */
/* On some 64-bit machines, this implementation may be slightly
* inefficient, depending on how compilers allocate space for
@@ -45,67 +45,67 @@
typedef uint32_t _bitset_word_t;
typedef _bitset_word_t *bitset_t;
-#define WORD_SIZE(cardinality) (1+((cardinality)+31)/32)
-#define BYTE_SIZE(cardinality) (WORD_SIZE(cardinality)*sizeof(_bitset_word_t))
-#define WORD_INDEX(element) (1+(element)/32)
-#define BIT_INDEX(element) ((element)&037)
+#define WORD_SIZE(cardinality) (1 + ((cardinality) + 31) / 32)
+#define BYTE_SIZE(cardinality) (WORD_SIZE (cardinality) * sizeof(_bitset_word_t))
+#define WORD_INDEX(element) (1 + (element) / 32)
+#define BIT_INDEX(element) ((element) & 037)
static inline void
-bitset_add(bitset_t set, unsigned int element)
+bitset_add (bitset_t set, unsigned int element)
{
- assert(element < set[0]);
- set[WORD_INDEX(element)] |= (1 << BIT_INDEX(element));
+ assert (element < set[0]);
+ set[WORD_INDEX (element)] |= (1 << BIT_INDEX (element));
}
static inline void
-bitset_copy(bitset_t to_set, bitset_t from_set)
+bitset_copy (bitset_t to_set, bitset_t from_set)
{
- assert(to_set[0] == from_set[0]);
- memcpy(to_set, from_set, BYTE_SIZE(to_set[0]));
+ assert (to_set[0] == from_set[0]);
+ memcpy (to_set, from_set, BYTE_SIZE (to_set[0]));
}
static inline void
-bitset_create(bitset_t *set, unsigned int cardinality)
+bitset_create (bitset_t *set, unsigned int cardinality)
{
- *set = (bitset_t) calloc(WORD_SIZE(cardinality),
+ *set = (bitset_t)calloc (WORD_SIZE (cardinality),
sizeof(_bitset_word_t));
- assert(*set);
+ assert (*set);
*set[0] = cardinality;
}
static inline void
-bitset_destroy(bitset_t *set)
+bitset_destroy (bitset_t *set)
{
if (*set) {
- free(*set);
- *set = (bitset_t) 0;
+ free (*set);
+ *set = (bitset_t)0;
}
}
static inline int
-bitset_empty(bitset_t set)
+bitset_empty (bitset_t set)
{
int i;
_bitset_word_t result = 0;
- int nwords = WORD_SIZE(set[0]);
- for (i = 1; i < nwords; i++) {
+ int nwords = WORD_SIZE (set[0]);
+
+ for (i = 1; i < nwords; i++)
result |= set[i];
- }
- return (result == 0);
+ return result == 0;
}
static inline int
-bitset_contains(bitset_t set, unsigned int element)
+bitset_contains (bitset_t set, unsigned int element)
{
- assert(element < set[0]);
- return (0 != (set[WORD_INDEX(element)] & (1<<BIT_INDEX(element))));
+ assert (element < set[0]);
+ return 0 != (set[WORD_INDEX (element)] & (1 << BIT_INDEX (element)));
}
static inline void
-bitset_remove(bitset_t set, unsigned int element)
+bitset_remove (bitset_t set, unsigned int element)
{
- assert(element < set[0]);
- set[WORD_INDEX(element)] &= ~(1<<BIT_INDEX(element));
+ assert (element < set[0]);
+ set[WORD_INDEX (element)] &= ~(1 << BIT_INDEX (element));
}
#endif /* __bitset_h__ */
diff --git a/include/driver.h b/include/driver.h
index e483b5a..bc639f3 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2001 Paul Davis
+ Copyright (C) 2001 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ */
#ifndef __jack_driver_h__
#define __jack_driver_h__
@@ -26,53 +26,53 @@
#include "port.h"
#include "driver_interface.h"
-typedef float gain_t;
+typedef float gain_t;
typedef unsigned long channel_t;
-typedef enum {
+typedef enum {
Lock = 0x1,
NoLock = 0x2,
Sync = 0x4,
NoSync = 0x8
} ClockSyncStatus;
-typedef void (*ClockSyncListenerFunction)(channel_t,ClockSyncStatus,void*);
+typedef void (*ClockSyncListenerFunction)(channel_t, ClockSyncStatus, void*);
typedef struct {
- unsigned long id;
- ClockSyncListenerFunction function;
- void *arg;
+ unsigned long id;
+ ClockSyncListenerFunction function;
+ void *arg;
} ClockSyncListener;
struct _jack_engine;
struct _jack_driver;
-typedef int (*JackDriverAttachFunction)(struct _jack_driver *,
- struct _jack_engine *);
-typedef int (*JackDriverDetachFunction)(struct _jack_driver *,
- struct _jack_engine *);
-typedef int (*JackDriverReadFunction)(struct _jack_driver *,
- jack_nframes_t nframes);
-typedef int (*JackDriverWriteFunction)(struct _jack_driver *,
- jack_nframes_t nframes);
-typedef int (*JackDriverNullCycleFunction)(struct _jack_driver *,
- jack_nframes_t nframes);
-typedef int (*JackDriverStopFunction)(struct _jack_driver *);
-typedef int (*JackDriverStartFunction)(struct _jack_driver *);
-typedef int (*JackDriverBufSizeFunction)(struct _jack_driver *,
- jack_nframes_t nframes);
-/*
+typedef int (*JackDriverAttachFunction)(struct _jack_driver *,
+ struct _jack_engine *);
+typedef int (*JackDriverDetachFunction)(struct _jack_driver *,
+ struct _jack_engine *);
+typedef int (*JackDriverReadFunction)(struct _jack_driver *,
+ jack_nframes_t nframes);
+typedef int (*JackDriverWriteFunction)(struct _jack_driver *,
+ jack_nframes_t nframes);
+typedef int (*JackDriverNullCycleFunction)(struct _jack_driver *,
+ jack_nframes_t nframes);
+typedef int (*JackDriverStopFunction)(struct _jack_driver *);
+typedef int (*JackDriverStartFunction)(struct _jack_driver *);
+typedef int (*JackDriverBufSizeFunction)(struct _jack_driver *,
+ jack_nframes_t nframes);
+/*
Call sequence summary:
1) engine loads driver via runtime dynamic linking
- - calls jack_driver_load
- - we call dlsym for "driver_initialize" and execute it
+ - calls jack_driver_load
+ - we call dlsym for "driver_initialize" and execute it
2) engine attaches to driver
3) engine starts driver
4) driver runs its own thread, calling
while () {
driver->wait ();
- driver->engine->run_cycle ()
+ driver->engine->run_cycle ()
}
5) engine stops driver
6) engine detaches from driver
@@ -80,7 +80,7 @@ typedef int (*JackDriverBufSizeFunction)(struct _jack_driver *,
Note that stop/start may be called multiple times in the event of an
error return from the `wait' function.
-*/
+ */
typedef struct _jack_driver {
@@ -88,7 +88,7 @@ typedef struct _jack_driver {
each driver-specific structure using the JACK_DRIVER_DECL macro,
which is defined below. The comments that follow describe each
common field.
-
+
The driver should set this to be the interval it expects to elapse
between returning from the `wait' function. if set to zero, it
implies that the driver does not expect regular periodic wakeups.
@@ -106,7 +106,7 @@ typedef struct _jack_driver {
These are not used by the driver. They should not be written to or
modified in any way
-
+
void *handle;
struct _jack_internal_client *internal_client;
@@ -133,23 +133,23 @@ typedef struct _jack_driver {
JackDriverDetachFunction detach;
- The JACK engine will call this when it wants to wait until the
+ The JACK engine will call this when it wants to wait until the
driver decides that its time to process some data. the driver returns
- a count of the number of audioframes that can be processed.
+ a count of the number of audioframes that can be processed.
it should set the variable pointed to by `status' as follows:
zero: the wait completed normally, processing may begin
negative: the wait failed, and recovery is not possible
positive: the wait failed, and the driver stopped itself.
- a call to `start' will return the driver to
- a correct and known state.
+ a call to `start' will return the driver to
+ a correct and known state.
the driver should also fill out the `delayed_usecs' variable to
indicate any delay in its expected periodic execution. for example,
if it discovers that its return from poll(2) is later than it
expects it to be, it would place an estimate of the delay
- in this variable. the engine will use this to decide if it
+ in this variable. the engine will use this to decide if it
plans to continue execution.
JackDriverWaitFunction wait;
@@ -157,8 +157,8 @@ typedef struct _jack_driver {
The JACK engine will call this to ask the driver to move
data from its inputs to its output port buffers. it should
- return 0 to indicate successful completion, negative otherwise.
-
+ return 0 to indicate successful completion, negative otherwise.
+
This function will always be called after the wait function (above).
JackDriverReadFunction read;
@@ -166,8 +166,8 @@ typedef struct _jack_driver {
The JACK engine will call this to ask the driver to move
data from its input port buffers to its outputs. it should
- return 0 to indicate successful completion, negative otherwise.
-
+ return 0 to indicate successful completion, negative otherwise.
+
this function will always be called after the read function (above).
JackDriverWriteFunction write;
@@ -181,7 +181,7 @@ typedef struct _jack_driver {
JackDriverNullCycleFunction null_cycle;
-
+
The engine will call this when it plans to stop calling the `wait'
function for some period of time. the driver should take
appropriate steps to handle this (possibly no steps at all).
@@ -198,7 +198,7 @@ typedef struct _jack_driver {
at all). NOTE: The driver may wish to silence its playback buffers
(if any) from within this function or the function that actually
implements the change in state.
-
+
JackDriverStartFunction start;
The engine will call this to let the driver know that some client
@@ -206,48 +206,48 @@ typedef struct _jack_driver {
prior to this, and the start function after this one has returned.
JackDriverBufSizeFunction bufsize;
-*/
+ */
-/* define the fields here... */
+/* define the fields here... */
#define JACK_DRIVER_DECL \
- jack_time_t period_usecs; \
- jack_time_t last_wait_ust; \
- void *handle; \
- struct _jack_client_internal * internal_client; \
- void (*finish)(struct _jack_driver *);\
- JackDriverAttachFunction attach; \
- JackDriverDetachFunction detach; \
- JackDriverReadFunction read; \
- JackDriverWriteFunction write; \
- JackDriverNullCycleFunction null_cycle; \
- JackDriverStopFunction stop; \
- JackDriverStartFunction start; \
- JackDriverBufSizeFunction bufsize;
-
- JACK_DRIVER_DECL /* expand the macro */
+ jack_time_t period_usecs; \
+ jack_time_t last_wait_ust; \
+ void *handle; \
+ struct _jack_client_internal * internal_client; \
+ void (*finish)(struct _jack_driver *); \
+ JackDriverAttachFunction attach; \
+ JackDriverDetachFunction detach; \
+ JackDriverReadFunction read; \
+ JackDriverWriteFunction write; \
+ JackDriverNullCycleFunction null_cycle; \
+ JackDriverStopFunction stop; \
+ JackDriverStartFunction start; \
+ JackDriverBufSizeFunction bufsize;
+
+ JACK_DRIVER_DECL /* expand the macro */
} jack_driver_t;
-typedef jack_driver_desc_t * (*JackDriverDescFunction) ();
+typedef jack_driver_desc_t * (*JackDriverDescFunction)();
-void jack_driver_init (jack_driver_t *);
-void jack_driver_release (jack_driver_t *);
+void jack_driver_init(jack_driver_t *);
+void jack_driver_release(jack_driver_t *);
-jack_driver_t *jack_driver_load (int argc, char **argv);
-void jack_driver_unload (jack_driver_t *);
+jack_driver_t *jack_driver_load(int argc, char **argv);
+void jack_driver_unload(jack_driver_t *);
/****************************
- *** Non-Threaded Drivers ***
- ****************************/
+*** Non-Threaded Drivers ***
+****************************/
-/*
+/*
Call sequence summary:
1) engine loads driver via runtime dynamic linking
- - calls jack_driver_load
- - we call dlsym for "driver_initialize" and execute it
+ - calls jack_driver_load
+ - we call dlsym for "driver_initialize" and execute it
- driver_initialize calls jack_driver_nt_init
2) nt layer attaches to driver
3) nt layer starts driver
@@ -263,43 +263,43 @@ void jack_driver_unload (jack_driver_t *);
error return from the `wait' function.
-*/
+ */
struct _jack_driver_nt;
-typedef int (*JackDriverNTAttachFunction)(struct _jack_driver_nt *);
-typedef int (*JackDriverNTDetachFunction)(struct _jack_driver_nt *);
-typedef int (*JackDriverNTStopFunction)(struct _jack_driver_nt *);
-typedef int (*JackDriverNTStartFunction)(struct _jack_driver_nt *);
-typedef int (*JackDriverNTBufSizeFunction)(struct _jack_driver_nt *,
- jack_nframes_t nframes);
-typedef int (*JackDriverNTRunCycleFunction)(struct _jack_driver_nt *);
+typedef int (*JackDriverNTAttachFunction)(struct _jack_driver_nt *);
+typedef int (*JackDriverNTDetachFunction)(struct _jack_driver_nt *);
+typedef int (*JackDriverNTStopFunction)(struct _jack_driver_nt *);
+typedef int (*JackDriverNTStartFunction)(struct _jack_driver_nt *);
+typedef int (*JackDriverNTBufSizeFunction)(struct _jack_driver_nt *,
+ jack_nframes_t nframes);
+typedef int (*JackDriverNTRunCycleFunction)(struct _jack_driver_nt *);
typedef struct _jack_driver_nt {
#define JACK_DRIVER_NT_DECL \
- JACK_DRIVER_DECL \
- struct _jack_engine * engine; \
- volatile int nt_run; \
- pthread_t nt_thread; \
- pthread_mutex_t nt_run_lock; \
- JackDriverNTAttachFunction nt_attach; \
- JackDriverNTDetachFunction nt_detach; \
- JackDriverNTStopFunction nt_stop; \
- JackDriverNTStartFunction nt_start; \
- JackDriverNTBufSizeFunction nt_bufsize; \
- JackDriverNTRunCycleFunction nt_run_cycle;
+ JACK_DRIVER_DECL \
+ struct _jack_engine * engine; \
+ volatile int nt_run; \
+ pthread_t nt_thread; \
+ pthread_mutex_t nt_run_lock; \
+ JackDriverNTAttachFunction nt_attach; \
+ JackDriverNTDetachFunction nt_detach; \
+ JackDriverNTStopFunction nt_stop; \
+ JackDriverNTStartFunction nt_start; \
+ JackDriverNTBufSizeFunction nt_bufsize; \
+ JackDriverNTRunCycleFunction nt_run_cycle;
#define nt_read read
#define nt_write write
#define nt_null_cycle null_cycle
- JACK_DRIVER_NT_DECL
+ JACK_DRIVER_NT_DECL
} jack_driver_nt_t;
-void jack_driver_nt_init (jack_driver_nt_t * driver);
-void jack_driver_nt_finish (jack_driver_nt_t * driver);
+void jack_driver_nt_init(jack_driver_nt_t * driver);
+void jack_driver_nt_finish(jack_driver_nt_t * driver);
#endif /* __jack_driver_h__ */
diff --git a/include/driver_interface.h b/include/driver_interface.h
index 2cd0d15..d8ec1a3 100644
--- a/include/driver_interface.h
+++ b/include/driver_interface.h
@@ -1,21 +1,21 @@
/*
Copyright (C) 2003 Bob Ham <rah@bash.sh>
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
+ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ */
#ifndef __jack_driver_interface_h__
#define __jack_driver_interface_h__
@@ -33,82 +33,77 @@ extern "C" {
#define JACK_DRIVER_PARAM_NAME_MAX 15
#define JACK_DRIVER_PARAM_STRING_MAX 63
-#define JACK_CONSTRAINT_FLAG_RANGE ((uint32_t)1) /**< if set, constraint is a range (min-max) */
-#define JACK_CONSTRAINT_FLAG_STRICT ((uint32_t)2) /**< if set, constraint is strict, i.e. supplying non-matching value will not work */
-#define JACK_CONSTRAINT_FLAG_FAKE_VALUE ((uint32_t)4) /**< if set, values have no user meaningful meaning */
+#define JACK_CONSTRAINT_FLAG_RANGE ((uint32_t)1) /**< if set, constraint is a range (min-max) */
+#define JACK_CONSTRAINT_FLAG_STRICT ((uint32_t)2) /**< if set, constraint is strict, i.e. supplying non-matching value will not work */
+#define JACK_CONSTRAINT_FLAG_FAKE_VALUE ((uint32_t)4) /**< if set, values have no user meaningful meaning */
/** Driver parameter types */
-typedef enum
-{
- JackDriverParamInt = 1,
- JackDriverParamUInt,
- JackDriverParamChar,
- JackDriverParamString,
- JackDriverParamBool
+typedef enum {
+ JackDriverParamInt = 1,
+ JackDriverParamUInt,
+ JackDriverParamChar,
+ JackDriverParamString,
+ JackDriverParamBool
} jack_driver_param_type_t;
/** Driver parameter value */
-typedef union
-{
- uint32_t ui;
- int32_t i;
- char c;
- char str[JACK_DRIVER_PARAM_STRING_MAX+1];
+typedef union {
+ uint32_t ui;
+ int32_t i;
+ char c;
+ char str[JACK_DRIVER_PARAM_STRING_MAX + 1];
} jack_driver_param_value_t;
typedef struct {
- jack_driver_param_value_t value;
- char short_desc[64]; /**< A short (~30 chars) description for the user */
+ jack_driver_param_value_t value;
+ char short_desc[64]; /**< A short (~30 chars) description for the user */
} jack_driver_param_value_enum_t;
typedef struct {
- uint32_t flags; /**< JACK_CONSTRAINT_FLAG_XXX */
-
- union {
- struct {
- jack_driver_param_value_t min;
- jack_driver_param_value_t max;
- } range; /**< valid when JACK_CONSTRAINT_FLAG_RANGE flag is set */
-
- struct {
- uint32_t count;
- jack_driver_param_value_enum_t * possible_values_array;
- } enumeration; /**< valid when JACK_CONSTRAINT_FLAG_RANGE flag is not set */
- } constraint;
+ uint32_t flags; /**< JACK_CONSTRAINT_FLAG_XXX */
+
+ union {
+ struct {
+ jack_driver_param_value_t min;
+ jack_driver_param_value_t max;
+ } range; /**< valid when JACK_CONSTRAINT_FLAG_RANGE flag is set */
+
+ struct {
+ uint32_t count;
+ jack_driver_param_value_enum_t * possible_values_array;
+ } enumeration; /**< valid when JACK_CONSTRAINT_FLAG_RANGE flag is not set */
+ } constraint;
} jack_driver_param_constraint_desc_t;
/** A driver parameter descriptor */
-typedef struct
-{
- char name[JACK_DRIVER_NAME_MAX+1]; /**< The parameter's name */
- char character; /**< The parameter's character (for getopt, etc) */
- jack_driver_param_type_t type; /**< The parameter's type */
- jack_driver_param_value_t value; /**< The parameter's (default) value */
- jack_driver_param_constraint_desc_t * constraint; /**< Pointer to parameter constraint descriptor. NULL if there is no constraint */
- char short_desc[64]; /**< A short (~30 chars) description for the user */
- char long_desc[1024]; /**< A longer description for the user */
+typedef struct {
+ char name[JACK_DRIVER_NAME_MAX + 1]; /**< The parameter's name */
+ char character; /**< The parameter's character (for getopt, etc) */
+ jack_driver_param_type_t type; /**< The parameter's type */
+ jack_driver_param_value_t value; /**< The parameter's (default) value */
+ jack_driver_param_constraint_desc_t * constraint; /**< Pointer to parameter constraint descriptor. NULL if there is no constraint */
+ char short_desc[64]; /**< A short (~30 chars) description for the user */
+ char long_desc[1024]; /**< A longer description for the user */
} jack_driver_param_desc_t;
/** A driver parameter */
-typedef struct
-{
- char character;
- jack_driver_param_value_t value;
+typedef struct {
+ char character;
+ jack_driver_param_value_t value;
} jack_driver_param_t;
/** A struct for describing a jack driver */
-typedef struct
-{
- char name[JACK_DRIVER_NAME_MAX+1]; /**< The driver's canonical name */
- char file[PATH_MAX+1]; /**< The filename of the driver's shared object file */
- uint32_t nparams; /**< The number of parameters the driver has */
- jack_driver_param_desc_t * params; /**< An array of parameter descriptors */
-
+typedef struct {
+ char name[JACK_DRIVER_NAME_MAX + 1]; /**< The driver's canonical name */
+ char file[PATH_MAX + 1]; /**< The filename of the driver's shared object file */
+ uint32_t nparams; /**< The number of parameters the driver has */
+ jack_driver_param_desc_t * params; /**< An array of parameter descriptors */
+
} jack_driver_desc_t;
diff --git a/include/driver_parse.h b/include/driver_parse.h
index fe0cf56..8015140 100644
--- a/include/driver_parse.h
+++ b/include/driver_parse.h
@@ -1,22 +1,22 @@
/* -*- mode: c; c-file-style: "linux"; -*- */
/*
- Copyright (C) 2003 Bob Ham <rah@bash.sh
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ Copyright (C) 2003 Bob Ham <rah@bash.sh
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ */
#ifndef __jack_driver_parse_h__
#define __jack_driver_parse_h__
@@ -43,10 +43,11 @@ jack_print_driver_options (jack_driver_desc_t * desc, FILE *file)
break;
case JackDriverParamString:
if (desc->params[i].value.str &&
- strcmp (desc->params[i].value.str, "") != 0)
+ strcmp (desc->params[i].value.str, "") != 0) {
sprintf (arg_default, "%s", desc->params[i].value.str);
- else
+ } else {
sprintf (arg_default, "none");
+ }
break;
case JackDriverParamBool:
sprintf (arg_default, "%s", desc->params[i].value.i ? "true" : "false");
@@ -66,7 +67,7 @@ jack_print_driver_param_usage (jack_driver_desc_t * desc, unsigned long param, F
{
fprintf (file, "Usage information for the '%s' parameter for driver '%s':\n",
desc->params[param].name, desc->name);
-
+
fprintf (file, "%s\n", desc->params[param].long_desc);
}
@@ -108,14 +109,14 @@ jack_parse_driver_params (jack_driver_desc_t * desc, int argc, char **argv, JSLi
/* set up the stuff for getopt */
- options = calloc (desc->nparams*3 + 1, sizeof (char));
- long_options = calloc (desc->nparams + 1, sizeof (struct option));
+ options = calloc (desc->nparams * 3 + 1, sizeof(char));
+ long_options = calloc (desc->nparams + 1, sizeof(struct option));
options_ptr = options;
for (i = 0; i < desc->nparams; i++) {
sprintf (options_ptr, "%c::", desc->params[i].character);
options_ptr += 3;
-
+
long_options[i].name = desc->params[i].name;
long_options[i].flag = NULL;
long_options[i].val = desc->params[i].character;
@@ -125,7 +126,7 @@ jack_parse_driver_params (jack_driver_desc_t * desc, int argc, char **argv, JSLi
/* create the params */
optind = 0;
opterr = 0;
- while ((opt = getopt_long(argc, argv, options, long_options, NULL)) != -1) {
+ while ((opt = getopt_long (argc, argv, options, long_options, NULL)) != -1) {
if (opt == ':' || opt == '?') {
if (opt == ':') {
@@ -145,12 +146,12 @@ jack_parse_driver_params (jack_driver_desc_t * desc, int argc, char **argv, JSLi
}
}
- driver_param = calloc (1, sizeof (jack_driver_param_t));
+ driver_param = calloc (1, sizeof(jack_driver_param_t));
driver_param->character = desc->params[param_index].character;
if (!optarg && optind < argc &&
- strlen(argv[optind]) &&
+ strlen (argv[optind]) &&
argv[optind][0] != '-') {
optarg = argv[optind];
}
@@ -186,7 +187,7 @@ jack_parse_driver_params (jack_driver_desc_t * desc, int argc, char **argv, JSLi
}
break;
}
- } else {
+ } else {
if (desc->params[param_index].type == JackDriverParamBool) {
driver_param->value.i = TRUE;
} else {
@@ -200,8 +201,9 @@ jack_parse_driver_params (jack_driver_desc_t * desc, int argc, char **argv, JSLi
free (options);
free (long_options);
- if (param_ptr)
+ if (param_ptr) {
*param_ptr = params;
+ }
return 0;
}
diff --git a/include/engine.h b/include/engine.h
index 69772e5..5106713 100644
--- a/include/engine.h
+++ b/include/engine.h
@@ -1,7 +1,7 @@
/* -*- mode: c; c-file-style: "bsd"; -*- */
/*
Copyright (C) 2001-2003 Paul Davis
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ */
#ifndef __jack_engine_h__
#define __jack_engine_h__
@@ -30,30 +30,30 @@ struct _jack_client_internal;
struct _jack_port_internal;
/* Structures is allocated by the engine in local memory to keep track
- * of port buffers and connections.
+ * of port buffers and connections.
*/
typedef struct {
- jack_shm_info_t* shm_info;
- jack_shmsize_t offset;
+ jack_shm_info_t* shm_info;
+ jack_shmsize_t offset;
} jack_port_buffer_info_t;
/* The engine keeps an array of these in its local memory. */
typedef struct _jack_port_internal {
- struct _jack_port_shared *shared;
- JSList *connections;
- jack_port_buffer_info_t *buffer_info;
+ struct _jack_port_shared *shared;
+ JSList *connections;
+ jack_port_buffer_info_t *buffer_info;
} jack_port_internal_t;
/* The engine's internal port type structure. */
typedef struct _jack_port_buffer_list {
- pthread_mutex_t lock; /* only lock within server */
- JSList *freelist; /* list of free buffers */
- jack_port_buffer_info_t *info; /* jack_buffer_info_t array */
+ pthread_mutex_t lock; /* only lock within server */
+ JSList *freelist; /* list of free buffers */
+ jack_port_buffer_info_t *info; /* jack_buffer_info_t array */
} jack_port_buffer_list_t;
typedef struct _jack_reserved_name {
- jack_uuid_t uuid;
- char name[JACK_CLIENT_NAME_SIZE];
+ jack_uuid_t uuid;
+ char name[JACK_CLIENT_NAME_SIZE];
} jack_reserved_name_t;
#define JACKD_WATCHDOG_TIMEOUT 10000
@@ -61,167 +61,169 @@ typedef struct _jack_reserved_name {
/* The main engine structure in local memory. */
struct _jack_engine {
- jack_control_t *control;
-
- JSList *drivers;
- struct _jack_driver *driver;
- jack_driver_desc_t *driver_desc;
- JSList *driver_params;
-
- JSList *slave_drivers;
-
- /* these are "callbacks" made by the driver backend */
- int (*set_buffer_size) (struct _jack_engine *, jack_nframes_t frames);
- int (*set_sample_rate) (struct _jack_engine *, jack_nframes_t frames);
- int (*run_cycle) (struct _jack_engine *, jack_nframes_t nframes,
- float delayed_usecs);
- void (*delay) (struct _jack_engine *, float delayed_usecs);
- void (*transport_cycle_start) (struct _jack_engine *, jack_time_t time);
- void (*driver_exit) (struct _jack_engine *);
- jack_time_t (*get_microseconds)(void);
- /* "private" sections starts here */
-
- /* engine serialization -- use precedence for deadlock avoidance */
- pthread_mutex_t request_lock; /* precedes client_lock */
- pthread_rwlock_t client_lock;
- pthread_mutex_t port_lock;
- pthread_mutex_t problem_lock; /* must hold write lock on client_lock */
- int process_errors;
- int period_msecs;
-
- /* Time to wait for clients in msecs. Used when jackd is run
- * without realtime priority enabled. */
- int client_timeout_msecs;
-
- /* info on the shm segment containing this->control */
-
- jack_shm_info_t control_shm;
-
- /* address-space local port buffer and segment info,
- indexed by the port type_id
- */
- jack_port_buffer_list_t port_buffers[JACK_MAX_PORT_TYPES];
- jack_shm_info_t port_segment[JACK_MAX_PORT_TYPES];
-
- unsigned int port_max;
- pthread_t server_thread;
-
- int fds[2];
- int cleanup_fifo[2];
- size_t pfd_size;
- size_t pfd_max;
- struct pollfd *pfd;
- char fifo_prefix[PATH_MAX+1];
- int *fifo;
- unsigned long fifo_size;
-
- /* session handling */
- int session_reply_fd;
- int session_pending_replies;
-
- unsigned long external_client_cnt;
- int rtpriority;
- volatile char freewheeling;
- volatile char stop_freewheeling;
- jack_uuid_t fwclient;
- pthread_t freewheel_thread;
- char verbose;
- char do_munlock;
- const char *server_name;
- char temporary;
- int reordered;
- int feedbackcount;
- int removing_clients;
- pid_t wait_pid;
- int nozombies;
- int timeout_count_threshold;
- volatile int problems;
- volatile int timeout_count;
- volatile int new_clients_allowed;
-
- /* these lists are protected by `client_lock' */
- JSList *clients;
- JSList *clients_waiting;
- JSList *reserved_client_names;
-
- jack_port_internal_t *internal_ports;
- jack_client_internal_t *timebase_client;
- jack_port_buffer_info_t *silent_buffer;
- jack_client_internal_t *current_client;
+ jack_control_t *control;
+
+ JSList *drivers;
+ struct _jack_driver *driver;
+ jack_driver_desc_t *driver_desc;
+ JSList *driver_params;
+
+ JSList *slave_drivers;
+
+ /* these are "callbacks" made by the driver backend */
+ int (*set_buffer_size)(struct _jack_engine *, jack_nframes_t frames);
+ int (*set_sample_rate)(struct _jack_engine *, jack_nframes_t frames);
+ int (*run_cycle)(struct _jack_engine *, jack_nframes_t nframes,
+ float delayed_usecs);
+ void (*delay)(struct _jack_engine *, float delayed_usecs);
+ void (*transport_cycle_start)(struct _jack_engine *, jack_time_t time);
+ void (*driver_exit)(struct _jack_engine *);
+ jack_time_t (*get_microseconds)(void);
+ /* "private" sections starts here */
+
+ /* engine serialization -- use precedence for deadlock avoidance */
+ pthread_mutex_t request_lock; /* precedes client_lock */
+ pthread_rwlock_t client_lock;
+ pthread_mutex_t port_lock;
+ pthread_mutex_t problem_lock; /* must hold write lock on client_lock */
+ int process_errors;
+ int period_msecs;
+
+ /* Time to wait for clients in msecs. Used when jackd is run
+ * without realtime priority enabled. */
+ int client_timeout_msecs;
+
+ /* info on the shm segment containing this->control */
+
+ jack_shm_info_t control_shm;
+
+ /* address-space local port buffer and segment info,
+ indexed by the port type_id
+ */
+ jack_port_buffer_list_t port_buffers[JACK_MAX_PORT_TYPES];
+ jack_shm_info_t port_segment[JACK_MAX_PORT_TYPES];
+
+ unsigned int port_max;
+ pthread_t server_thread;
+
+ int fds[2];
+ int cleanup_fifo[2];
+ size_t pfd_size;
+ size_t pfd_max;
+ struct pollfd *pfd;
+ char fifo_prefix[PATH_MAX + 1];
+ int *fifo;
+ unsigned long fifo_size;
+
+ /* session handling */
+ int session_reply_fd;
+ int session_pending_replies;
+
+ unsigned long external_client_cnt;
+ int rtpriority;
+ volatile char freewheeling;
+ volatile char stop_freewheeling;
+ jack_uuid_t fwclient;
+ pthread_t freewheel_thread;
+ char verbose;
+ char do_munlock;
+ const char *server_name;
+ char temporary;
+ int reordered;
+ int feedbackcount;
+ int removing_clients;
+ pid_t wait_pid;
+ int nozombies;
+ int timeout_count_threshold;
+ volatile int problems;
+ volatile int timeout_count;
+ volatile int new_clients_allowed;
+
+ /* these lists are protected by `client_lock' */
+ JSList *clients;
+ JSList *clients_waiting;
+ JSList *reserved_client_names;
+
+ jack_port_internal_t *internal_ports;
+ jack_client_internal_t *timebase_client;
+ jack_port_buffer_info_t *silent_buffer;
+ jack_client_internal_t *current_client;
#define JACK_ENGINE_ROLLING_COUNT 32
#define JACK_ENGINE_ROLLING_INTERVAL 1024
- jack_time_t rolling_client_usecs[JACK_ENGINE_ROLLING_COUNT];
- int rolling_client_usecs_cnt;
- int rolling_client_usecs_index;
- int rolling_interval;
- float max_usecs;
- float spare_usecs;
+ jack_time_t rolling_client_usecs[JACK_ENGINE_ROLLING_COUNT];
+ int rolling_client_usecs_cnt;
+ int rolling_client_usecs_index;
+ int rolling_interval;
+ float max_usecs;
+ float spare_usecs;
+
+ int first_wakeup;
- int first_wakeup;
-
#ifdef JACK_USE_MACH_THREADS
- /* specific resources for server/client real-time thread communication */
- mach_port_t servertask, bp;
- int portnum;
+ /* specific resources for server/client real-time thread communication */
+ mach_port_t servertask, bp;
+ int portnum;
#endif
- /* used for port names munging */
- int audio_out_cnt;
- int audio_in_cnt;
- int midi_out_cnt;
- int midi_in_cnt;
+ /* used for port names munging */
+ int audio_out_cnt;
+ int audio_in_cnt;
+ int midi_out_cnt;
+ int midi_in_cnt;
};
/* public functions */
-jack_engine_t *jack_engine_new (int real_time, int real_time_priority,
- int do_mlock, int do_unlock,
- const char *server_name, int temporary,
- int verbose, int client_timeout,
- unsigned int port_max,
- pid_t waitpid, jack_nframes_t frame_time_offset, int nozombies,
- int timeout_count_threshold,
- JSList *drivers);
-void jack_engine_delete (jack_engine_t *);
-int jack_run (jack_engine_t *engine);
-int jack_wait (jack_engine_t *engine);
-int jack_engine_load_driver (jack_engine_t *engine,
- jack_driver_desc_t * driver_desc,
- JSList * driver_params);
-int jack_engine_load_slave_driver (jack_engine_t *engine,
- jack_driver_desc_t * driver_desc,
- JSList * driver_params);
-void jack_dump_configuration(jack_engine_t *engine, int take_lock);
+jack_engine_t *jack_engine_new(int real_time, int real_time_priority,
+ int do_mlock, int do_unlock,
+ const char *server_name, int temporary,
+ int verbose, int client_timeout,
+ unsigned int port_max,
+ pid_t waitpid, jack_nframes_t frame_time_offset, int nozombies,
+ int timeout_count_threshold,
+ JSList *drivers);
+void jack_engine_delete(jack_engine_t *);
+int jack_run(jack_engine_t *engine);
+int jack_wait(jack_engine_t *engine);
+int jack_engine_load_driver(jack_engine_t *engine,
+ jack_driver_desc_t * driver_desc,
+ JSList * driver_params);
+int jack_engine_load_slave_driver(jack_engine_t *engine,
+ jack_driver_desc_t * driver_desc,
+ JSList * driver_params);
+void jack_dump_configuration(jack_engine_t *engine, int take_lock);
/* private engine functions */
-void jack_engine_reset_rolling_usecs (jack_engine_t *engine);
-int internal_client_request (void* ptr, jack_request_t *request);
-int jack_get_fifo_fd (jack_engine_t *engine,
- unsigned int which_fifo);
+void jack_engine_reset_rolling_usecs(jack_engine_t *engine);
+int internal_client_request(void* ptr, jack_request_t *request);
+int jack_get_fifo_fd(jack_engine_t *engine,
+ unsigned int which_fifo);
extern jack_timer_type_t clock_source;
extern jack_client_internal_t *
-jack_client_internal_by_id (jack_engine_t *engine, jack_uuid_t id);
+jack_client_internal_by_id(jack_engine_t *engine, jack_uuid_t id);
-#define jack_rdlock_graph(e) { DEBUG ("acquiring graph read lock"); if (pthread_rwlock_rdlock (&e->client_lock)) abort(); }
-#define jack_lock_graph(e) { DEBUG ("acquiring graph write lock"); if (pthread_rwlock_wrlock (&e->client_lock)) abort(); }
+#define jack_rdlock_graph(e) { DEBUG ("acquiring graph read lock"); if (pthread_rwlock_rdlock (&e->client_lock)) { abort (); } }
+#define jack_lock_graph(e) { DEBUG ("acquiring graph write lock"); if (pthread_rwlock_wrlock (&e->client_lock)) { abort (); } }
#define jack_try_rdlock_graph(e) pthread_rwlock_tryrdlock (&e->client_lock)
-#define jack_unlock_graph(e) { DEBUG ("release graph lock"); if (pthread_rwlock_unlock (&e->client_lock)) abort(); }
+#define jack_unlock_graph(e) { DEBUG ("release graph lock"); if (pthread_rwlock_unlock (&e->client_lock)) { abort (); } }
#define jack_trylock_problems(e) pthread_mutex_trylock (&e->problem_lock)
-#define jack_lock_problems(e) { DEBUG ("acquiring problem lock"); if (pthread_mutex_lock (&e->problem_lock)) abort(); }
-#define jack_unlock_problems(e) { DEBUG ("release problem lock"); if (pthread_mutex_unlock (&e->problem_lock)) abort(); }
+#define jack_lock_problems(e) { DEBUG ("acquiring problem lock"); if (pthread_mutex_lock (&e->problem_lock)) { abort (); } }
+#define jack_unlock_problems(e) { DEBUG ("release problem lock"); if (pthread_mutex_unlock (&e->problem_lock)) { abort (); } }
#if 0
-static inline void jack_rdlock_graph (jack_engine_t* engine) {
+static inline void jack_rdlock_graph (jack_engine_t* engine)
+{
DEBUG ("acquiring graph read lock");
pthread_rwlock_rdlock (&engine->client_lock);
}
-static inline void jack_lock_graph (jack_engine_t* engine) {
+static inline void jack_lock_graph (jack_engine_t* engine)
+{
DEBUG ("acquiring graph lock");
pthread_rwlock_wrlock (&engine->client_lock);
}
@@ -232,7 +234,7 @@ static inline int jack_try_rdlock_graph (jack_engine_t *engine)
return pthread_rwlock_tryrdlock (&engine->client_lock);
}
-static inline void jack_unlock_graph (jack_engine_t* engine)
+static inline void jack_unlock_graph (jack_engine_t* engine)
{
DEBUG ("releasing graph lock");
pthread_rwlock_unlock (&engine->client_lock);
@@ -245,24 +247,24 @@ static inline unsigned int jack_power_of_two (unsigned int n)
}
/* Internal port handling interfaces for JACK engine. */
-void jack_port_clear_connections (jack_engine_t *engine,
- jack_port_internal_t *port);
-void jack_port_registration_notify (jack_engine_t *, jack_port_id_t, int);
-void jack_port_release (jack_engine_t *engine, jack_port_internal_t *);
-void jack_sort_graph (jack_engine_t *engine);
-int jack_stop_freewheeling (jack_engine_t* engine, int engine_exiting);
+void jack_port_clear_connections(jack_engine_t *engine,
+ jack_port_internal_t *port);
+void jack_port_registration_notify (jack_engine_t *, jack_port_id_t, int);
+void jack_port_release(jack_engine_t *engine, jack_port_internal_t *);
+void jack_sort_graph(jack_engine_t *engine);
+int jack_stop_freewheeling(jack_engine_t* engine, int engine_exiting);
jack_client_internal_t *
-jack_client_by_name (jack_engine_t *engine, const char *name);
+jack_client_by_name(jack_engine_t *engine, const char *name);
-int jack_deliver_event (jack_engine_t *, jack_client_internal_t *, const jack_event_t *, ...);
+int jack_deliver_event(jack_engine_t *, jack_client_internal_t *, const jack_event_t *, ...);
void
-jack_engine_signal_problems (jack_engine_t* engine);
+jack_engine_signal_problems(jack_engine_t* engine);
int
-jack_use_driver (jack_engine_t *engine, struct _jack_driver *driver);
+jack_use_driver(jack_engine_t *engine, struct _jack_driver *driver);
int
-jack_drivers_start (jack_engine_t *engine);
+jack_drivers_start(jack_engine_t *engine);
int
-jack_add_slave_driver (jack_engine_t *engine, struct _jack_driver *driver);
+jack_add_slave_driver(jack_engine_t *engine, struct _jack_driver *driver);
#endif /* __jack_engine_h__ */
diff --git a/include/hardware.h b/include/hardware.h
index 01aefca..3064d9e 100644
--- a/include/hardware.h
+++ b/include/hardware.h
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001 Paul Davis
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -15,14 +15,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ */
#ifndef __jack_hardware_h__
#define __jack_hardware_h__
#include <jack/types.h>
-typedef enum {
+typedef enum {
AutoSync,
WordClock,
ClockMaster
@@ -48,18 +48,18 @@ typedef double (*JackHardwareGetHardwarePower)(jack_port_t *port, jack_nframes_t
typedef struct _jack_hardware {
- unsigned long capabilities;
- unsigned long input_monitor_mask;
+ unsigned long capabilities;
+ unsigned long input_monitor_mask;
- JackHardwareChangeSampleClockFunction change_sample_clock;
- JackHardwareSetInputMonitorMaskFunction set_input_monitor_mask;
- JackHardwareReleaseFunction release;
- JackHardwareGetHardwarePeak get_hardware_peak;
- JackHardwareGetHardwarePower get_hardware_power;
- void *private;
+ JackHardwareChangeSampleClockFunction change_sample_clock;
+ JackHardwareSetInputMonitorMaskFunction set_input_monitor_mask;
+ JackHardwareReleaseFunction release;
+ JackHardwareGetHardwarePeak get_hardware_peak;
+ JackHardwareGetHardwarePower get_hardware_power;
+ void *private;
} jack_hardware_t;
-jack_hardware_t * jack_hardware_new ();
+jack_hardware_t * jack_hardware_new();
#endif /* __jack_hardware_h__ */
diff --git a/include/internal.h b/include/internal.h
index 036d703..ed2202d 100644
--- a/include/internal.h
+++ b/include/internal.h
@@ -6,7 +6,7 @@
JACK_PROTOCOL_VERSION in configure.in.
Copyright (C) 2001-2003 Paul Davis
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -21,7 +21,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ */
#ifndef __jack_internal_h__
#define __jack_internal_h__
@@ -35,9 +35,9 @@
#include <sys/time.h>
/* Needed by <sysdeps/time.h> */
-extern void jack_error (const char *fmt, ...);
+extern void jack_error(const char *fmt, ...);
-extern void jack_info (const char *fmt, ...);
+extern void jack_info(const char *fmt, ...);
#include <jack/jack.h>
#include <jack/types.h>
@@ -55,8 +55,8 @@ typedef enum {
JACK_TIMER_HPET,
} jack_timer_type_t;
-void jack_init_time ();
-void jack_set_clock_source (jack_timer_type_t);
+void jack_init_time();
+void jack_set_clock_source (jack_timer_type_t);
const char* jack_clock_source_name (jack_timer_type_t);
#include <sysdeps/time.h>
@@ -73,31 +73,31 @@ const char* jack_clock_source_name (jack_timer_type_t);
#define PATH_MAX MAXPATHLEN
#else
#define PATH_MAX 1024
- #endif /* MAXPATHLEN */
-#endif /* !PATH_MAX */
+ #endif /* MAXPATHLEN */
+#endif /* !PATH_MAX */
#ifdef DEBUG_ENABLED
/* grab thread id instead of PID on linux */
#if defined(__gnu_linux__)
#ifdef gettid /* glibc has a version */
- #define GETTID() gettid()
+ #define GETTID() gettid ()
#else /* use our own version */
- #include <sys/syscall.h>
- #define GETTID() syscall(__NR_gettid)
+ #include <sys/syscall.h>
+ #define GETTID() syscall (__NR_gettid)
#endif
#else
- #define GETTID() getpid()
+ #define GETTID() getpid ()
#endif
-#define DEBUG(format,args...) \
- MESSAGE("jack:%5d:%" PRIu64 " %s:%s:%d: " format "", GETTID(), jack_get_microseconds(), __FILE__, __FUNCTION__, __LINE__ , ## args)
+#define DEBUG(format, args ...) \
+ MESSAGE ("jack:%5d:%" PRIu64 " %s:%s:%d: " format "", GETTID (), jack_get_microseconds (), __FILE__, __FUNCTION__, __LINE__, ## args)
#else
#if JACK_CPP_VARARGS_BROKEN
- #define DEBUG(format...)
+ #define DEBUG(format ...)
#else
- #define DEBUG(format,args...)
+ #define DEBUG(format, args ...)
#endif
#endif
@@ -109,129 +109,129 @@ const char* jack_clock_source_name (jack_timer_type_t);
* sends SIGUSR2 to the client.
*/
#ifdef DO_PREEMPTION_CHECKING
-#define CHECK_PREEMPTION(engine, onoff) \
+#define CHECK_PREEMPTION(engine, onoff) \
if ((engine)->real_time) gettimeofday (1, (onoff))
#else
#define CHECK_PREEMPTION(engine, onoff)
#endif
-#ifndef FALSE
-#define FALSE (0)
+#ifndef FALSE
+#define FALSE (0)
#endif
-#ifndef TRUE
-#define TRUE (1)
+#ifndef TRUE
+#define TRUE (1)
#endif
-typedef struct _jack_engine jack_engine_t;
+typedef struct _jack_engine jack_engine_t;
typedef struct _jack_request jack_request_t;
typedef void * dlhandle;
typedef enum {
- TransportCommandNone = 0,
- TransportCommandStart = 1,
- TransportCommandStop = 2,
+ TransportCommandNone = 0,
+ TransportCommandStart = 1,
+ TransportCommandStop = 2,
} transport_command_t;
typedef struct {
- volatile uint32_t guard1;
- volatile jack_nframes_t frames;
- volatile jack_time_t current_wakeup;
- volatile jack_time_t next_wakeup;
- volatile float period_usecs;
- volatile int32_t initialized;
- volatile uint32_t guard2;
-
+ volatile uint32_t guard1;
+ volatile jack_nframes_t frames;
+ volatile jack_time_t current_wakeup;
+ volatile jack_time_t next_wakeup;
+ volatile float period_usecs;
+ volatile int32_t initialized;
+ volatile uint32_t guard2;
+
/* not accessed by clients */
- int32_t reset_pending; /* xrun happened, deal with it */
- float filter_omega; /* set once, never altered */
+ int32_t reset_pending; /* xrun happened, deal with it */
+ float filter_omega; /* set once, never altered */
} POST_PACKED_STRUCTURE jack_frame_timer_t;
/* JACK engine shared memory data structure. */
typedef struct {
- jack_transport_state_t transport_state;
- volatile transport_command_t transport_cmd;
- transport_command_t previous_cmd; /* previous transport_cmd */
- jack_position_t current_time; /* position for current cycle */
- jack_position_t pending_time; /* position for next cycle */
- jack_position_t request_time; /* latest requested position */
- jack_unique_t prev_request; /* previous request unique ID */
- volatile _Atomic_word seq_number; /* unique ID sequence number */
- int8_t new_pos; /* new position this cycle */
- int8_t pending_pos; /* new position request pending */
- jack_nframes_t pending_frame; /* pending frame number */
- int32_t sync_clients; /* number of active_slowsync clients */
- int32_t sync_remain; /* number of them with sync_poll */
- jack_time_t sync_timeout;
- jack_time_t sync_time_left;
- jack_frame_timer_t frame_timer;
- int32_t internal;
- jack_timer_type_t clock_source;
- pid_t engine_pid;
- jack_nframes_t buffer_size;
- int8_t real_time;
- int8_t do_mlock;
- int8_t do_munlock;
- int32_t client_priority;
- int32_t max_client_priority;
- int32_t has_capabilities;
- float cpu_load;
- float xrun_delayed_usecs;
- float max_delayed_usecs;
- uint32_t port_max;
- int32_t engine_ok;
- jack_port_type_id_t n_port_types;
- jack_port_type_info_t port_types[JACK_MAX_PORT_TYPES];
- jack_port_shared_t ports[0];
+ jack_transport_state_t transport_state;
+ volatile transport_command_t transport_cmd;
+ transport_command_t previous_cmd; /* previous transport_cmd */
+ jack_position_t current_time; /* position for current cycle */
+ jack_position_t pending_time; /* position for next cycle */
+ jack_position_t request_time; /* latest requested position */
+ jack_unique_t prev_request; /* previous request unique ID */
+ volatile _Atomic_word seq_number; /* unique ID sequence number */
+ int8_t new_pos; /* new position this cycle */
+ int8_t pending_pos; /* new position request pending */
+ jack_nframes_t pending_frame; /* pending frame number */
+ int32_t sync_clients; /* number of active_slowsync clients */
+ int32_t sync_remain; /* number of them with sync_poll */
+ jack_time_t sync_timeout;
+ jack_time_t sync_time_left;
+ jack_frame_timer_t frame_timer;
+ int32_t internal;
+ jack_timer_type_t clock_source;
+ pid_t engine_pid;
+ jack_nframes_t buffer_size;
+ int8_t real_time;
+ int8_t do_mlock;
+ int8_t do_munlock;
+ int32_t client_priority;
+ int32_t max_client_priority;
+ int32_t has_capabilities;
+ float cpu_load;
+ float xrun_delayed_usecs;
+ float max_delayed_usecs;
+ uint32_t port_max;
+ int32_t engine_ok;
+ jack_port_type_id_t n_port_types;
+ jack_port_type_info_t port_types[JACK_MAX_PORT_TYPES];
+ jack_port_shared_t ports[0];
} POST_PACKED_STRUCTURE jack_control_t;
typedef enum {
- BufferSizeChange,
- SampleRateChange,
- AttachPortSegment,
- PortConnected,
- PortDisconnected,
- GraphReordered,
- PortRegistered,
- PortUnregistered,
- XRun,
- StartFreewheel,
- StopFreewheel,
- ClientRegistered,
- ClientUnregistered,
- SaveSession,
- LatencyCallback,
- PropertyChange,
- PortRename
+ BufferSizeChange,
+ SampleRateChange,
+ AttachPortSegment,
+ PortConnected,
+ PortDisconnected,
+ GraphReordered,
+ PortRegistered,
+ PortUnregistered,
+ XRun,
+ StartFreewheel,
+ StopFreewheel,
+ ClientRegistered,
+ ClientUnregistered,
+ SaveSession,
+ LatencyCallback,
+ PropertyChange,
+ PortRename
} JackEventType;
const char* jack_event_type_name (JackEventType);
typedef struct {
- JackEventType type;
- union {
- uint32_t n;
- char name[JACK_PORT_NAME_SIZE];
- jack_port_id_t port_id;
- jack_port_id_t self_id;
- jack_uuid_t uuid;
- } x;
- union {
- uint32_t n;
- jack_port_type_id_t ptid;
- jack_port_id_t other_id;
- uint32_t key_size; /* key data will follow the event structure */
- } y;
- union {
- char other_name[JACK_PORT_NAME_SIZE];
- jack_property_change_t property_change;
- } z;
+ JackEventType type;
+ union {
+ uint32_t n;
+ char name[JACK_PORT_NAME_SIZE];
+ jack_port_id_t port_id;
+ jack_port_id_t self_id;
+ jack_uuid_t uuid;
+ } x;
+ union {
+ uint32_t n;
+ jack_port_type_id_t ptid;
+ jack_port_id_t other_id;
+ uint32_t key_size; /* key data will follow the event structure */
+ } y;
+ union {
+ char other_name[JACK_PORT_NAME_SIZE];
+ jack_property_change_t property_change;
+ } z;
} POST_PACKED_STRUCTURE jack_event_t;
typedef enum {
@@ -250,112 +250,112 @@ typedef enum {
/* JACK client shared memory data structure. */
typedef volatile struct {
- jack_uuid_t uuid; /* w: engine r: engine and client */
- volatile jack_client_state_t state; /* w: engine and client r: engine */
- volatile char name[JACK_CLIENT_NAME_SIZE];
- volatile char session_command[JACK_PORT_NAME_SIZE];
- volatile jack_session_flags_t session_flags;
- volatile ClientType type; /* w: engine r: engine and client */
- volatile int8_t active; /* w: engine r: engine and client */
- volatile int8_t dead; /* r/w: engine */
- volatile int8_t timed_out; /* r/w: engine */
- volatile int8_t is_timebase; /* w: engine, r: engine and client */
- volatile int8_t timebase_new; /* w: engine and client, r: engine */
- volatile int8_t is_slowsync; /* w: engine, r: engine and client */
- volatile int8_t active_slowsync; /* w: engine, r: engine and client */
- volatile int8_t sync_poll; /* w: engine and client, r: engine */
- volatile int8_t sync_new; /* w: engine and client, r: engine */
- volatile pid_t pid; /* w: client r: engine; client pid */
- volatile pid_t pgrp; /* w: client r: engine; client pgrp */
- volatile uint64_t signalled_at;
- volatile uint64_t awake_at;
- volatile uint64_t finished_at;
- volatile int32_t last_status; /* w: client, r: engine and client */
-
- /* indicators for whether callbacks have been set for this client.
- We do not include ptrs to the callbacks here (or their arguments)
- so that we can avoid 32/64 bit pointer size mismatches between
- the jack server and a client. The pointers are in the client-
- local structure which is part of the libjack compiled for
- either 32 bit or 64 bit clients.
- */
- volatile uint8_t process_cbset;
- volatile uint8_t thread_init_cbset;
- volatile uint8_t bufsize_cbset;
- volatile uint8_t srate_cbset;
- volatile uint8_t port_register_cbset;
- volatile uint8_t port_connect_cbset;
- volatile uint8_t graph_order_cbset;
- volatile uint8_t xrun_cbset;
- volatile uint8_t sync_cb_cbset;
- volatile uint8_t timebase_cb_cbset;
- volatile uint8_t freewheel_cb_cbset;
- volatile uint8_t client_register_cbset;
- volatile uint8_t thread_cb_cbset;
- volatile uint8_t session_cbset;
- volatile uint8_t latency_cbset;
- volatile uint8_t property_cbset;
- volatile uint8_t port_rename_cbset;
+ jack_uuid_t uuid; /* w: engine r: engine and client */
+ volatile jack_client_state_t state; /* w: engine and client r: engine */
+ volatile char name[JACK_CLIENT_NAME_SIZE];
+ volatile char session_command[JACK_PORT_NAME_SIZE];
+ volatile jack_session_flags_t session_flags;
+ volatile ClientType type; /* w: engine r: engine and client */
+ volatile int8_t active; /* w: engine r: engine and client */
+ volatile int8_t dead; /* r/w: engine */
+ volatile int8_t timed_out; /* r/w: engine */
+ volatile int8_t is_timebase; /* w: engine, r: engine and client */
+ volatile int8_t timebase_new; /* w: engine and client, r: engine */
+ volatile int8_t is_slowsync; /* w: engine, r: engine and client */
+ volatile int8_t active_slowsync; /* w: engine, r: engine and client */
+ volatile int8_t sync_poll; /* w: engine and client, r: engine */
+ volatile int8_t sync_new; /* w: engine and client, r: engine */
+ volatile pid_t pid; /* w: client r: engine; client pid */
+ volatile pid_t pgrp; /* w: client r: engine; client pgrp */
+ volatile uint64_t signalled_at;
+ volatile uint64_t awake_at;
+ volatile uint64_t finished_at;
+ volatile int32_t last_status; /* w: client, r: engine and client */
+
+ /* indicators for whether callbacks have been set for this client.
+ We do not include ptrs to the callbacks here (or their arguments)
+ so that we can avoid 32/64 bit pointer size mismatches between
+ the jack server and a client. The pointers are in the client-
+ local structure which is part of the libjack compiled for
+ either 32 bit or 64 bit clients.
+ */
+ volatile uint8_t process_cbset;
+ volatile uint8_t thread_init_cbset;
+ volatile uint8_t bufsize_cbset;
+ volatile uint8_t srate_cbset;
+ volatile uint8_t port_register_cbset;
+ volatile uint8_t port_connect_cbset;
+ volatile uint8_t graph_order_cbset;
+ volatile uint8_t xrun_cbset;
+ volatile uint8_t sync_cb_cbset;
+ volatile uint8_t timebase_cb_cbset;
+ volatile uint8_t freewheel_cb_cbset;
+ volatile uint8_t client_register_cbset;
+ volatile uint8_t thread_cb_cbset;
+ volatile uint8_t session_cbset;
+ volatile uint8_t latency_cbset;
+ volatile uint8_t property_cbset;
+ volatile uint8_t port_rename_cbset;
} POST_PACKED_STRUCTURE jack_client_control_t;
typedef struct {
-
- uint32_t protocol_v; /* protocol version, must go first */
- int32_t load;
- ClientType type;
- jack_options_t options;
- jack_uuid_t uuid;
- char name[JACK_CLIENT_NAME_SIZE];
- char object_path[PATH_MAX+1];
- char object_data[1024];
+ uint32_t protocol_v; /* protocol version, must go first */
+ int32_t load;
+ ClientType type;
+ jack_options_t options;
+ jack_uuid_t uuid;
+
+ char name[JACK_CLIENT_NAME_SIZE];
+ char object_path[PATH_MAX + 1];
+ char object_data[1024];
} POST_PACKED_STRUCTURE jack_client_connect_request_t;
typedef struct {
- jack_status_t status;
+ jack_status_t status;
- jack_shm_registry_index_t client_shm_index;
- jack_shm_registry_index_t engine_shm_index;
+ jack_shm_registry_index_t client_shm_index;
+ jack_shm_registry_index_t engine_shm_index;
- char fifo_prefix[PATH_MAX+1];
+ char fifo_prefix[PATH_MAX + 1];
- int32_t realtime;
- int32_t realtime_priority;
+ int32_t realtime;
+ int32_t realtime_priority;
- char name[JACK_CLIENT_NAME_SIZE]; /* unique name, if assigned */
+ char name[JACK_CLIENT_NAME_SIZE]; /* unique name, if assigned */
- /* these are actually pointers, but they must
- be the same size regardless of whether the
- server and/or client are 64 bit or 32 bit.
- force them to be 64 bit.
- */
+ /* these are actually pointers, but they must
+ be the same size regardless of whether the
+ server and/or client are 64 bit or 32 bit.
+ force them to be 64 bit.
+ */
- uint64_t client_control;
- uint64_t engine_control;
+ uint64_t client_control;
+ uint64_t engine_control;
#ifdef JACK_USE_MACH_THREADS
- /* specific resources for server/client real-time thread communication */
- int32_t portnum;
+ /* specific resources for server/client real-time thread communication */
+ int32_t portnum;
#endif
} POST_PACKED_STRUCTURE jack_client_connect_result_t;
typedef struct {
- jack_uuid_t client_id;
+ jack_uuid_t client_id;
} POST_PACKED_STRUCTURE jack_client_connect_ack_request_t;
typedef struct {
- int8_t status;
+ int8_t status;
} POST_PACKED_STRUCTURE jack_client_connect_ack_result_t;
typedef enum {
RegisterPort = 1,
UnRegisterPort = 2,
ConnectPorts = 3,
- DisconnectPorts = 4,
+ DisconnectPorts = 4,
SetTimeBaseClient = 5,
ActivateClient = 6,
DeactivateClient = 7,
@@ -387,69 +387,69 @@ typedef enum {
} RequestType;
struct _jack_request {
-
- //RequestType type;
- uint32_t type;
- union {
- struct {
- char name[JACK_PORT_NAME_SIZE];
- char type[JACK_PORT_TYPE_SIZE];
- uint32_t flags;
- jack_shmsize_t buffer_size;
- jack_port_id_t port_id;
- jack_uuid_t client_id;
- } POST_PACKED_STRUCTURE port_info;
- struct {
- char source_port[JACK_PORT_NAME_SIZE];
- char destination_port[JACK_PORT_NAME_SIZE];
- } POST_PACKED_STRUCTURE connect;
- struct {
- char path[JACK_PORT_NAME_SIZE];
- jack_session_event_type_t type;
- char target[JACK_CLIENT_NAME_SIZE];
- } POST_PACKED_STRUCTURE session;
- struct {
- int32_t nports;
- const char **ports; /* this is only exposed to internal clients, so there
- is no 64/32 issue. external clients read the ports
- one by one from the server, and allocate their
- own "ports" array in their own address space.
-
- we are lucky, because this is part of a union
- whose other components are bigger than this one.
- otherwise it would change structure size when
- comparing the 64 and 32 bit versions.
- */
- } POST_PACKED_STRUCTURE port_connections;
- struct {
- jack_uuid_t client_id;
- int32_t conditional;
- } POST_PACKED_STRUCTURE timebase;
- struct {
- char name[JACK_CLIENT_NAME_SIZE];
- jack_uuid_t uuid;
- } POST_PACKED_STRUCTURE reservename;
- struct {
- //jack_options_t options;
- uint32_t options;
- jack_uuid_t uuid;
- char name[JACK_CLIENT_NAME_SIZE];
- char path[PATH_MAX+1];
- char init[JACK_LOAD_INIT_LIMIT];
- } POST_PACKED_STRUCTURE intclient;
- struct {
- jack_property_change_t change;
- jack_uuid_t uuid;
- size_t keylen;
- const char* key; /* not delivered inline to server, see oop_client_deliver_request() */
- } POST_PACKED_STRUCTURE property;
- jack_uuid_t client_id;
- jack_nframes_t nframes;
- jack_time_t timeout;
- pid_t cap_pid;
- char name[JACK_CLIENT_NAME_SIZE];
- } POST_PACKED_STRUCTURE x;
- int32_t status;
+
+ //RequestType type;
+ uint32_t type;
+ union {
+ struct {
+ char name[JACK_PORT_NAME_SIZE];
+ char type[JACK_PORT_TYPE_SIZE];
+ uint32_t flags;
+ jack_shmsize_t buffer_size;
+ jack_port_id_t port_id;
+ jack_uuid_t client_id;
+ } POST_PACKED_STRUCTURE port_info;
+ struct {
+ char source_port[JACK_PORT_NAME_SIZE];
+ char destination_port[JACK_PORT_NAME_SIZE];
+ } POST_PACKED_STRUCTURE connect;
+ struct {
+ char path[JACK_PORT_NAME_SIZE];
+ jack_session_event_type_t type;
+ char target[JACK_CLIENT_NAME_SIZE];
+ } POST_PACKED_STRUCTURE session;
+ struct {
+ int32_t nports;
+ const char **ports; /* this is only exposed to internal clients, so there
+ is no 64/32 issue. external clients read the ports
+ one by one from the server, and allocate their
+ own "ports" array in their own address space.
+
+ we are lucky, because this is part of a union
+ whose other components are bigger than this one.
+ otherwise it would change structure size when
+ comparing the 64 and 32 bit versions.
+ */
+ } POST_PACKED_STRUCTURE port_connections;
+ struct {
+ jack_uuid_t client_id;
+ int32_t conditional;
+ } POST_PACKED_STRUCTURE timebase;
+ struct {
+ char name[JACK_CLIENT_NAME_SIZE];
+ jack_uuid_t uuid;
+ } POST_PACKED_STRUCTURE reservename;
+ struct {
+ //jack_options_t options;
+ uint32_t options;
+ jack_uuid_t uuid;
+ char name[JACK_CLIENT_NAME_SIZE];
+ char path[PATH_MAX + 1];
+ char init[JACK_LOAD_INIT_LIMIT];
+ } POST_PACKED_STRUCTURE intclient;
+ struct {
+ jack_property_change_t change;
+ jack_uuid_t uuid;
+ size_t keylen;
+ const char* key; /* not delivered inline to server, see oop_client_deliver_request() */
+ } POST_PACKED_STRUCTURE property;
+ jack_uuid_t client_id;
+ jack_nframes_t nframes;
+ jack_time_t timeout;
+ pid_t cap_pid;
+ char name[JACK_CLIENT_NAME_SIZE];
+ } POST_PACKED_STRUCTURE x;
+ int32_t status;
} POST_PACKED_STRUCTURE;
/* Per-client structure allocated in the server's address space.
@@ -458,36 +458,36 @@ struct _jack_request {
typedef struct _jack_client_internal {
- jack_client_control_t *control;
-
- int request_fd;
- int event_fd;
- int subgraph_start_fd;
- int subgraph_wait_fd;
- JSList *ports; /* protected by engine->client_lock */
- JSList *truefeeds; /* protected by engine->client_lock */
- JSList *sortfeeds; /* protected by engine->client_lock */
- int fedcount;
- int tfedcount;
- jack_shm_info_t control_shm;
- unsigned long execution_order;
- struct _jack_client_internal *next_client; /* not a linked list! */
- dlhandle handle;
- int (*initialize)(jack_client_t*, const char*); /* int. clients only */
- void (*finish)(void *); /* internal clients only */
- int error;
-
- int session_reply_pending;
-
+ jack_client_control_t *control;
+
+ int request_fd;
+ int event_fd;
+ int subgraph_start_fd;
+ int subgraph_wait_fd;
+ JSList *ports; /* protected by engine->client_lock */
+ JSList *truefeeds; /* protected by engine->client_lock */
+ JSList *sortfeeds; /* protected by engine->client_lock */
+ int fedcount;
+ int tfedcount;
+ jack_shm_info_t control_shm;
+ unsigned long execution_order;
+ struct _jack_client_internal *next_client; /* not a linked list! */
+ dlhandle handle;
+ int (*initialize)(jack_client_t*, const char*); /* int. clients only */
+ void (*finish)(void *); /* internal clients only */
+ int error;
+
+ int session_reply_pending;
+
#ifdef JACK_USE_MACH_THREADS
- /* specific resources for server/client real-time thread communication */
- mach_port_t serverport;
- trivial_message message;
- int running;
- int portnum;
-#endif /* JACK_USE_MACH_THREADS */
-
- jack_client_t *private_client;
+ /* specific resources for server/client real-time thread communication */
+ mach_port_t serverport;
+ trivial_message message;
+ int running;
+ int portnum;
+#endif /* JACK_USE_MACH_THREADS */
+
+ jack_client_t *private_client;
} jack_client_internal_t;
typedef struct _jack_thread_arg {
@@ -499,21 +499,21 @@ typedef struct _jack_thread_arg {
pid_t cap_pid;
} jack_thread_arg_t;
-extern int jack_client_handle_port_connection (jack_client_t *client,
- jack_event_t *event);
-extern jack_client_t *jack_driver_client_new (jack_engine_t *,
- const char *client_name);
-extern jack_client_t *jack_client_alloc_internal (jack_client_control_t*,
- jack_engine_t*);
+extern int jack_client_handle_port_connection(jack_client_t *client,
+ jack_event_t *event);
+extern jack_client_t *jack_driver_client_new(jack_engine_t *,
+ const char *client_name);
+extern jack_client_t *jack_client_alloc_internal(jack_client_control_t*,
+ jack_engine_t*);
/* internal clients call this. it's defined in jack/engine.c */
-void handle_internal_client_request (jack_control_t*, jack_request_t*);
+void handle_internal_client_request(jack_control_t*, jack_request_t*);
extern char *jack_tmpdir;
-extern char *jack_user_dir (void);
+extern char *jack_user_dir(void);
-extern char *jack_server_dir (const char *server_name, char *server_dir);
+extern char *jack_server_dir(const char *server_name, char *server_dir);
extern void *jack_zero_filled_buffer;
@@ -521,46 +521,46 @@ extern jack_port_functions_t jack_builtin_audio_functions;
extern jack_port_type_info_t jack_builtin_port_types[];
-extern void jack_client_fix_port_buffers (jack_client_t *client);
+extern void jack_client_fix_port_buffers(jack_client_t *client);
-extern void jack_transport_copy_position (jack_position_t *from,
- jack_position_t *to);
-extern void jack_call_sync_client (jack_client_t *client);
+extern void jack_transport_copy_position(jack_position_t *from,
+ jack_position_t *to);
+extern void jack_call_sync_client(jack_client_t *client);
-extern void jack_call_timebase_master (jack_client_t *client);
+extern void jack_call_timebase_master(jack_client_t *client);
-extern char *jack_default_server_name (void);
+extern char *jack_default_server_name(void);
-void silent_jack_error_callback (const char *desc);
+void silent_jack_error_callback(const char *desc);
/* needed for port management */
-extern jack_port_t *jack_port_by_id_int (const jack_client_t *client,
- jack_port_id_t id, int* free);
+extern jack_port_t *jack_port_by_id_int(const jack_client_t *client,
+ jack_port_id_t id, int* free);
-extern jack_port_t *jack_port_by_name_int (jack_client_t *client,
- const char *port_name);
-extern int jack_port_name_equals (jack_port_shared_t* port, const char* target);
+extern jack_port_t *jack_port_by_name_int(jack_client_t *client,
+ const char *port_name);
+extern int jack_port_name_equals(jack_port_shared_t* port, const char* target);
/** Get the size (in bytes) of the data structure used to store
- * MIDI events internally.
+ * MIDI events internally.
*/
-extern size_t jack_midi_internal_event_size ();
+extern size_t jack_midi_internal_event_size();
-extern int jack_client_handle_latency_callback (jack_client_t *client, jack_event_t *event, int is_driver);
+extern int jack_client_handle_latency_callback(jack_client_t *client, jack_event_t *event, int is_driver);
#ifdef __GNUC__
-# define likely(x) __builtin_expect((x),1)
-# define unlikely(x) __builtin_expect((x),0)
+# define likely(x) __builtin_expect ((x), 1)
+# define unlikely(x) __builtin_expect ((x), 0)
#else
-# define likely(x) (x)
-# define unlikely(x) (x)
+# define likely(x) (x)
+# define unlikely(x) (x)
#endif
#ifdef VALGRIND_CLEAN
#include <string.h>
-#define VALGRIND_MEMSET(ptr,val,size) memset ((ptr),(val),(size))
+#define VALGRIND_MEMSET(ptr, val, size) memset ((ptr), (val), (size))
#else
-#define VALGRIND_MEMSET(ptr,val,size)
+#define VALGRIND_MEMSET(ptr, val, size)
#endif
#endif /* __jack_internal_h__ */
diff --git a/include/intsimd.h b/include/intsimd.h
index 2377bd1..ab5572c 100644
--- a/include/intsimd.h
+++ b/include/intsimd.h
@@ -1,21 +1,21 @@
/*
Copyright (C) 2005-2007 Jussi Laako
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+
+ */
#ifndef __jack_intsimd_h__
#define __jack_intsimd_h__
@@ -23,34 +23,34 @@
#ifdef USE_DYNSIMD
#if (defined(__i386__) || defined(__x86_64__))
#define ARCH_X86
-#endif /* __i386__ || __x86_64__ */
-#endif /* USE_DYNSIMD */
+#endif /* __i386__ || __x86_64__ */
+#endif /* USE_DYNSIMD */
#ifdef ARCH_X86
-#define ARCH_X86_SSE(x) ((x) & 0xff)
-#define ARCH_X86_HAVE_SSE2(x) (ARCH_X86_SSE(x) >= 2)
-#define ARCH_X86_3DNOW(x) ((x) >> 8)
-#define ARCH_X86_HAVE_3DNOW(x) (ARCH_X86_3DNOW(x))
+#define ARCH_X86_SSE(x) ((x) & 0xff)
+#define ARCH_X86_HAVE_SSE2(x) (ARCH_X86_SSE (x) >= 2)
+#define ARCH_X86_3DNOW(x) ((x) >> 8)
+#define ARCH_X86_HAVE_3DNOW(x) (ARCH_X86_3DNOW (x))
-typedef float v2sf __attribute__((vector_size(8)));
-typedef float v4sf __attribute__((vector_size(16)));
+typedef float v2sf __attribute__((vector_size (8)));
+typedef float v4sf __attribute__((vector_size (16)));
typedef v2sf * pv2sf;
typedef v4sf * pv4sf;
extern int cpu_type;
-int have_3dnow (void);
-int have_sse (void);
-void x86_3dnow_copyf (float *, const float *, int);
-void x86_3dnow_add2f (float *, const float *, int);
-void x86_sse_copyf (float *, const float *, int);
-void x86_sse_add2f (float *, const float *, int);
-void x86_sse_f2i (int *, const float *, int, float);
-void x86_sse_i2f (float *, const int *, int, float);
+int have_3dnow(void);
+int have_sse(void);
+void x86_3dnow_copyf(float *, const float *, int);
+void x86_3dnow_add2f(float *, const float *, int);
+void x86_sse_copyf(float *, const float *, int);
+void x86_sse_add2f(float *, const float *, int);
+void x86_sse_f2i(int *, const float *, int, float);
+void x86_sse_i2f(float *, const int *, int, float);
#endif /* ARCH_X86 */
-void jack_port_set_funcs (void);
+void jack_port_set_funcs(void);
#endif /* __jack_intsimd_h__ */
diff --git a/include/memops.h b/include/memops.h
index a5582bf..a9b63e7 100644
--- a/include/memops.h
+++ b/include/memops.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1999-2000 Paul Davis
+ Copyright (C) 1999-2000 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,14 +15,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ */
#ifndef __jack_memops_h__
#define __jack_memops_h__
#include <jack/types.h>
-typedef enum {
+typedef enum {
None,
Rectangular,
Triangular,
@@ -33,52 +33,52 @@ typedef enum {
#define DITHER_BUF_MASK 7
typedef struct {
- unsigned int depth;
- float rm1;
- unsigned int idx;
- float e[DITHER_BUF_SIZE];
+ unsigned int depth;
+ float rm1;
+ unsigned int idx;
+ float e[DITHER_BUF_SIZE];
} dither_state_t;
/* float functions */
-void sample_move_floatLE_sSs (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long dst_skip);
-void sample_move_dS_floatLE (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_floatLE_sSs(jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long dst_skip);
+void sample_move_dS_floatLE(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
/* integer functions */
-void sample_move_d32u24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_d32u24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_d24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_d24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_d16_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_d16_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-
-void sample_move_dither_rect_d32u24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_rect_d32u24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_tri_d32u24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_tri_d32u24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_shaped_d32u24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_shaped_d32u24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_rect_d24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_rect_d24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_tri_d24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_tri_d24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_shaped_d24_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_shaped_d24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_rect_d16_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_rect_d16_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_tri_d16_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_tri_d16_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_shaped_d16_sSs (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_move_dither_shaped_d16_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-
-void sample_move_dS_s32u24s (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
-void sample_move_dS_s32u24 (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
-void sample_move_dS_s24s (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
-void sample_move_dS_s24 (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
-void sample_move_dS_s16s (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
-void sample_move_dS_s16 (jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
-
-void sample_merge_d16_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
-void sample_merge_d32u24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_d32u24_sSs(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_d32u24_sS(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_d24_sSs(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_d24_sS(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_d16_sSs(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_d16_sS(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+
+void sample_move_dither_rect_d32u24_sSs(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_rect_d32u24_sS(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_tri_d32u24_sSs(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_tri_d32u24_sS(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_shaped_d32u24_sSs(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_shaped_d32u24_sS(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_rect_d24_sSs(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_rect_d24_sS(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_tri_d24_sSs(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_tri_d24_sS(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_shaped_d24_sSs(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_shaped_d24_sS(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_rect_d16_sSs(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_rect_d16_sS(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_tri_d16_sSs(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_tri_d16_sS(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_shaped_d16_sSs(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_move_dither_shaped_d16_sS(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+
+void sample_move_dS_s32u24s(jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
+void sample_move_dS_s32u24(jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
+void sample_move_dS_s24s(jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
+void sample_move_dS_s24(jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
+void sample_move_dS_s16s(jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
+void sample_move_dS_s16(jack_default_audio_sample_t *dst, char *src, unsigned long nsamples, unsigned long src_skip);
+
+void sample_merge_d16_sS(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
+void sample_merge_d32u24_sS(char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state);
static __inline__ void
sample_merge (jack_default_audio_sample_t *dst, jack_default_audio_sample_t *src, unsigned long cnt)
@@ -95,21 +95,21 @@ static __inline__ void
sample_memcpy (jack_default_audio_sample_t *dst, jack_default_audio_sample_t *src, unsigned long cnt)
{
- memcpy (dst, src, cnt * sizeof (jack_default_audio_sample_t));
+ memcpy (dst, src, cnt * sizeof(jack_default_audio_sample_t));
}
-void memset_interleave (char *dst, char val, unsigned long bytes, unsigned long unit_bytes, unsigned long skip_bytes);
-void memcpy_fake (char *dst, char *src, unsigned long src_bytes, unsigned long foo, unsigned long bar);
+void memset_interleave(char *dst, char val, unsigned long bytes, unsigned long unit_bytes, unsigned long skip_bytes);
+void memcpy_fake(char *dst, char *src, unsigned long src_bytes, unsigned long foo, unsigned long bar);
-void memcpy_interleave_d16_s16 (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
-void memcpy_interleave_d24_s24 (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
-void memcpy_interleave_d32_s32 (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
+void memcpy_interleave_d16_s16(char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
+void memcpy_interleave_d24_s24(char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
+void memcpy_interleave_d32_s32(char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
-void merge_memcpy_interleave_d16_s16 (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
-void merge_memcpy_interleave_d24_s24 (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
-void merge_memcpy_interleave_d32_s32 (char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
+void merge_memcpy_interleave_d16_s16(char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
+void merge_memcpy_interleave_d24_s24(char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
+void merge_memcpy_interleave_d32_s32(char *dst, char *src, unsigned long src_bytes, unsigned long dst_skip_bytes, unsigned long src_skip_bytes);
-void merge_memcpy_d16_s16 (char *dst, char *src, unsigned long src_bytes, unsigned long foo, unsigned long bar);
-void merge_memcpy_d32_s32 (char *dst, char *src, unsigned long src_bytes, unsigned long foo, unsigned long bar);
+void merge_memcpy_d16_s16(char *dst, char *src, unsigned long src_bytes, unsigned long foo, unsigned long bar);
+void merge_memcpy_d32_s32(char *dst, char *src, unsigned long src_bytes, unsigned long foo, unsigned long bar);
#endif /* __jack_memops_h__ */
diff --git a/include/messagebuffer.h b/include/messagebuffer.h
index 18b8027..627e148 100644
--- a/include/messagebuffer.h
+++ b/include/messagebuffer.h
@@ -8,19 +8,19 @@
/*
* Copyright (C) 2004 Rui Nuno Capela, Steve Harris
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
@@ -28,17 +28,17 @@
#ifndef __jack_messagebuffer_h__
#define __jack_messagebuffer_h__
-#define MESSAGE(fmt,args...) jack_messagebuffer_add(fmt , ##args)
-#define VERBOSE(engine,fmt,args...) \
+#define MESSAGE(fmt, args ...) jack_messagebuffer_add (fmt, ## args)
+#define VERBOSE(engine, fmt, args ...) \
if ((engine)->verbose) \
- jack_messagebuffer_add(fmt , ##args)
+ jack_messagebuffer_add (fmt, ## args)
void jack_messagebuffer_init();
void jack_messagebuffer_exit();
-void jack_message_buffer_thread_init (void (*cb)(void*), void*);
+void jack_message_buffer_thread_init(void (*cb)(void*), void*);
void jack_messagebuffer_add(const char *fmt, ...);
-void jack_messagebuffer_thread_init (void (*cb)(void*), void* arg);
+void jack_messagebuffer_thread_init(void (*cb)(void*), void* arg);
#endif /* __jack_messagebuffer_h__ */
diff --git a/include/pool.h b/include/pool.h
index 41ad618..4cde852 100644
--- a/include/pool.h
+++ b/include/pool.h
@@ -1,28 +1,28 @@
/*
Copyright (C) 2001 Paul Davis
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
+ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ */
#ifndef __jack_pool_h__
#define __jack_pool_h__
#include <sys/types.h>
-void * jack_pool_alloc (size_t bytes);
-void jack_pool_release (void *);
+void * jack_pool_alloc(size_t bytes);
+void jack_pool_release(void *);
#endif /* __jack_pool_h__ */
diff --git a/include/port.h b/include/port.h
index 9ddcc1c..066b4b7 100644
--- a/include/port.h
+++ b/include/port.h
@@ -1,21 +1,21 @@
/*
Copyright (C) 2001 Paul Davis
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
+ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ */
#ifndef __jack_port_h__
#define __jack_port_h__
@@ -38,7 +38,7 @@
* - one other
*
* which is probably enough for more than just the foreseeable future.
- */
+ */
#define JACK_MAX_PORT_TYPES 4
#define JACK_AUDIO_PORT_TYPE 0
#define JACK_MIDI_PORT_TYPE 1
@@ -47,14 +47,14 @@
#define JACK_CLIENT_NAME_SIZE 33
/* JACK shared memory segments are limited to MAX_INT32, they can be
- * shared between 32-bit and 64-bit clients.
+ * shared between 32-bit and 64-bit clients.
*/
#define JACK_SHM_MAX (MAX_INT32)
typedef int32_t jack_port_type_id_t;
#define JACK_BACKEND_ALIAS "system"
-/* Port type structure.
+/* Port type structure.
*
* (1) One for each port type is part of the engine's jack_control_t
* shared memory structure.
@@ -66,71 +66,71 @@ typedef int32_t jack_port_type_id_t;
*/
typedef struct _jack_port_type_info {
- jack_port_type_id_t ptype_id;
- const char type_name[JACK_PORT_TYPE_SIZE];
+ jack_port_type_id_t ptype_id;
+ const char type_name[JACK_PORT_TYPE_SIZE];
- /* If == 1, then a buffer to handle nframes worth of data has
- * sizeof(jack_default_audio_sample_t) * nframes bytes.
- *
- * If > 1, the buffer allocated for input mixing will be
- * this value times sizeof(jack_default_audio_sample_t)
- * * nframes bytes in size. For non-audio data types,
- * it may have a different value.
- *
- * If < 0, the value should be ignored, and buffer_size
- * should be used.
- */
- int32_t buffer_scale_factor;
+ /* If == 1, then a buffer to handle nframes worth of data has
+ * sizeof(jack_default_audio_sample_t) * nframes bytes.
+ *
+ * If > 1, the buffer allocated for input mixing will be
+ * this value times sizeof(jack_default_audio_sample_t)
+ * * nframes bytes in size. For non-audio data types,
+ * it may have a different value.
+ *
+ * If < 0, the value should be ignored, and buffer_size
+ * should be used.
+ */
+ int32_t buffer_scale_factor;
- /* ignored unless buffer_scale_factor is < 0. see above */
- jack_shmsize_t buffer_size;
+ /* ignored unless buffer_scale_factor is < 0. see above */
+ jack_shmsize_t buffer_size;
- jack_shm_registry_index_t shm_registry_index;
+ jack_shm_registry_index_t shm_registry_index;
- jack_shmsize_t zero_buffer_offset;
+ jack_shmsize_t zero_buffer_offset;
} POST_PACKED_STRUCTURE jack_port_type_info_t;
/* Allocated by the engine in shared memory. */
typedef struct _jack_port_shared {
- jack_port_type_id_t ptype_id; /* index into port type array */
- jack_shmsize_t offset; /* buffer offset in shm segment */
- jack_port_id_t id; /* index into engine port array */
- jack_uuid_t uuid;
- uint32_t flags;
- char name[JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE];
- char alias1[JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE];
- char alias2[JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE];
- jack_uuid_t client_id; /* who owns me */
-
- volatile jack_nframes_t latency;
- volatile jack_nframes_t total_latency;
- volatile jack_latency_range_t playback_latency;
- volatile jack_latency_range_t capture_latency;
- volatile uint8_t monitor_requests;
-
- char has_mixdown; /* port has a mixdown function */
- char in_use;
- char unused; /* legacy locked field */
+ jack_port_type_id_t ptype_id; /* index into port type array */
+ jack_shmsize_t offset; /* buffer offset in shm segment */
+ jack_port_id_t id; /* index into engine port array */
+ jack_uuid_t uuid;
+ uint32_t flags;
+ char name[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+ char alias1[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+ char alias2[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
+ jack_uuid_t client_id; /* who owns me */
+
+ volatile jack_nframes_t latency;
+ volatile jack_nframes_t total_latency;
+ volatile jack_latency_range_t playback_latency;
+ volatile jack_latency_range_t capture_latency;
+ volatile uint8_t monitor_requests;
+
+ char has_mixdown; /* port has a mixdown function */
+ char in_use;
+ char unused; /* legacy locked field */
} POST_PACKED_STRUCTURE jack_port_shared_t;
typedef struct _jack_port_functions {
- /* Function to initialize port buffer. Cannot be NULL.
- * NOTE: This must take a buffer rather than jack_port_t as it is called
- * in jack_engine_place_buffers() before any port creation.
- * A better solution is to make jack_engine_place_buffers to be type-specific,
- * but this works.
- */
- void (*buffer_init)(void *buffer, size_t size, jack_nframes_t);
+ /* Function to initialize port buffer. Cannot be NULL.
+ * NOTE: This must take a buffer rather than jack_port_t as it is called
+ * in jack_engine_place_buffers() before any port creation.
+ * A better solution is to make jack_engine_place_buffers to be type-specific,
+ * but this works.
+ */
+ void (*buffer_init)(void *buffer, size_t size, jack_nframes_t);
- /* Function to mixdown multiple inputs to a buffer. Can be NULL,
- * indicating that multiple input connections are not legal for
- * this data type.
- */
- void (*mixdown)(jack_port_t *, jack_nframes_t);
+ /* Function to mixdown multiple inputs to a buffer. Can be NULL,
+ * indicating that multiple input connections are not legal for
+ * this data type.
+ */
+ void (*mixdown)(jack_port_t *, jack_nframes_t);
} jack_port_functions_t;
@@ -146,14 +146,14 @@ jack_get_port_functions(jack_port_type_id_t ptid);
/* Allocated by the client in local memory. */
struct _jack_port {
- void **client_segment_base;
- void *mix_buffer;
- jack_port_type_info_t *type_info; /* shared memory type info */
- struct _jack_port_shared *shared; /* corresponding shm struct */
- struct _jack_port *tied; /* locally tied source port */
- jack_port_functions_t fptr;
- pthread_mutex_t connection_lock;
- JSList *connections;
+ void **client_segment_base;
+ void *mix_buffer;
+ jack_port_type_info_t *type_info; /* shared memory type info */
+ struct _jack_port_shared *shared; /* corresponding shm struct */
+ struct _jack_port *tied; /* locally tied source port */
+ jack_port_functions_t fptr;
+ pthread_mutex_t connection_lock;
+ JSList *connections;
};
/* Inline would be cleaner, but it needs to be fast even in
@@ -161,13 +161,13 @@ struct _jack_port {
* ports. jack_port_buffer() works for both input and output ports.
*/
#define jack_port_buffer(p) \
- ((void *) ((p)->mix_buffer? (p)->mix_buffer: \
- *(p)->client_segment_base + (p)->shared->offset))
+ ((void*)((p)->mix_buffer ? (p)->mix_buffer : \
+ *(p)->client_segment_base + (p)->shared->offset))
#define jack_output_port_buffer(p) \
- ((void *) (*(p)->client_segment_base + (p)->shared->offset))
+ ((void*)(*(p)->client_segment_base + (p)->shared->offset))
/* not for use by JACK applications */
-size_t jack_port_type_buffer_size (jack_port_type_info_t* port_type_info, jack_nframes_t nframes);
+size_t jack_port_type_buffer_size(jack_port_type_info_t* port_type_info, jack_nframes_t nframes);
#endif /* __jack_port_h__ */
diff --git a/include/sanitycheck.h b/include/sanitycheck.h
index 5c98896..50c228b 100644
--- a/include/sanitycheck.h
+++ b/include/sanitycheck.h
@@ -16,7 +16,7 @@
*
**/
-int sanitycheck (int do_realtime_check,
- int do_freqscaling_check);
+int sanitycheck(int do_realtime_check,
+ int do_freqscaling_check);
#endif /* __jack_sanitycheck_h__ */
diff --git a/include/shm.h b/include/shm.h
index 8103ce9..950e735 100644
--- a/include/shm.h
+++ b/include/shm.h
@@ -5,12 +5,12 @@
#include <sys/types.h>
#include <jack/types.h>
-#define MAX_SERVERS 8 /* maximum concurrent servers */
-#define MAX_SHM_ID 256 /* generally about 16 per server */
-#define JACK_SERVER_NAME_SIZE 256 /* maximum length of server name */
-#define JACK_SHM_MAGIC 0x4a41434b /* shm magic number: "JACK" */
-#define JACK_SHM_NULL_INDEX -1 /* NULL SHM index */
-#define JACK_SHM_REGISTRY_INDEX -2 /* pseudo SHM index for registry */
+#define MAX_SERVERS 8 /* maximum concurrent servers */
+#define MAX_SHM_ID 256 /* generally about 16 per server */
+#define JACK_SERVER_NAME_SIZE 256 /* maximum length of server name */
+#define JACK_SHM_MAGIC 0x4a41434b /* shm magic number: "JACK" */
+#define JACK_SHM_NULL_INDEX -1 /* NULL SHM index */
+#define JACK_SHM_REGISTRY_INDEX -2 /* pseudo SHM index for registry */
/* On Mac OS X, SHM_NAME_MAX is the maximum length of a shared memory
@@ -21,21 +21,21 @@
#ifndef SHM_NAME_MAX
#define SHM_NAME_MAX NAME_MAX
#endif
-typedef char shm_name_t[SHM_NAME_MAX];
+typedef char shm_name_t[SHM_NAME_MAX];
typedef shm_name_t jack_shm_id_t;
#else /* System V SHM */
-typedef int jack_shm_id_t;
+typedef int jack_shm_id_t;
#endif /* SHM type */
/* shared memory type */
typedef enum {
- shm_POSIX = 1, /* POSIX shared memory */
- shm_SYSV = 2 /* System V shared memory */
+ shm_POSIX = 1, /* POSIX shared memory */
+ shm_SYSV = 2 /* System V shared memory */
} jack_shmtype_t;
typedef int16_t jack_shm_registry_index_t;
-/**
+/**
* A structure holding information about shared memory allocated by
* JACK. this persists across invocations of JACK, and can be used by
* multiple JACK servers. It contains no pointers and is valid across
@@ -45,31 +45,31 @@ typedef int16_t jack_shm_registry_index_t;
* server names, followed by an array of segment registry entries.
*/
typedef struct _jack_shm_server {
- pid_t pid; /* process ID */
- char name[JACK_SERVER_NAME_SIZE];
+ pid_t pid; /* process ID */
+ char name[JACK_SERVER_NAME_SIZE];
} jack_shm_server_t;
typedef struct _jack_shm_header {
- uint32_t magic; /* magic number */
- uint16_t protocol; /* JACK protocol version */
- jack_shmtype_t type; /* shm type */
- jack_shmsize_t size; /* total registry segment size */
- jack_shmsize_t hdr_len; /* size of header */
- jack_shmsize_t entry_len; /* size of registry entry */
- jack_shm_server_t server[MAX_SERVERS]; /* current server array */
+ uint32_t magic; /* magic number */
+ uint16_t protocol; /* JACK protocol version */
+ jack_shmtype_t type; /* shm type */
+ jack_shmsize_t size; /* total registry segment size */
+ jack_shmsize_t hdr_len; /* size of header */
+ jack_shmsize_t entry_len; /* size of registry entry */
+ jack_shm_server_t server[MAX_SERVERS]; /* current server array */
} jack_shm_header_t;
typedef struct _jack_shm_registry {
- jack_shm_registry_index_t index; /* offset into the registry */
- pid_t allocator; /* PID that created shm segment */
- jack_shmsize_t size; /* for POSIX unattach */
- jack_shm_id_t id; /* API specific, see above */
+ jack_shm_registry_index_t index; /* offset into the registry */
+ pid_t allocator; /* PID that created shm segment */
+ jack_shmsize_t size; /* for POSIX unattach */
+ jack_shm_id_t id; /* API specific, see above */
} jack_shm_registry_t;
-#define JACK_SHM_REGISTRY_SIZE (sizeof (jack_shm_header_t) \
- + sizeof (jack_shm_registry_t) * MAX_SHM_ID)
+#define JACK_SHM_REGISTRY_SIZE (sizeof(jack_shm_header_t) \
+ + sizeof(jack_shm_registry_t) * MAX_SHM_ID)
-/**
+/**
* a structure holding information about shared memory
* allocated by JACK. this version is valid only
* for a given address space. It contains a pointer
@@ -77,34 +77,35 @@ typedef struct _jack_shm_registry {
* attached to the address space.
*/
typedef struct _jack_shm_info {
- jack_shm_registry_index_t index; /* offset into the registry */
- void *attached_at; /* address where attached */
+ jack_shm_registry_index_t index; /* offset into the registry */
+ void *attached_at; /* address where attached */
} jack_shm_info_t;
/* utility functions used only within JACK */
-extern void jack_shm_copy_from_registry (jack_shm_info_t*,
+extern void jack_shm_copy_from_registry (jack_shm_info_t *,
jack_shm_registry_index_t);
-extern void jack_shm_copy_to_registry (jack_shm_info_t*,
- jack_shm_registry_index_t*);
+extern void jack_shm_copy_to_registry(jack_shm_info_t*,
+ jack_shm_registry_index_t*);
extern void jack_release_shm_info (jack_shm_registry_index_t);
-static inline char* jack_shm_addr (jack_shm_info_t* si) {
+static inline char* jack_shm_addr (jack_shm_info_t* si)
+{
return si->attached_at;
}
/* here beginneth the API */
-extern int jack_register_server (const char *server_name, int new_registry);
-extern void jack_unregister_server (const char *server_name);
+extern int jack_register_server(const char *server_name, int new_registry);
+extern void jack_unregister_server(const char *server_name);
-extern int jack_initialize_shm (const char *server_name);
-extern int jack_cleanup_shm (void);
+extern int jack_initialize_shm(const char *server_name);
+extern int jack_cleanup_shm(void);
-extern int jack_shmalloc (jack_shmsize_t size, jack_shm_info_t* result);
-extern void jack_release_shm (jack_shm_info_t*);
-extern void jack_destroy_shm (jack_shm_info_t*);
-extern int jack_attach_shm (jack_shm_info_t*);
-extern int jack_resize_shm (jack_shm_info_t*, jack_shmsize_t size);
+extern int jack_shmalloc(jack_shmsize_t size, jack_shm_info_t* result);
+extern void jack_release_shm(jack_shm_info_t*);
+extern void jack_destroy_shm(jack_shm_info_t*);
+extern int jack_attach_shm(jack_shm_info_t*);
+extern int jack_resize_shm(jack_shm_info_t*, jack_shmsize_t size);
#endif /* __jack_shm_h__ */
diff --git a/include/start.h b/include/start.h
index 00212e4..3048560 100644
--- a/include/start.h
+++ b/include/start.h
@@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ */
#define PIPE_READ_FD (3)
#define PIPE_WRITE_FD (4)
diff --git a/include/systemtest.h b/include/systemtest.h
index 27e0ae7..9445372 100644
--- a/include/systemtest.h
+++ b/include/systemtest.h
@@ -5,9 +5,9 @@
* GPL, yabbadabba
*
* Set of functions to gather system information for the jack setup wizard.
- *
+ *
* @author Florian Faber, faber@faberman.de
- *
+ *
* @version 0.1 (2009-01-15) [FF]
* - initial version
*
@@ -15,7 +15,7 @@
/**
- * This function checks for the existence of known frequency scaling mechanisms
+ * This function checks for the existence of known frequency scaling mechanisms
* in this system.
*
* @returns 0 if the system has no frequency scaling capabilities non-0 otherwise.
@@ -24,8 +24,8 @@ int system_has_frequencyscaling();
/**
- * This function determines wether the CPU has a variable clock speed if frequency
- * scaling is available.
+ * This function determines wether the CPU has a variable clock speed if frequency
+ * scaling is available.
*
* @returns 0 if system doesn't use frequency scaling at the moment, non-0 otherwise
**/
@@ -38,7 +38,7 @@ int system_uses_frequencyscaling();
*
* @returns 1 if there appears to be such a line
**/
-int system_has_rtprio_limits_conf ();
+int system_has_rtprio_limits_conf();
/**
* Checks for the existence of the 'audio' group on this system
diff --git a/include/unlock.h b/include/unlock.h
index 3979efb..caa7e27 100644
--- a/include/unlock.h
+++ b/include/unlock.h
@@ -1,26 +1,26 @@
/* -*- mode: c; c-file-style: "bsd"; -*- */
/*
Copyright (C) 2001-2003 Paul Davis
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software
+ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ */
#ifndef __jack_mlock_h__
#define __jack_mlock_h__
-extern void cleanup_mlock (void);
+extern void cleanup_mlock(void);
#endif /* __jack_mlock_h__ */
diff --git a/include/varargs.h b/include/varargs.h
index ae9e58a..d09e1a3 100644
--- a/include/varargs.h
+++ b/include/varargs.h
@@ -1,18 +1,18 @@
/*
* Copyright (C) 2004 Jack O'Quin
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
@@ -26,9 +26,9 @@ extern "C" {
/* variable argument structure */
typedef struct {
- char *server_name; /* server name */
- char *load_name; /* load module name */
- char *load_init; /* initialization string */
+ char *server_name; /* server name */
+ char *load_name; /* load module name */
+ char *load_init; /* initialization string */
char *sess_uuid;
} jack_varargs_t;
@@ -46,16 +46,20 @@ jack_varargs_parse (jack_options_t options, va_list ap, jack_varargs_t *va)
jack_varargs_init (va);
if ((options & JackServerName)) {
- char *sn = va_arg(ap, char *);
- if (sn)
+ char *sn = va_arg (ap, char *);
+ if (sn) {
va->server_name = sn;
+ }
+ }
+ if ((options & JackLoadName)) {
+ va->load_name = va_arg (ap, char *);
+ }
+ if ((options & JackLoadInit)) {
+ va->load_init = va_arg (ap, char *);
+ }
+ if ((options & JackSessionID)) {
+ va->sess_uuid = va_arg (ap, char *);
}
- if ((options & JackLoadName))
- va->load_name = va_arg(ap, char *);
- if ((options & JackLoadInit))
- va->load_init = va_arg(ap, char *);
- if ((options & JackSessionID))
- va->sess_uuid = va_arg(ap, char *);
}
#ifdef __cplusplus