File: params.h

package info (click to toggle)
jackd2 1.9.22~dfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,984 kB
  • sloc: cpp: 48,694; ansic: 23,970; python: 13,621; sh: 228; makefile: 31
file content (111 lines) | stat: -rw-r--r-- 4,029 bytes parent folder | download | duplicates (8)
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
/* -*- Mode: C ; c-basic-offset: 4 -*- */
/*
    Copyright (C) 2011 Nedko Arnaudov

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License.

    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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#ifndef PARAMS_H__A23EDE06_C1C9_4489_B253_FD1B26B66929__INCLUDED
#define PARAMS_H__A23EDE06_C1C9_4489_B253_FD1B26B66929__INCLUDED

#include "jack/control.h"
#include "list.h"

#define PARAM_ADDRESS_SIZE 3

#define PTNODE_ENGINE    "engine"
#define PTNODE_DRIVER    "driver"
#define PTNODE_DRIVERS   "drivers"
#define PTNODE_INTERNALS "internals"

struct jack_parameter_vtable
{
    bool                          (* is_set)(void * obj);
    bool                          (* reset)(void * obj);
    union jackctl_parameter_value (* get_value)(void * obj);
    bool                          (* set_value)(void * obj, const union jackctl_parameter_value * value_ptr);
    union jackctl_parameter_value (* get_default_value)(void * obj);
};

#define JACK_CONSTRAINT_FLAG_VALID       ((uint32_t)1) /**< if not set, there is no constraint */
#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 */

struct jack_parameter_enum
{
    union jackctl_parameter_value value;
    const char * short_desc;
};

struct jack_parameter
{
    void * obj;
    struct jack_parameter_vtable vtable;
    struct list_head siblings;
    bool ext;
    jackctl_param_type_t type;
    const char * name;
    const char * short_decr;
    const char * long_descr;

    uint32_t constraint_flags;  /**< JACK_CONSTRAINT_FLAG_XXX */
    bool constraint_range; /**< if true, constraint is a range (min-max), otherwise it is an enumeration */

    union
    {
        struct
        {
            union jackctl_parameter_value min;
            union jackctl_parameter_value max;
        } range; /**< valid when JACK_CONSTRAINT_FLAG_RANGE flag is set */

        struct
        {
            uint32_t count;
            struct jack_parameter_enum * possible_values_array;
        } enumeration; /**< valid when JACK_CONSTRAINT_FLAG_RANGE flag is not set */
    } constraint;
};

typedef struct _jack_params { int unused; } * jack_params_handle;

jack_params_handle jack_params_create(jackctl_server_t * server);
void jack_params_destroy(jack_params_handle params);

bool jack_params_set_driver(jack_params_handle params, const char * name);
jackctl_driver_t * jack_params_get_driver(jack_params_handle params);

bool jack_params_check_address(jack_params_handle params, const char * const * address, bool want_leaf);
bool jack_params_is_leaf_container(jack_params_handle params, const char * const * address);

bool
jack_params_iterate_container(
    jack_params_handle params,
    const char * const * address,
    bool (* callback)(void * context, const char * name),
    void * context);

bool
jack_params_iterate_params(
    jack_params_handle params,
    const char * const * address,
    bool (* callback)(void * context, const struct jack_parameter * param_ptr),
    void * context);

const struct jack_parameter * jack_params_get_parameter(jack_params_handle params, const char * const * address);

void jack_params_add_parameter(jack_params_handle params, const char * const * address, bool end, struct jack_parameter * param_ptr);

#endif /* #ifndef PARAMS_H__A23EDE06_C1C9_4489_B253_FD1B26B66929__INCLUDED */