Jack2: control.h Source File

Jack2 1.9.21

control.h
Go to the documentation of this file.
1/* -*- Mode: C ; c-basic-offset: 4 -*- */
2/*
3 JACK control API
4
5 Copyright (C) 2008 Nedko Arnaudov
6 Copyright (C) 2008 GRAME
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; version 2 of the License.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
21*/
29#ifndef JACKCTL_H__2EEDAD78_DF4C_4B26_83B7_4FF1A446A47E__INCLUDED
30#define JACKCTL_H__2EEDAD78_DF4C_4B26_83B7_4FF1A446A47E__INCLUDED
31
32#include <jack/types.h>
33#include <jack/jslist.h>
34#include <jack/systemdeps.h>
35#if !defined(sun) && !defined(__sun__)
36#include <stdbool.h>
37#endif
38
40 typedef enum
41{
42 JackParamInt = 1,
43 JackParamUInt,
44 JackParamChar,
45 JackParamString,
46 JackParamBool,
47} jackctl_param_type_t;
48
50 typedef enum
51{
52 JackMaster = 1,
53 JackSlave
54} jackctl_driver_type_t;
55
57#define JACK_PARAM_MAX (JackParamBool + 1)
58
60#define JACK_PARAM_STRING_MAX 127
61
63/* intentionally similar to jack_driver_param_value_t */
64 union jackctl_parameter_value
65{
66 uint32_t ui;
67 int32_t i;
68 char c;
69 char str[JACK_PARAM_STRING_MAX + 1];
70 bool b;
71};
72
74 typedef struct jackctl_server jackctl_server_t;
75
77 typedef struct jackctl_driver jackctl_driver_t;
78
80 typedef struct jackctl_internal jackctl_internal_t;
81
83 typedef struct jackctl_parameter jackctl_parameter_t;
84
86 typedef struct jackctl_sigmask jackctl_sigmask_t;
87
88#ifdef __cplusplus
89extern "C" {
90#endif
91#if 0
92} /* Adjust editor indent */
93#endif
94
109 jackctl_sigmask_t *
110jackctl_setup_signals(
111 unsigned int flags);
112
118void
119jackctl_wait_signals(
120 jackctl_sigmask_t * signals);
121
128 jackctl_server_t *
129jackctl_server_create(
130 bool (* on_device_acquire)(const char * device_name),
131 void (* on_device_release)(const char * device_name));
132
144 jackctl_server_t *
145jackctl_server_create2(
146 bool (* on_device_acquire)(const char * device_name),
147 void (* on_device_release)(const char * device_name),
148 void (* on_device_reservation_loop)(void));
149
155void
156jackctl_server_destroy(
157 jackctl_server_t * server);
158
167bool
168jackctl_server_open(
169 jackctl_server_t * server,
170 jackctl_driver_t * driver);
171
179bool
180jackctl_server_start(
181 jackctl_server_t * server);
182
190bool
191jackctl_server_stop(
192 jackctl_server_t * server);
193
201bool
202jackctl_server_close(
203 jackctl_server_t * server);
204
214const JSList *
215jackctl_server_get_drivers_list(
216 jackctl_server_t * server);
217
227const JSList *
228jackctl_server_get_parameters(
229 jackctl_server_t * server);
230
240const JSList *
241jackctl_server_get_internals_list(
242 jackctl_server_t * server);
243
253bool
254jackctl_server_load_internal(
255 jackctl_server_t * server,
256 jackctl_internal_t * internal);
257
267bool
268jackctl_server_unload_internal(
269 jackctl_server_t * server,
270 jackctl_internal_t * internal);
271
282 bool jackctl_server_load_session_file(
283 jackctl_server_t * server_ptr,
284 const char * file);
285
296bool
297jackctl_server_add_slave(jackctl_server_t * server,
298 jackctl_driver_t * driver);
299
310bool
311jackctl_server_remove_slave(jackctl_server_t * server,
312 jackctl_driver_t * driver);
313
322bool
323jackctl_server_switch_master(jackctl_server_t * server,
324 jackctl_driver_t * driver);
325
326
335const char *
336jackctl_driver_get_name(
337 jackctl_driver_t * driver);
338
347 jackctl_driver_type_t
348jackctl_driver_get_type(
349 jackctl_driver_t * driver);
350
360const JSList *
361jackctl_driver_get_parameters(
362 jackctl_driver_t * driver);
363
373int
374jackctl_driver_params_parse(
375 jackctl_driver_t * driver,
376 int argc,
377 char* argv[]);
378
387const char *
388jackctl_internal_get_name(
389 jackctl_internal_t * internal);
390
400const JSList *
401jackctl_internal_get_parameters(
402 jackctl_internal_t * internal);
403
412const char *
413jackctl_parameter_get_name(
414 jackctl_parameter_t * parameter);
415
424const char *
425jackctl_parameter_get_short_description(
426 jackctl_parameter_t * parameter);
427
436const char *
437jackctl_parameter_get_long_description(
438 jackctl_parameter_t * parameter);
439
447 jackctl_param_type_t
448jackctl_parameter_get_type(
449 jackctl_parameter_t * parameter);
450
458char
459jackctl_parameter_get_id(
460 jackctl_parameter_t * parameter);
461
471bool
472jackctl_parameter_is_set(
473 jackctl_parameter_t * parameter);
474
482bool
483jackctl_parameter_reset(
484 jackctl_parameter_t * parameter);
485
493union jackctl_parameter_value
494jackctl_parameter_get_value(
495 jackctl_parameter_t * parameter);
496
505bool
506jackctl_parameter_set_value(
507 jackctl_parameter_t * parameter,
508 const union jackctl_parameter_value * value_ptr);
509
517union jackctl_parameter_value
518jackctl_parameter_get_default_value(
519 jackctl_parameter_t * parameter);
520
528bool
529jackctl_parameter_has_range_constraint(
530 jackctl_parameter_t * parameter);
531
539bool
540jackctl_parameter_has_enum_constraint(
541 jackctl_parameter_t * parameter);
542
550uint32_t
551jackctl_parameter_get_enum_constraints_count(
552 jackctl_parameter_t * parameter);
553
562union jackctl_parameter_value
563jackctl_parameter_get_enum_constraint_value(
564 jackctl_parameter_t * parameter,
565 uint32_t index);
566
575const char *
576jackctl_parameter_get_enum_constraint_description(
577 jackctl_parameter_t * parameter,
578 uint32_t index);
579
587void
588jackctl_parameter_get_range_constraint(
589 jackctl_parameter_t * parameter,
590 union jackctl_parameter_value * min_ptr,
591 union jackctl_parameter_value * max_ptr);
592
601bool
602jackctl_parameter_constraint_is_strict(
603 jackctl_parameter_t * parameter);
604
614bool
615jackctl_parameter_constraint_is_fake_value(
616 jackctl_parameter_t * parameter);
617
623void
624jack_error(
625 const char *format,
626 ...);
627
633void
634jack_info(
635 const char *format,
636 ...);
637
644void
645jack_log(
646 const char *format,
647 ...);
648
651#if 0
652{ /* Adjust editor indent */
653#endif
654#ifdef __cplusplus
655} /* extern "C" */
656#endif
657
658#endif /* #ifndef JACKCTL_H__2EEDAD78_DF4C_4B26_83B7_4FF1A446A47E__INCLUDED */
jackctl_server_t
struct jackctl_server jackctl_server_t
Definition: control.h:74
jackctl_driver_type_t
jackctl_driver_type_t
Definition: control.h:51
JackSlave
@ JackSlave
slave driver
Definition: control.h:53
JackMaster
@ JackMaster
master driver
Definition: control.h:52
JACK_PARAM_STRING_MAX
#define JACK_PARAM_STRING_MAX
Max length of string parameter value, excluding terminating null char.
Definition: control.h:60
jackctl_parameter_t
struct jackctl_parameter jackctl_parameter_t
Definition: control.h:83
jackctl_sigmask_t
struct jackctl_sigmask jackctl_sigmask_t
Definition: control.h:86
jackctl_internal_t
struct jackctl_internal jackctl_internal_t
Definition: control.h:80
jackctl_param_type_t
jackctl_param_type_t
Definition: control.h:41
JackParamInt
@ JackParamInt
value type is a signed integer
Definition: control.h:42
JackParamUInt
@ JackParamUInt
value type is an unsigned integer
Definition: control.h:43
JackParamBool
@ JackParamBool
value type is a boolean
Definition: control.h:46
JackParamChar
@ JackParamChar
value type is a char
Definition: control.h:44
JackParamString
@ JackParamString
value type is a string with max size of JACK_PARAM_STRING_MAX+1 chars
Definition: control.h:45
jackctl_driver_t
struct jackctl_driver jackctl_driver_t
Definition: control.h:77
jackctl_server_get_internals_list
const JSList * jackctl_server_get_internals_list(jackctl_server_t *server)
jackctl_parameter_get_name
const char * jackctl_parameter_get_name(jackctl_parameter_t *parameter)
jackctl_parameter_get_long_description
const char * jackctl_parameter_get_long_description(jackctl_parameter_t *parameter)
jackctl_parameter_get_enum_constraint_value
union jackctl_parameter_value jackctl_parameter_get_enum_constraint_value(jackctl_parameter_t *parameter, uint32_t index)
jackctl_parameter_get_range_constraint
void jackctl_parameter_get_range_constraint(jackctl_parameter_t *parameter, union jackctl_parameter_value *min_ptr, union jackctl_parameter_value *max_ptr)
jackctl_parameter_get_enum_constraints_count
uint32_t jackctl_parameter_get_enum_constraints_count(jackctl_parameter_t *parameter)
jackctl_driver_params_parse
int jackctl_driver_params_parse(jackctl_driver_t *driver, int argc, char *argv[])
jackctl_server_load_session_file
bool jackctl_server_load_session_file(jackctl_server_t *server_ptr, const char *file)
jack_info
void jack_info(const char *format,...)
jackctl_server_create
jackctl_server_t * jackctl_server_create(bool(*on_device_acquire)(const char *device_name), void(*on_device_release)(const char *device_name))
jackctl_wait_signals
void jackctl_wait_signals(jackctl_sigmask_t *signals)
jackctl_driver_get_parameters
const JSList * jackctl_driver_get_parameters(jackctl_driver_t *driver)
jackctl_server_load_internal
bool jackctl_server_load_internal(jackctl_server_t *server, jackctl_internal_t *internal)
jack_log
void jack_log(const char *format,...)
jackctl_parameter_get_type
jackctl_param_type_t jackctl_parameter_get_type(jackctl_parameter_t *parameter)
jackctl_parameter_get_enum_constraint_description
const char * jackctl_parameter_get_enum_constraint_description(jackctl_parameter_t *parameter, uint32_t index)
jackctl_server_switch_master
bool jackctl_server_switch_master(jackctl_server_t *server, jackctl_driver_t *driver)
jackctl_parameter_get_short_description
const char * jackctl_parameter_get_short_description(jackctl_parameter_t *parameter)
jackctl_parameter_is_set
bool jackctl_parameter_is_set(jackctl_parameter_t *parameter)
jackctl_driver_get_type
jackctl_driver_type_t jackctl_driver_get_type(jackctl_driver_t *driver)
jackctl_server_get_parameters
const JSList * jackctl_server_get_parameters(jackctl_server_t *server)
jackctl_parameter_has_enum_constraint
bool jackctl_parameter_has_enum_constraint(jackctl_parameter_t *parameter)
jackctl_internal_get_name
const char * jackctl_internal_get_name(jackctl_internal_t *internal)
jackctl_internal_get_parameters
const JSList * jackctl_internal_get_parameters(jackctl_internal_t *internal)
jackctl_parameter_get_id
char jackctl_parameter_get_id(jackctl_parameter_t *parameter)
jackctl_parameter_get_value
union jackctl_parameter_value jackctl_parameter_get_value(jackctl_parameter_t *parameter)
jackctl_server_start
bool jackctl_server_start(jackctl_server_t *server)
jackctl_parameter_get_default_value
union jackctl_parameter_value jackctl_parameter_get_default_value(jackctl_parameter_t *parameter)
jackctl_server_create2
jackctl_server_t * jackctl_server_create2(bool(*on_device_acquire)(const char *device_name), void(*on_device_release)(const char *device_name), void(*on_device_reservation_loop)(void))
jackctl_driver_get_name
const char * jackctl_driver_get_name(jackctl_driver_t *driver)
jackctl_server_close
bool jackctl_server_close(jackctl_server_t *server)
jackctl_server_destroy
void jackctl_server_destroy(jackctl_server_t *server)
jackctl_parameter_set_value
bool jackctl_parameter_set_value(jackctl_parameter_t *parameter, const union jackctl_parameter_value *value_ptr)
jackctl_server_unload_internal
bool jackctl_server_unload_internal(jackctl_server_t *server, jackctl_internal_t *internal)
jackctl_parameter_constraint_is_strict
bool jackctl_parameter_constraint_is_strict(jackctl_parameter_t *parameter)
jack_error
void jack_error(const char *format,...)
jackctl_server_remove_slave
bool jackctl_server_remove_slave(jackctl_server_t *server, jackctl_driver_t *driver)
jackctl_parameter_reset
bool jackctl_parameter_reset(jackctl_parameter_t *parameter)
jackctl_server_open
bool jackctl_server_open(jackctl_server_t *server, jackctl_driver_t *driver)
jackctl_server_get_drivers_list
const JSList * jackctl_server_get_drivers_list(jackctl_server_t *server)
jackctl_server_add_slave
bool jackctl_server_add_slave(jackctl_server_t *server, jackctl_driver_t *driver)
jackctl_setup_signals
jackctl_sigmask_t * jackctl_setup_signals(unsigned int flags)
jackctl_parameter_has_range_constraint
bool jackctl_parameter_has_range_constraint(jackctl_parameter_t *parameter)
jackctl_server_stop
bool jackctl_server_stop(jackctl_server_t *server)
jackctl_parameter_constraint_is_fake_value
bool jackctl_parameter_constraint_is_fake_value(jackctl_parameter_t *parameter)
_JSList
Definition: jslist.h:39
jackctl_parameter_value
Type for parameter value.
Definition: control.h:65
jackctl_parameter_value::i
int32_t i
member used for JackParamInt
Definition: control.h:67
jackctl_parameter_value::str
char str[JACK_PARAM_STRING_MAX+1]
member used for JackParamString
Definition: control.h:69
jackctl_parameter_value::c
char c
member used for JackParamChar
Definition: control.h:68
jackctl_parameter_value::b
bool b
member used for JackParamBool
Definition: control.h:70
jackctl_parameter_value::ui
uint32_t ui
member used for JackParamUInt
Definition: control.h:66