Aggregate device code added to JackCoreAudioAdapter.
[jack2.git] / common / driver_interface.h
blobd336f41364447253ed9f636a99948136461293e2
1 /*
2 Copyright (C) 2003 Bob Ham <rah@bash.sh>
3 Copyright (C) 2008 Nedko Arnaudov <nedko@arnaudov.name>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #ifndef __jack_driver_interface_h__
22 #define __jack_driver_interface_h__
24 #ifdef __cplusplus
25 extern "C"
27 #endif
29 #include <limits.h>
30 #include "jslist.h"
31 #include "JackCompilerDeps.h"
32 #include "JackSystemDeps.h"
34 #define JACK_DRIVER_NAME_MAX 15
35 #define JACK_DRIVER_PARAM_NAME_MAX 15
36 #define JACK_DRIVER_PARAM_STRING_MAX 63
37 #define JACK_DRIVER_PARAM_DESC 255
38 #define JACK_PATH_MAX 511
40 #define JACK_CONSTRAINT_FLAG_RANGE ((uint32_t)1) /**< if set, constraint is a range (min-max) */
41 #define JACK_CONSTRAINT_FLAG_STRICT ((uint32_t)2) /**< if set, constraint is strict, i.e. supplying non-matching value will not work */
42 #define JACK_CONSTRAINT_FLAG_FAKE_VALUE ((uint32_t)4) /**< if set, values have no user meaningful meaning */
44 /** Driver parameter types */
45 typedef enum
47 JackDriverParamInt = 1,
48 JackDriverParamUInt,
49 JackDriverParamChar,
50 JackDriverParamString,
51 JackDriverParamBool
52 } jack_driver_param_type_t;
54 /** Driver parameter value */
55 typedef union
57 uint32_t ui;
58 int32_t i;
59 char c;
60 char str[JACK_DRIVER_PARAM_STRING_MAX + 1];
61 } jack_driver_param_value_t;
63 typedef struct {
64 jack_driver_param_value_t value;
65 char short_desc[64]; /**< A short (~30 chars) description for the user */
66 } jack_driver_param_value_enum_t;
68 typedef struct {
69 uint32_t flags; /**< JACK_CONSTRAINT_FLAG_XXX */
71 union {
72 struct {
73 jack_driver_param_value_t min;
74 jack_driver_param_value_t max;
75 } range; /**< valid when JACK_CONSTRAINT_FLAG_RANGE flag is set */
77 struct {
78 uint32_t count;
79 jack_driver_param_value_enum_t * possible_values_array;
80 } enumeration; /**< valid when JACK_CONSTRAINT_FLAG_RANGE flag is not set */
81 } constraint;
82 } jack_driver_param_constraint_desc_t;
84 /** A driver parameter descriptor */
85 typedef struct {
86 char name[JACK_DRIVER_NAME_MAX + 1]; /**< The parameter's name */
87 char character; /**< The parameter's character (for getopt, etc) */
88 jack_driver_param_type_t type; /**< The parameter's type */
89 jack_driver_param_value_t value; /**< The parameter's (default) value */
90 jack_driver_param_constraint_desc_t * constraint; /**< Pointer to parameter constraint descriptor. NULL if there is no constraint */
91 char short_desc[64]; /**< A short (~30 chars) description for the user */
92 char long_desc[1024]; /**< A longer description for the user */
94 jack_driver_param_desc_t;
96 /** A driver parameter */
97 typedef struct {
98 char character;
99 jack_driver_param_value_t value;
101 jack_driver_param_t;
104 /** A struct for describing a jack driver */
105 typedef struct {
106 char name[JACK_DRIVER_NAME_MAX + 1]; /**< The driver's canonical name */
107 char desc[JACK_DRIVER_PARAM_DESC + 1]; /**< The driver's extended description */
108 char file[JACK_PATH_MAX + 1]; /**< The filename of the driver's shared object file */
109 uint32_t nparams; /**< The number of parameters the driver has */
110 jack_driver_param_desc_t * params; /**< An array of parameter descriptors */
112 jack_driver_desc_t;
115 SERVER_EXPORT int jack_parse_driver_params (jack_driver_desc_t * desc, int argc, char* argv[], JSList ** param_ptr);
117 #ifdef __cplusplus
119 #endif
121 #endif /* __jack_driver_interface_h__ */