Jack2  1.9.8
driver_interface.h
1 /*
2  Copyright (C) 2003 Bob Ham <rah@bash.sh>
3  Copyright (C) 2008 Nedko Arnaudov <nedko@arnaudov.name>
4 
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.
9 
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.
14 
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.
18 
19 */
20 
21 #ifndef __jack_driver_interface_h__
22 #define __jack_driver_interface_h__
23 
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28 
29 #include <limits.h>
30 #include "jslist.h"
31 #include "JackCompilerDeps.h"
32 #include "JackSystemDeps.h"
33 
34 #define JACK_DRIVER_NAME_MAX 15
35 #define JACK_DRIVER_PARAM_NAME_MAX 15
36 #define JACK_DRIVER_PARAM_STRING_MAX 127
37 #define JACK_DRIVER_PARAM_DESC 255
38 #define JACK_PATH_MAX 511
39 
40 #define JACK_CONSTRAINT_FLAG_RANGE ((uint32_t)1)
41 #define JACK_CONSTRAINT_FLAG_STRICT ((uint32_t)2)
42 #define JACK_CONSTRAINT_FLAG_FAKE_VALUE ((uint32_t)4)
45 typedef enum
46 {
47  JackDriverParamInt = 1,
48  JackDriverParamUInt,
49  JackDriverParamChar,
50  JackDriverParamString,
51  JackDriverParamBool
52 } jack_driver_param_type_t;
53 
55 typedef enum
56 {
57  JackDriverMaster = 1,
58  JackDriverSlave,
59  JackDriverNone,
60 } jack_driver_type_t;
61 
63 typedef union
64 {
65  uint32_t ui;
66  int32_t i;
67  char c;
68  char str[JACK_DRIVER_PARAM_STRING_MAX + 1];
70 
71 typedef struct {
73  char short_desc[64];
75 
76 typedef struct {
77  uint32_t flags;
79  union {
80  struct {
83  } range;
85  struct {
86  uint32_t count;
87  jack_driver_param_value_enum_t * possible_values_array;
88  } enumeration;
89  } constraint;
91 
93 typedef struct {
94  char name[JACK_DRIVER_NAME_MAX + 1];
95  char character;
96  jack_driver_param_type_t type;
99  char short_desc[64];
100  char long_desc[1024];
101 }
103 
105 typedef struct {
106  char character;
108 }
110 
112 typedef struct {
113  char name[JACK_DRIVER_NAME_MAX + 1];
114  jack_driver_type_t type;
115  char desc[JACK_DRIVER_PARAM_DESC + 1];
116  char file[JACK_PATH_MAX + 1];
117  uint32_t nparams;
119 }
121 
122 typedef struct {
123  uint32_t size; /* size of the param array, in elements */
124 }
126 
127 SERVER_EXPORT int jack_parse_driver_params(jack_driver_desc_t * desc, int argc, char* argv[], JSList ** param_ptr);
128 
129 SERVER_EXPORT jack_driver_desc_t * /* newlly allocated driver descriptor, NULL on failure */
130 jack_driver_descriptor_construct(
131  const char * name, /* driver name */
132  jack_driver_type_t type, /* driver type */
133  const char * description, /* driver description */
134  jack_driver_desc_filler_t * filler); /* Pointer to stack var to be supplied to jack_driver_descriptor_add_parameter() as well.
135  Can be NULL for drivers that have no parameters. */
136 
137 SERVER_EXPORT int /* 0 on failure */
138 jack_driver_descriptor_add_parameter(
139  jack_driver_desc_t * driver_descr, /* pointer to driver descriptor as returned by jack_driver_descriptor_construct() */
140  jack_driver_desc_filler_t * filler, /* Pointer to the stack var that was supplied to jack_driver_descriptor_add_parameter(). */
141  const char * name, /* parameter's name */
142  char character, /* parameter's character (for getopt, etc) */
143  jack_driver_param_type_t type, /* The parameter's type */
144  const jack_driver_param_value_t * value_ptr, /* Pointer to parameter's (default) value */
145  jack_driver_param_constraint_desc_t * constraint, /* Pointer to parameter constraint descriptor. NULL if there is no constraint */
146  const char * short_desc, /* A short (~30 chars) description for the user */
147  const char * long_desc); /* A longer description for the user, if NULL short_desc will be used */
148 
149 #ifdef __cplusplus
150 }
151 #endif
152 
153 #endif /* __jack_driver_interface_h__ */
154 
155