| @@ -1,111 +0,0 @@ | |||||
| /* | |||||
| * bitset.h -- some simple bit vector set operations. | |||||
| * | |||||
| * This is useful for sets of small non-negative integers. There are | |||||
| * some obvious set operations that are not implemented because I | |||||
| * don't need them right now. | |||||
| * | |||||
| * These functions represent sets as arrays of unsigned 32-bit | |||||
| * integers allocated on the heap. The first entry contains the set | |||||
| * cardinality (number of elements allowed), followed by one or more | |||||
| * words containing bit vectors. | |||||
| * | |||||
| */ | |||||
| /* | |||||
| * Copyright (C) 2005 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 (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 __bitset_h__ | |||||
| #define __bitset_h__ | |||||
| #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 | |||||
| * uint32_t. For the set sizes I currently need, this is acceptable. | |||||
| * It should not be hard to pack the bits better, if that becomes | |||||
| * worthwhile. | |||||
| */ | |||||
| 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) | |||||
| static inline void | |||||
| bitset_add(bitset_t set, unsigned int 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) | |||||
| { | |||||
| 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) | |||||
| { | |||||
| *set = (bitset_t) calloc(WORD_SIZE(cardinality), | |||||
| sizeof(_bitset_word_t)); | |||||
| assert(*set); | |||||
| *set[0] = cardinality; | |||||
| } | |||||
| static inline void | |||||
| bitset_destroy(bitset_t *set) | |||||
| { | |||||
| if (*set) { | |||||
| free(*set); | |||||
| *set = (bitset_t) 0; | |||||
| } | |||||
| } | |||||
| static inline int | |||||
| bitset_empty(bitset_t set) | |||||
| { | |||||
| int i; | |||||
| _bitset_word_t result = 0; | |||||
| int nwords = WORD_SIZE(set[0]); | |||||
| for (i = 1; i < nwords; i++) { | |||||
| result |= set[i]; | |||||
| } | |||||
| return (result == 0); | |||||
| } | |||||
| static inline int | |||||
| bitset_contains(bitset_t set, unsigned int 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) | |||||
| { | |||||
| assert(element < set[0]); | |||||
| set[WORD_INDEX(element)] &= ~(1<<BIT_INDEX(element)); | |||||
| } | |||||
| #endif /* __bitset_h__ */ | |||||
| @@ -1,304 +0,0 @@ | |||||
| /* | |||||
| 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 | |||||
| (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_driver_h__ | |||||
| #define __jack_driver_h__ | |||||
| #include <pthread.h> | |||||
| #include <jack/types.h> | |||||
| #include <jack/port.h> | |||||
| #include <jack/driver_interface.h> | |||||
| typedef float gain_t; | |||||
| typedef unsigned long channel_t; | |||||
| typedef enum { | |||||
| Lock = 0x1, | |||||
| NoLock = 0x2, | |||||
| Sync = 0x4, | |||||
| NoSync = 0x8 | |||||
| } ClockSyncStatus; | |||||
| typedef void (*ClockSyncListenerFunction)(channel_t,ClockSyncStatus,void*); | |||||
| typedef struct { | |||||
| 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); | |||||
| /* | |||||
| Call sequence summary: | |||||
| 1) engine loads driver via runtime dynamic linking | |||||
| - 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 () | |||||
| } | |||||
| 5) engine stops driver | |||||
| 6) engine detaches from driver | |||||
| 7) engine calls driver `finish' routine | |||||
| Note that stop/start may be called multiple times in the event of an | |||||
| error return from the `wait' function. | |||||
| */ | |||||
| typedef struct _jack_driver { | |||||
| /* The _jack_driver structure fields are included at the beginning of | |||||
| 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. | |||||
| jack_time_t period_usecs; | |||||
| The driver should set this within its "wait" function to indicate | |||||
| the UST of the most recent determination that the engine cycle | |||||
| should run. it should not be set if the "extra_fd" argument of | |||||
| the wait function is set to a non-zero value. | |||||
| jack_time_t last_wait_ust; | |||||
| 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; | |||||
| This should perform any cleanup associated with the driver. it will | |||||
| be called when jack server process decides to get rid of the | |||||
| driver. in some systems, it may not be called at all, so the driver | |||||
| should never rely on a call to this. it can set it to NULL if | |||||
| it has nothing do do. | |||||
| void (*finish)(struct _jack_driver *); | |||||
| The JACK engine will call this when it wishes to attach itself to | |||||
| the driver. the engine will pass a pointer to itself, which the driver | |||||
| may use in anyway it wishes to. the driver may assume that this | |||||
| is the same engine object that will make `wait' calls until a | |||||
| `detach' call is made. | |||||
| JackDriverAttachFunction attach; | |||||
| The JACK engine will call this when it is finished using a driver. | |||||
| JackDriverDetachFunction detach; | |||||
| 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. | |||||
| 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. | |||||
| 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 | |||||
| plans to continue execution. | |||||
| JackDriverWaitFunction wait; | |||||
| 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. | |||||
| This function will always be called after the wait function (above). | |||||
| JackDriverReadFunction read; | |||||
| 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. | |||||
| this function will always be called after the read function (above). | |||||
| JackDriverWriteFunction write; | |||||
| The JACK engine will call this after the wait function (above) has | |||||
| been called, but for some reason the engine is unable to execute | |||||
| a full "cycle". the driver should do whatever is necessary to | |||||
| keep itself running correctly, but cannot reference ports | |||||
| or other JACK data structures in any way. | |||||
| 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). | |||||
| NOTE: the driver must silence its capture buffers (if any) | |||||
| from within this function or the function that actually | |||||
| implements the change in state. | |||||
| JackDriverStopFunction stop; | |||||
| The engine will call this to let the driver know that it plans | |||||
| to start calling the `wait' function on a regular basis. the driver | |||||
| should take any appropriate steps to handle this (possibly no steps | |||||
| 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 | |||||
| has requested a new buffer size. The stop function will be called | |||||
| prior to this, and the start function after this one has returned. | |||||
| JackDriverBufSizeFunction bufsize; | |||||
| */ | |||||
| /* 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_driver_t; | |||||
| typedef jack_driver_desc_t * (*JackDriverDescFunction) (); | |||||
| 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 *); | |||||
| /**************************** | |||||
| *** 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 | |||||
| - driver_initialize calls jack_driver_nt_init | |||||
| 2) nt layer attaches to driver | |||||
| 3) nt layer starts driver | |||||
| 4) nt layer runs a thread, calling | |||||
| while () { | |||||
| driver->nt_run_ctcle(); | |||||
| } | |||||
| 5) nt layer stops driver | |||||
| 6) nt layer detaches driver | |||||
| 7) engine calls driver `finish' routine which calls jack_driver_nt_finish | |||||
| Note that stop/start may be called multiple times in the event of an | |||||
| 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 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; | |||||
| #define nt_read read | |||||
| #define nt_write write | |||||
| #define nt_null_cycle null_cycle | |||||
| 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); | |||||
| #endif /* __jack_driver_h__ */ | |||||
| @@ -1,123 +0,0 @@ | |||||
| /* | |||||
| 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 | |||||
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||||
| */ | |||||
| #ifndef __jack_driver_interface_h__ | |||||
| #define __jack_driver_interface_h__ | |||||
| #ifdef __cplusplus | |||||
| extern "C" { | |||||
| #endif | |||||
| #include <limits.h> | |||||
| #include <jack/jack.h> | |||||
| #include <jack/internal.h> | |||||
| #define JACK_DRIVER_NAME_MAX 15 | |||||
| #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 */ | |||||
| /** Driver parameter types */ | |||||
| 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]; | |||||
| } 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_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; | |||||
| } 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 */ | |||||
| } jack_driver_param_desc_t; | |||||
| /** A driver parameter */ | |||||
| 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 */ | |||||
| } jack_driver_desc_t; | |||||
| #ifdef __cplusplus | |||||
| } | |||||
| #endif | |||||
| #endif /* __jack_driver_interface_h__ */ | |||||
| @@ -1,212 +0,0 @@ | |||||
| /* -*- 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. | |||||
| 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__ | |||||
| #include <jack/jslist.h> | |||||
| #include <jack/driver_interface.h> | |||||
| static void | |||||
| jack_print_driver_options (jack_driver_desc_t * desc, FILE *file) | |||||
| { | |||||
| unsigned long i; | |||||
| char arg_default[JACK_DRIVER_PARAM_STRING_MAX + 1]; | |||||
| for (i = 0; i < desc->nparams; i++) { | |||||
| switch (desc->params[i].type) { | |||||
| case JackDriverParamInt: | |||||
| sprintf (arg_default, "%" PRId32, desc->params[i].value.i); | |||||
| break; | |||||
| case JackDriverParamUInt: | |||||
| sprintf (arg_default, "%" PRIu32, desc->params[i].value.ui); | |||||
| break; | |||||
| case JackDriverParamChar: | |||||
| sprintf (arg_default, "%c", desc->params[i].value.c); | |||||
| break; | |||||
| case JackDriverParamString: | |||||
| if (desc->params[i].value.str && | |||||
| strcmp (desc->params[i].value.str, "") != 0) | |||||
| sprintf (arg_default, "%s", desc->params[i].value.str); | |||||
| else | |||||
| sprintf (arg_default, "none"); | |||||
| break; | |||||
| case JackDriverParamBool: | |||||
| sprintf (arg_default, "%s", desc->params[i].value.i ? "true" : "false"); | |||||
| break; | |||||
| } | |||||
| fprintf (file, "\t-%c, --%s \t%s (default: %s)\n", | |||||
| desc->params[i].character, | |||||
| desc->params[i].name, | |||||
| desc->params[i].short_desc, | |||||
| arg_default); | |||||
| } | |||||
| } | |||||
| static void | |||||
| jack_print_driver_param_usage (jack_driver_desc_t * desc, unsigned long param, FILE *file) | |||||
| { | |||||
| 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); | |||||
| } | |||||
| static int | |||||
| jack_parse_driver_params (jack_driver_desc_t * desc, int argc, char **argv, JSList ** param_ptr) | |||||
| { | |||||
| struct option * long_options; | |||||
| char * options, * options_ptr; | |||||
| unsigned long i; | |||||
| int opt, param_index; | |||||
| JSList * params = NULL; | |||||
| jack_driver_param_t * driver_param; | |||||
| if (argc <= 1) { | |||||
| *param_ptr = NULL; | |||||
| return 0; | |||||
| } | |||||
| /* check for help */ | |||||
| if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) { | |||||
| if (argc > 2) { | |||||
| for (i = 0; i < desc->nparams; i++) { | |||||
| if (strcmp (desc->params[i].name, argv[2]) == 0) { | |||||
| jack_print_driver_param_usage (desc, i, stdout); | |||||
| return 1; | |||||
| } | |||||
| } | |||||
| fprintf (stderr, "jackd: unknown option '%s' " | |||||
| "for driver '%s'\n", argv[2], | |||||
| desc->name); | |||||
| } | |||||
| printf ("Parameters for driver '%s' (all parameters are optional):\n", desc->name); | |||||
| jack_print_driver_options (desc, stdout); | |||||
| return 1; | |||||
| } | |||||
| /* set up the stuff for getopt */ | |||||
| 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; | |||||
| long_options[i].has_arg = optional_argument; | |||||
| } | |||||
| /* create the params */ | |||||
| optind = 0; | |||||
| opterr = 0; | |||||
| while ((opt = getopt_long(argc, argv, options, long_options, NULL)) != -1) { | |||||
| if (opt == ':' || opt == '?') { | |||||
| if (opt == ':') { | |||||
| fprintf (stderr, "Missing option to argument '%c'\n", optopt); | |||||
| } else { | |||||
| fprintf (stderr, "Unknownage with option '%c'\n", optopt); | |||||
| } | |||||
| fprintf (stderr, "Options for driver '%s':\n", desc->name); | |||||
| jack_print_driver_options (desc, stderr); | |||||
| exit (1); | |||||
| } | |||||
| for (param_index = 0; param_index < desc->nparams; param_index++) { | |||||
| if (opt == desc->params[param_index].character) { | |||||
| break; | |||||
| } | |||||
| } | |||||
| driver_param = calloc (1, sizeof (jack_driver_param_t)); | |||||
| driver_param->character = desc->params[param_index].character; | |||||
| if (!optarg && optind < argc && | |||||
| strlen(argv[optind]) && | |||||
| argv[optind][0] != '-') { | |||||
| optarg = argv[optind]; | |||||
| } | |||||
| if (optarg) { | |||||
| switch (desc->params[param_index].type) { | |||||
| case JackDriverParamInt: | |||||
| driver_param->value.i = atoi (optarg); | |||||
| break; | |||||
| case JackDriverParamUInt: | |||||
| driver_param->value.ui = strtoul (optarg, NULL, 10); | |||||
| break; | |||||
| case JackDriverParamChar: | |||||
| driver_param->value.c = optarg[0]; | |||||
| break; | |||||
| case JackDriverParamString: | |||||
| strncpy (driver_param->value.str, optarg, JACK_DRIVER_PARAM_STRING_MAX); | |||||
| break; | |||||
| case JackDriverParamBool: | |||||
| if (strcasecmp ("false", optarg) == 0 || | |||||
| strcasecmp ("off", optarg) == 0 || | |||||
| strcasecmp ("no", optarg) == 0 || | |||||
| strcasecmp ("0", optarg) == 0 || | |||||
| strcasecmp ("(null)", optarg) == 0 ) { | |||||
| driver_param->value.i = FALSE; | |||||
| } else { | |||||
| driver_param->value.i = TRUE; | |||||
| } | |||||
| break; | |||||
| } | |||||
| } else { | |||||
| if (desc->params[param_index].type == JackDriverParamBool) { | |||||
| driver_param->value.i = TRUE; | |||||
| } else { | |||||
| driver_param->value = desc->params[param_index].value; | |||||
| } | |||||
| } | |||||
| params = jack_slist_append (params, driver_param); | |||||
| } | |||||
| free (options); | |||||
| free (long_options); | |||||
| if (param_ptr) | |||||
| *param_ptr = params; | |||||
| return 0; | |||||
| } | |||||
| #endif /* __jack_driver_parse_h__ */ | |||||
| @@ -1,272 +0,0 @@ | |||||
| /* -*- 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 | |||||
| (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_engine_h__ | |||||
| #define __jack_engine_h__ | |||||
| #include <jack/jack.h> | |||||
| #include <jack/internal.h> | |||||
| #include <jack/driver_interface.h> | |||||
| struct _jack_driver; | |||||
| 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. | |||||
| */ | |||||
| typedef struct { | |||||
| 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; | |||||
| } 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 */ | |||||
| } jack_port_buffer_list_t; | |||||
| typedef struct _jack_reserved_name { | |||||
| jack_client_id_t uuid; | |||||
| char name[JACK_CLIENT_NAME_SIZE]; | |||||
| } jack_reserved_name_t; | |||||
| #define JACKD_WATCHDOG_TIMEOUT 10000 | |||||
| #define JACKD_CLIENT_EVENT_TIMEOUT 2000 | |||||
| /* 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; | |||||
| pthread_t watchdog_thread; | |||||
| int fds[2]; | |||||
| int cleanup_fifo[2]; | |||||
| jack_client_id_t next_client_id; | |||||
| 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_client_id_t fwclient; | |||||
| pthread_t freewheel_thread; | |||||
| char verbose; | |||||
| char do_munlock; | |||||
| const char *server_name; | |||||
| char temporary; | |||||
| int reordered; | |||||
| int watchdog_check; | |||||
| 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; | |||||
| int first_wakeup; | |||||
| #ifdef JACK_USE_MACH_THREADS | |||||
| /* 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; | |||||
| }; | |||||
| /* 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); | |||||
| /* 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); | |||||
| extern jack_timer_type_t clock_source; | |||||
| extern jack_client_internal_t * | |||||
| jack_client_internal_by_id (jack_engine_t *engine, jack_client_id_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_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_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(); } | |||||
| #if 0 | |||||
| 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) { | |||||
| DEBUG ("acquiring graph lock"); | |||||
| pthread_rwlock_wrlock (&engine->client_lock); | |||||
| } | |||||
| static inline int jack_try_rdlock_graph (jack_engine_t *engine) | |||||
| { | |||||
| DEBUG ("TRYING to acquiring graph read lock"); | |||||
| return pthread_rwlock_tryrdlock (&engine->client_lock); | |||||
| } | |||||
| static inline void jack_unlock_graph (jack_engine_t* engine) | |||||
| { | |||||
| DEBUG ("releasing graph lock"); | |||||
| pthread_rwlock_unlock (&engine->client_lock); | |||||
| } | |||||
| #endif | |||||
| static inline unsigned int jack_power_of_two (unsigned int n) | |||||
| { | |||||
| return !(n & (n - 1)); | |||||
| } | |||||
| /* 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); | |||||
| jack_client_internal_t * | |||||
| jack_client_by_name (jack_engine_t *engine, const char *name); | |||||
| int jack_deliver_event (jack_engine_t *, jack_client_internal_t *, jack_event_t *); | |||||
| void jack_stop_watchdog (jack_engine_t * ); | |||||
| void | |||||
| jack_engine_signal_problems (jack_engine_t* engine); | |||||
| int | |||||
| jack_use_driver (jack_engine_t *engine, struct _jack_driver *driver); | |||||
| int | |||||
| jack_drivers_start (jack_engine_t *engine); | |||||
| int | |||||
| jack_add_slave_driver (jack_engine_t *engine, struct _jack_driver *driver); | |||||
| #endif /* __jack_engine_h__ */ | |||||
| @@ -1,65 +0,0 @@ | |||||
| /* | |||||
| 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 | |||||
| (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_hardware_h__ | |||||
| #define __jack_hardware_h__ | |||||
| #include <jack/types.h> | |||||
| typedef enum { | |||||
| AutoSync, | |||||
| WordClock, | |||||
| ClockMaster | |||||
| } SampleClockMode; | |||||
| typedef enum { | |||||
| Cap_HardwareMonitoring = 0x1, | |||||
| Cap_AutoSync = 0x2, | |||||
| Cap_WordClock = 0x4, | |||||
| Cap_ClockMaster = 0x8, | |||||
| Cap_ClockLockReporting = 0x10, | |||||
| Cap_HardwareMetering = 0x20 | |||||
| } Capabilities; | |||||
| struct _jack_hardware; | |||||
| typedef void (*JackHardwareReleaseFunction)(struct _jack_hardware *); | |||||
| typedef int (*JackHardwareSetInputMonitorMaskFunction)(struct _jack_hardware *, unsigned long); | |||||
| typedef int (*JackHardwareChangeSampleClockFunction)(struct _jack_hardware *, SampleClockMode); | |||||
| typedef double (*JackHardwareGetHardwarePeak)(jack_port_t *port, jack_nframes_t frames); | |||||
| typedef double (*JackHardwareGetHardwarePower)(jack_port_t *port, jack_nframes_t frames); | |||||
| typedef struct _jack_hardware { | |||||
| 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; | |||||
| } jack_hardware_t; | |||||
| jack_hardware_t * jack_hardware_new (); | |||||
| #endif /* __jack_hardware_h__ */ | |||||
| @@ -1,561 +0,0 @@ | |||||
| /* -*- mode: c; c-file-style: "bsd"; -*- */ | |||||
| /* | |||||
| Internal shared data and functions. | |||||
| If you edit this file, you should carefully consider changing the | |||||
| 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 | |||||
| (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_internal_h__ | |||||
| #define __jack_internal_h__ | |||||
| #include <stdlib.h> | |||||
| #include <unistd.h> | |||||
| #include <limits.h> | |||||
| #include <dlfcn.h> | |||||
| #include <pthread.h> | |||||
| #include <sys/types.h> | |||||
| #include <sys/time.h> | |||||
| #ifndef POST_PACKED_STRUCTURE | |||||
| #ifdef __GNUC__ | |||||
| /* POST_PACKED_STRUCTURE needs to be a macro which | |||||
| expands into a compiler directive. The directive must | |||||
| tell the compiler to arrange the preceding structure | |||||
| declaration so that it is packed on byte-boundaries rather | |||||
| than use the natural alignment of the processor and/or | |||||
| compiler. | |||||
| */ | |||||
| #define POST_PACKED_STRUCTURE __attribute__((__packed__)) | |||||
| #else | |||||
| /* Add other things here for non-gcc platforms */ | |||||
| #endif | |||||
| #endif | |||||
| /* Needed by <sysdeps/time.h> */ | |||||
| extern void jack_error (const char *fmt, ...); | |||||
| extern void jack_info (const char *fmt, ...); | |||||
| #include <jack/jack.h> | |||||
| #include <jack/types.h> | |||||
| #include <jack/port.h> | |||||
| #include <jack/transport.h> | |||||
| #include <jack/session.h> | |||||
| #include <jack/thread.h> | |||||
| extern jack_thread_creator_t jack_thread_creator; | |||||
| typedef enum { | |||||
| JACK_TIMER_SYSTEM_CLOCK, | |||||
| JACK_TIMER_CYCLE_COUNTER, | |||||
| JACK_TIMER_HPET, | |||||
| } 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> | |||||
| #include <sysdeps/atomicity.h> | |||||
| #ifdef JACK_USE_MACH_THREADS | |||||
| #include <sysdeps/mach_port.h> | |||||
| #endif | |||||
| #include <jack/messagebuffer.h> | |||||
| #ifndef PATH_MAX | |||||
| #ifdef MAXPATHLEN | |||||
| #define PATH_MAX MAXPATHLEN | |||||
| #else | |||||
| #define PATH_MAX 1024 | |||||
| #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() | |||||
| #else /* use our own version */ | |||||
| #include <sys/syscall.h> | |||||
| #define GETTID() syscall(__NR_gettid) | |||||
| #endif | |||||
| #else | |||||
| #define GETTID() getpid() | |||||
| #endif | |||||
| #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...) | |||||
| #else | |||||
| #define DEBUG(format,args...) | |||||
| #endif | |||||
| #endif | |||||
| /* Enable preemption checking for Linux Realtime Preemption kernels. | |||||
| * | |||||
| * This checks if any RT-safe code section does anything to cause CPU | |||||
| * preemption. Examples are sleep() or other system calls that block. | |||||
| * If a problem is detected, the kernel writes a syslog entry, and | |||||
| * sends SIGUSR2 to the client. | |||||
| */ | |||||
| #ifdef DO_PREEMPTION_CHECKING | |||||
| #define CHECK_PREEMPTION(engine, onoff) \ | |||||
| if ((engine)->real_time) gettimeofday (1, (onoff)) | |||||
| #else | |||||
| #define CHECK_PREEMPTION(engine, onoff) | |||||
| #endif | |||||
| #ifndef FALSE | |||||
| #define FALSE (0) | |||||
| #endif | |||||
| #ifndef TRUE | |||||
| #define TRUE (1) | |||||
| #endif | |||||
| 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, | |||||
| } 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 second_order_integrator; | |||||
| volatile int32_t initialized; | |||||
| volatile uint32_t guard2; | |||||
| /* not accessed by clients */ | |||||
| int32_t reset_pending; /* xrun happened, deal with it */ | |||||
| float filter_coefficient; /* 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]; | |||||
| } POST_PACKED_STRUCTURE jack_control_t; | |||||
| typedef enum { | |||||
| BufferSizeChange, | |||||
| SampleRateChange, | |||||
| AttachPortSegment, | |||||
| PortConnected, | |||||
| PortDisconnected, | |||||
| GraphReordered, | |||||
| PortRegistered, | |||||
| PortUnregistered, | |||||
| XRun, | |||||
| StartFreewheel, | |||||
| StopFreewheel, | |||||
| ClientRegistered, | |||||
| ClientUnregistered, | |||||
| SaveSession, | |||||
| LatencyCallback | |||||
| } 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; | |||||
| } x; | |||||
| union { | |||||
| uint32_t n; | |||||
| jack_port_type_id_t ptid; | |||||
| jack_port_id_t other_id; | |||||
| } y; | |||||
| } POST_PACKED_STRUCTURE jack_event_t; | |||||
| typedef enum { | |||||
| ClientInternal, /* connect request just names .so */ | |||||
| ClientDriver, /* code is loaded along with driver */ | |||||
| ClientExternal /* client is in another process */ | |||||
| } ClientType; | |||||
| typedef enum { | |||||
| NotTriggered, | |||||
| Triggered, | |||||
| Running, | |||||
| Finished | |||||
| } jack_client_state_t; | |||||
| /* JACK client shared memory data structure. */ | |||||
| typedef volatile struct { | |||||
| volatile jack_client_id_t id; /* w: engine r: engine and client */ | |||||
| volatile jack_client_id_t uid; /* 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; | |||||
| } 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_client_id_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_shm_registry_index_t client_shm_index; | |||||
| jack_shm_registry_index_t engine_shm_index; | |||||
| char fifo_prefix[PATH_MAX+1]; | |||||
| int32_t realtime; | |||||
| int32_t realtime_priority; | |||||
| 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. | |||||
| */ | |||||
| 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; | |||||
| #endif | |||||
| } POST_PACKED_STRUCTURE jack_client_connect_result_t; | |||||
| typedef struct { | |||||
| jack_client_id_t client_id; | |||||
| } POST_PACKED_STRUCTURE jack_client_connect_ack_request_t; | |||||
| typedef struct { | |||||
| int8_t status; | |||||
| } POST_PACKED_STRUCTURE jack_client_connect_ack_result_t; | |||||
| typedef enum { | |||||
| RegisterPort = 1, | |||||
| UnRegisterPort = 2, | |||||
| ConnectPorts = 3, | |||||
| DisconnectPorts = 4, | |||||
| SetTimeBaseClient = 5, | |||||
| ActivateClient = 6, | |||||
| DeactivateClient = 7, | |||||
| DisconnectPort = 8, | |||||
| SetClientCapabilities = 9, | |||||
| GetPortConnections = 10, | |||||
| GetPortNConnections = 11, | |||||
| ResetTimeBaseClient = 12, | |||||
| SetSyncClient = 13, | |||||
| ResetSyncClient = 14, | |||||
| SetSyncTimeout = 15, | |||||
| SetBufferSize = 16, | |||||
| FreeWheel = 17, | |||||
| StopFreeWheel = 18, | |||||
| IntClientHandle = 19, | |||||
| IntClientLoad = 20, | |||||
| IntClientName = 21, | |||||
| IntClientUnload = 22, | |||||
| RecomputeTotalLatencies = 23, | |||||
| RecomputeTotalLatency = 24, | |||||
| SessionNotify = 25, | |||||
| GetClientByUUID = 26, | |||||
| ReserveName = 30, | |||||
| SessionReply = 31, | |||||
| SessionHasCallback = 32 | |||||
| } 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_client_id_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_client_id_t client_id; | |||||
| int32_t conditional; | |||||
| } POST_PACKED_STRUCTURE timebase; | |||||
| struct { | |||||
| char name[JACK_CLIENT_NAME_SIZE]; | |||||
| jack_client_id_t uuid; | |||||
| } POST_PACKED_STRUCTURE reservename; | |||||
| struct { | |||||
| //jack_options_t options; | |||||
| uint32_t options; | |||||
| jack_client_id_t id; | |||||
| char name[JACK_CLIENT_NAME_SIZE]; | |||||
| char path[PATH_MAX+1]; | |||||
| char init[JACK_LOAD_INIT_LIMIT]; | |||||
| } POST_PACKED_STRUCTURE intclient; | |||||
| jack_client_id_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. | |||||
| * It's here because its not part of the engine structure. | |||||
| */ | |||||
| 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; | |||||
| #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; | |||||
| } jack_client_internal_t; | |||||
| typedef struct _jack_thread_arg { | |||||
| jack_client_t* client; | |||||
| void* (*work_function)(void*); | |||||
| int priority; | |||||
| int realtime; | |||||
| void* 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*); | |||||
| /* internal clients call this. it's defined in jack/engine.c */ | |||||
| void handle_internal_client_request (jack_control_t*, jack_request_t*); | |||||
| extern char *jack_tmpdir; | |||||
| extern char *jack_user_dir (void); | |||||
| extern char *jack_server_dir (const char *server_name, char *server_dir); | |||||
| extern void *jack_zero_filled_buffer; | |||||
| 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_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 char *jack_default_server_name (void); | |||||
| 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_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. | |||||
| */ | |||||
| 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); | |||||
| #ifdef __GNUC__ | |||||
| # define likely(x) __builtin_expect((x),1) | |||||
| # define unlikely(x) __builtin_expect((x),0) | |||||
| #else | |||||
| # 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)) | |||||
| #else | |||||
| #define VALGRIND_MEMSET(ptr,val,size) | |||||
| #endif | |||||
| #endif /* __jack_internal_h__ */ | |||||
| @@ -1,56 +0,0 @@ | |||||
| /* | |||||
| 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__ | |||||
| #ifdef USE_DYNSIMD | |||||
| #if (defined(__i386__) || defined(__x86_64__)) | |||||
| #define ARCH_X86 | |||||
| #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)) | |||||
| 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); | |||||
| #endif /* ARCH_X86 */ | |||||
| void jack_port_set_funcs (void); | |||||
| #endif /* __jack_intsimd_h__ */ | |||||
| @@ -1,115 +0,0 @@ | |||||
| /* | |||||
| 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 | |||||
| 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_memops_h__ | |||||
| #define __jack_memops_h__ | |||||
| #include <jack/types.h> | |||||
| typedef enum { | |||||
| None, | |||||
| Rectangular, | |||||
| Triangular, | |||||
| Shaped | |||||
| } DitherAlgorithm; | |||||
| #define DITHER_BUF_SIZE 8 | |||||
| #define DITHER_BUF_MASK 7 | |||||
| typedef struct { | |||||
| 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); | |||||
| /* 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); | |||||
| static __inline__ void | |||||
| sample_merge (jack_default_audio_sample_t *dst, jack_default_audio_sample_t *src, unsigned long cnt) | |||||
| { | |||||
| while (cnt--) { | |||||
| *dst += *src; | |||||
| dst++; | |||||
| src++; | |||||
| } | |||||
| } | |||||
| 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)); | |||||
| } | |||||
| 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 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); | |||||
| #endif /* __jack_memops_h__ */ | |||||
| @@ -1,44 +0,0 @@ | |||||
| /* | |||||
| * messagebuffer.h -- realtime-safe message interface for jackd. | |||||
| * | |||||
| * This function is included in libjack so backend drivers can use | |||||
| * it, *not* for external client processes. The VERBOSE() and | |||||
| * MESSAGE() macros are realtime-safe. | |||||
| */ | |||||
| /* | |||||
| * 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 | |||||
| * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||||
| * | |||||
| */ | |||||
| #ifndef __jack_messagebuffer_h__ | |||||
| #define __jack_messagebuffer_h__ | |||||
| #define MESSAGE(fmt,args...) jack_messagebuffer_add(fmt , ##args) | |||||
| #define VERBOSE(engine,fmt,args...) \ | |||||
| if ((engine)->verbose) \ | |||||
| 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_messagebuffer_add(const char *fmt, ...); | |||||
| void jack_messagebuffer_thread_init (void (*cb)(void*), void* arg); | |||||
| #endif /* __jack_messagebuffer_h__ */ | |||||
| @@ -1,28 +0,0 @@ | |||||
| /* | |||||
| 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 | |||||
| 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 *); | |||||
| #endif /* __jack_pool_h__ */ | |||||
| @@ -1,188 +0,0 @@ | |||||
| /* | |||||
| 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 | |||||
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||||
| */ | |||||
| #ifndef __jack_port_h__ | |||||
| #define __jack_port_h__ | |||||
| #include <pthread.h> | |||||
| #include <jack/types.h> | |||||
| #include <jack/jslist.h> | |||||
| #include <jack/shm.h> | |||||
| #define JACK_PORT_NAME_SIZE 256 | |||||
| #define JACK_PORT_TYPE_SIZE 32 | |||||
| /* The relatively low value of this constant reflects the fact that | |||||
| * JACK currently only knows about *2* port types. (May 2006) | |||||
| * | |||||
| * Further, the 4 covers: | |||||
| * - a single non-negotiated audio format | |||||
| * - music data (ie. MIDI) | |||||
| * - video | |||||
| * - 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 | |||||
| /* these should probably go somewhere else, but not in <jack/types.h> */ | |||||
| #define JACK_CLIENT_NAME_SIZE 33 | |||||
| typedef uint32_t jack_client_id_t; | |||||
| /* JACK shared memory segments are limited to MAX_INT32, they can be | |||||
| * 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" | |||||
| #ifndef POST_PACKED_STRUCTURE | |||||
| #ifdef __GNUC__ | |||||
| /* POST_PACKED_STRUCTURE needs to be a macro which | |||||
| expands into a compiler directive. The directive must | |||||
| tell the compiler to arrange the preceding structure | |||||
| declaration so that it is packed on byte-boundaries rather | |||||
| than use the natural alignment of the processor and/or | |||||
| compiler. | |||||
| */ | |||||
| #define POST_PACKED_STRUCTURE __attribute__((__packed__)) | |||||
| #else | |||||
| /* Add other things here for non-gcc platforms */ | |||||
| #endif | |||||
| #endif | |||||
| /* Port type structure. | |||||
| * | |||||
| * (1) One for each port type is part of the engine's jack_control_t | |||||
| * shared memory structure. | |||||
| * | |||||
| * (2) One for each port type is appended to the engine's | |||||
| * jack_client_connect_result_t response. The client reads them into | |||||
| * its local memory, using them to attach the corresponding shared | |||||
| * memory segments. | |||||
| */ | |||||
| typedef struct _jack_port_type_info { | |||||
| 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; | |||||
| /* ignored unless buffer_scale_factor is < 0. see above */ | |||||
| jack_shmsize_t buffer_size; | |||||
| jack_shm_registry_index_t shm_registry_index; | |||||
| 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 */ | |||||
| 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_client_id_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 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; | |||||
| /** | |||||
| * Get port functions. | |||||
| * @param ptid port type id. | |||||
| * | |||||
| * @return pointer to port type functions or NULL if port type is unknown. | |||||
| */ | |||||
| /*const*/ jack_port_functions_t * | |||||
| 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; | |||||
| }; | |||||
| /* Inline would be cleaner, but it needs to be fast even in | |||||
| * non-optimized code. jack_output_port_buffer() only handles output | |||||
| * 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)) | |||||
| #define jack_output_port_buffer(p) \ | |||||
| ((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); | |||||
| #endif /* __jack_port_h__ */ | |||||
| @@ -1,22 +0,0 @@ | |||||
| #ifndef __jack_sanitycheck_h__ | |||||
| #define __jack_sanitycheck_h__ | |||||
| /** | |||||
| * GPL etc. | |||||
| * | |||||
| * @author Florian Faber | |||||
| * | |||||
| * @version 0.1 (2009-01-17) [FF] | |||||
| * - initial version | |||||
| **/ | |||||
| /** | |||||
| * Performs a range of sanity checks on the system. The number of | |||||
| * found problems is returned. | |||||
| * | |||||
| **/ | |||||
| int sanitycheck (int do_realtime_check, | |||||
| int do_freqscaling_check); | |||||
| #endif /* __jack_sanitycheck_h__ */ | |||||
| @@ -1,110 +0,0 @@ | |||||
| #ifndef __jack_shm_h__ | |||||
| #define __jack_shm_h__ | |||||
| #include <limits.h> | |||||
| #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 */ | |||||
| /* On Mac OS X, SHM_NAME_MAX is the maximum length of a shared memory | |||||
| * segment name (instead of NAME_MAX or PATH_MAX as defined by the | |||||
| * standard). | |||||
| */ | |||||
| #ifdef USE_POSIX_SHM | |||||
| #ifndef SHM_NAME_MAX | |||||
| #define SHM_NAME_MAX NAME_MAX | |||||
| #endif | |||||
| 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; | |||||
| #endif /* SHM type */ | |||||
| /* shared memory type */ | |||||
| typedef enum { | |||||
| 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 | |||||
| * address spaces. | |||||
| * | |||||
| * The registry consists of two parts: a header including an array of | |||||
| * 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]; | |||||
| } 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 */ | |||||
| } 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_t; | |||||
| #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 | |||||
| * indicating where the shared memory has been | |||||
| * 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_info_t; | |||||
| /* utility functions used only within JACK */ | |||||
| 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_release_shm_info (jack_shm_registry_index_t); | |||||
| 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_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); | |||||
| #endif /* __jack_shm_h__ */ | |||||
| @@ -1,21 +0,0 @@ | |||||
| /* | |||||
| Copyright (C) 2002 Fernando Lopez-Lezcano | |||||
| 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. | |||||
| */ | |||||
| #define PIPE_READ_FD (3) | |||||
| #define PIPE_WRITE_FD (4) | |||||
| @@ -1,97 +0,0 @@ | |||||
| #ifndef __jack_systemtest_h__ | |||||
| #define __jack_systemtest_h__ | |||||
| /** | |||||
| * 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 | |||||
| * | |||||
| **/ | |||||
| /** | |||||
| * 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. | |||||
| **/ | |||||
| int system_has_frequencyscaling(); | |||||
| /** | |||||
| * 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 | |||||
| **/ | |||||
| int system_uses_frequencyscaling(); | |||||
| /*** | |||||
| * Checks for a definition in /etc/security/limits.conf that looks | |||||
| * as if it allows RT scheduling priority. | |||||
| * | |||||
| * @returns 1 if there appears to be such a line | |||||
| **/ | |||||
| int system_has_rtprio_limits_conf (); | |||||
| /** | |||||
| * Checks for the existence of the 'audio' group on this system | |||||
| * | |||||
| * @returns 0 is there is no 'audio' group, non-0 otherwise | |||||
| **/ | |||||
| int system_has_audiogroup(); | |||||
| /** | |||||
| * Tests wether the owner of this process is in the 'audio' group. | |||||
| * | |||||
| * @returns 0 if the owner of this process is not in the audio group, non-0 otherwise | |||||
| **/ | |||||
| int system_user_in_audiogroup(); | |||||
| /** | |||||
| * Determines wether the owner of this process can enable rt priority. | |||||
| * | |||||
| * @returns 0 if this process can not be switched to rt prio, non-0 otherwise | |||||
| **/ | |||||
| int system_user_can_rtprio(); | |||||
| long long unsigned int system_memlock_amount(); | |||||
| /** | |||||
| * Checks wether the memlock limit is unlimited | |||||
| * | |||||
| * @returns 0 if the memlock limit is limited, non-0 otherwise | |||||
| **/ | |||||
| int system_memlock_is_unlimited(); | |||||
| long long unsigned int system_available_physical_mem(); | |||||
| /** | |||||
| * Gets the version of the currently running kernel | |||||
| * | |||||
| * @returns String with the full version of the kernel | |||||
| **/ | |||||
| char* system_kernel_version(); | |||||
| /** | |||||
| * Returns the username. The caller is in charge of disposal of | |||||
| * the returned name. | |||||
| * | |||||
| * @returns Pointer to a username or NULL | |||||
| **/ | |||||
| char* system_get_username(); | |||||
| #endif /* __jack_systemtest_h__ */ | |||||
| @@ -1,26 +0,0 @@ | |||||
| /* -*- 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 | |||||
| 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); | |||||
| #endif /* __jack_mlock_h__ */ | |||||
| @@ -1,65 +0,0 @@ | |||||
| /* | |||||
| * 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 | |||||
| * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||||
| * | |||||
| */ | |||||
| #ifndef __jack_varargs_h__ | |||||
| #define __jack_varargs_h__ | |||||
| #ifdef __cplusplus | |||||
| extern "C" { | |||||
| #endif | |||||
| /* variable argument structure */ | |||||
| typedef struct { | |||||
| char *server_name; /* server name */ | |||||
| char *load_name; /* load module name */ | |||||
| char *load_init; /* initialization string */ | |||||
| char *sess_uuid; | |||||
| } jack_varargs_t; | |||||
| static inline void | |||||
| jack_varargs_init (jack_varargs_t *va) | |||||
| { | |||||
| memset (va, 0, sizeof(jack_varargs_t)); | |||||
| va->server_name = jack_default_server_name (); | |||||
| } | |||||
| static inline void | |||||
| jack_varargs_parse (jack_options_t options, va_list ap, jack_varargs_t *va) | |||||
| { | |||||
| /* initialize default settings */ | |||||
| jack_varargs_init (va); | |||||
| if ((options & JackServerName)) { | |||||
| 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 *); | |||||
| } | |||||
| #ifdef __cplusplus | |||||
| } | |||||
| #endif | |||||
| #endif /* __jack_varargs_h__ */ | |||||