summaryrefslogtreecommitdiff
path: root/include/driver_interface.h
blob: 2cd0d15c77548a6fb31138558bb2010ab1f55c7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
    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 "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__ */