Jack2
1.9.8
|
00001 /* 00002 Copyright (C) 2003 Bob Ham <rah@bash.sh> 00003 Copyright (C) 2008 Nedko Arnaudov <nedko@arnaudov.name> 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU Lesser General Public License as published by 00007 the Free Software Foundation; either version 2.1 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 00019 */ 00020 00021 #ifndef __jack_driver_interface_h__ 00022 #define __jack_driver_interface_h__ 00023 00024 #ifdef __cplusplus 00025 extern "C" 00026 { 00027 #endif 00028 00029 #include <limits.h> 00030 #include "jslist.h" 00031 #include "JackCompilerDeps.h" 00032 #include "JackSystemDeps.h" 00033 00034 #define JACK_DRIVER_NAME_MAX 15 00035 #define JACK_DRIVER_PARAM_NAME_MAX 15 00036 #define JACK_DRIVER_PARAM_STRING_MAX 127 00037 #define JACK_DRIVER_PARAM_DESC 255 00038 #define JACK_PATH_MAX 511 00039 00040 #define JACK_CONSTRAINT_FLAG_RANGE ((uint32_t)1) 00041 #define JACK_CONSTRAINT_FLAG_STRICT ((uint32_t)2) 00042 #define JACK_CONSTRAINT_FLAG_FAKE_VALUE ((uint32_t)4) 00045 typedef enum 00046 { 00047 JackDriverParamInt = 1, 00048 JackDriverParamUInt, 00049 JackDriverParamChar, 00050 JackDriverParamString, 00051 JackDriverParamBool 00052 } jack_driver_param_type_t; 00053 00055 typedef enum 00056 { 00057 JackDriverMaster = 1, 00058 JackDriverSlave, 00059 JackDriverNone, 00060 } jack_driver_type_t; 00061 00063 typedef union 00064 { 00065 uint32_t ui; 00066 int32_t i; 00067 char c; 00068 char str[JACK_DRIVER_PARAM_STRING_MAX + 1]; 00069 } jack_driver_param_value_t; 00070 00071 typedef struct { 00072 jack_driver_param_value_t value; 00073 char short_desc[64]; 00074 } jack_driver_param_value_enum_t; 00075 00076 typedef struct { 00077 uint32_t flags; 00079 union { 00080 struct { 00081 jack_driver_param_value_t min; 00082 jack_driver_param_value_t max; 00083 } range; 00085 struct { 00086 uint32_t count; 00087 jack_driver_param_value_enum_t * possible_values_array; 00088 } enumeration; 00089 } constraint; 00090 } jack_driver_param_constraint_desc_t; 00091 00093 typedef struct { 00094 char name[JACK_DRIVER_NAME_MAX + 1]; 00095 char character; 00096 jack_driver_param_type_t type; 00097 jack_driver_param_value_t value; 00098 jack_driver_param_constraint_desc_t * constraint; 00099 char short_desc[64]; 00100 char long_desc[1024]; 00101 } 00102 jack_driver_param_desc_t; 00103 00105 typedef struct { 00106 char character; 00107 jack_driver_param_value_t value; 00108 } 00109 jack_driver_param_t; 00110 00112 typedef struct { 00113 char name[JACK_DRIVER_NAME_MAX + 1]; 00114 jack_driver_type_t type; 00115 char desc[JACK_DRIVER_PARAM_DESC + 1]; 00116 char file[JACK_PATH_MAX + 1]; 00117 uint32_t nparams; 00118 jack_driver_param_desc_t * params; 00119 } 00120 jack_driver_desc_t; 00121 00122 typedef struct { 00123 uint32_t size; /* size of the param array, in elements */ 00124 } 00125 jack_driver_desc_filler_t; 00126 00127 SERVER_EXPORT int jack_parse_driver_params(jack_driver_desc_t * desc, int argc, char* argv[], JSList ** param_ptr); 00128 00129 SERVER_EXPORT jack_driver_desc_t * /* newlly allocated driver descriptor, NULL on failure */ 00130 jack_driver_descriptor_construct( 00131 const char * name, /* driver name */ 00132 jack_driver_type_t type, /* driver type */ 00133 const char * description, /* driver description */ 00134 jack_driver_desc_filler_t * filler); /* Pointer to stack var to be supplied to jack_driver_descriptor_add_parameter() as well. 00135 Can be NULL for drivers that have no parameters. */ 00136 00137 SERVER_EXPORT int /* 0 on failure */ 00138 jack_driver_descriptor_add_parameter( 00139 jack_driver_desc_t * driver_descr, /* pointer to driver descriptor as returned by jack_driver_descriptor_construct() */ 00140 jack_driver_desc_filler_t * filler, /* Pointer to the stack var that was supplied to jack_driver_descriptor_add_parameter(). */ 00141 const char * name, /* parameter's name */ 00142 char character, /* parameter's character (for getopt, etc) */ 00143 jack_driver_param_type_t type, /* The parameter's type */ 00144 const jack_driver_param_value_t * value_ptr, /* Pointer to parameter's (default) value */ 00145 jack_driver_param_constraint_desc_t * constraint, /* Pointer to parameter constraint descriptor. NULL if there is no constraint */ 00146 const char * short_desc, /* A short (~30 chars) description for the user */ 00147 const char * long_desc); /* A longer description for the user, if NULL short_desc will be used */ 00148 00149 #ifdef __cplusplus 00150 } 00151 #endif 00152 00153 #endif /* __jack_driver_interface_h__ */ 00154 00155