1 /* -*- Mode: C ; c-basic-offset: 4 -*- */
3 Copyright (C) 2011 Nedko Arnaudov
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef PARAMS_H__A23EDE06_C1C9_4489_B253_FD1B26B66929__INCLUDED
21 #define PARAMS_H__A23EDE06_C1C9_4489_B253_FD1B26B66929__INCLUDED
23 #include "jack/control.h"
26 #define PARAM_ADDRESS_SIZE 3
28 #define PTNODE_ENGINE "engine"
29 #define PTNODE_DRIVER "driver"
30 #define PTNODE_DRIVERS "drivers"
31 #define PTNODE_INTERNALS "internals"
33 struct jack_parameter_vtable
35 bool (* is_set
)(void * obj
);
36 bool (* reset
)(void * obj
);
37 union jackctl_parameter_value (* get_value
)(void * obj
);
38 bool (* set_value
)(void * obj
, const union jackctl_parameter_value
* value_ptr
);
39 union jackctl_parameter_value (* get_default_value
)(void * obj
);
42 #define JACK_CONSTRAINT_FLAG_VALID ((uint32_t)1) /**< if not set, there is no constraint */
43 #define JACK_CONSTRAINT_FLAG_STRICT ((uint32_t)2) /**< if set, constraint is strict, i.e. supplying non-matching value will not work */
44 #define JACK_CONSTRAINT_FLAG_FAKE_VALUE ((uint32_t)4) /**< if set, values have no user meaningful meaning */
46 struct jack_parameter_enum
48 union jackctl_parameter_value value
;
49 const char * short_desc
;
55 struct jack_parameter_vtable vtable
;
56 struct list_head siblings
;
58 jackctl_param_type_t type
;
60 const char * short_decr
;
61 const char * long_descr
;
63 uint32_t constraint_flags
; /**< JACK_CONSTRAINT_FLAG_XXX */
64 bool constraint_range
; /**< if true, constraint is a range (min-max), otherwise it is an enumeration */
70 union jackctl_parameter_value min
;
71 union jackctl_parameter_value max
;
72 } range
; /**< valid when JACK_CONSTRAINT_FLAG_RANGE flag is set */
77 struct jack_parameter_enum
* possible_values_array
;
78 } enumeration
; /**< valid when JACK_CONSTRAINT_FLAG_RANGE flag is not set */
82 typedef struct _jack_params
{ int unused
; } * jack_params_handle
;
84 jack_params_handle
jack_params_create(jackctl_server_t
* server
);
85 void jack_params_destroy(jack_params_handle params
);
87 bool jack_params_set_driver(jack_params_handle params
, const char * name
);
88 jackctl_driver_t
* jack_params_get_driver(jack_params_handle params
);
90 bool jack_params_check_address(jack_params_handle params
, const char * const * address
, bool want_leaf
);
91 bool jack_params_is_leaf_container(jack_params_handle params
, const char * const * address
);
94 jack_params_iterate_container(
95 jack_params_handle params
,
96 const char * const * address
,
97 bool (* callback
)(void * context
, const char * name
),
101 jack_params_iterate_params(
102 jack_params_handle params
,
103 const char * const * address
,
104 bool (* callback
)(void * context
, const struct jack_parameter
* param_ptr
),
107 const struct jack_parameter
* jack_params_get_parameter(jack_params_handle params
, const char * const * address
);
109 void jack_params_add_parameter(jack_params_handle params
, const char * const * address
, bool end
, struct jack_parameter
* param_ptr
);
111 #endif /* #ifndef PARAMS_H__A23EDE06_C1C9_4489_B253_FD1B26B66929__INCLUDED */