1 /*
2  * Copyright (c) 2015-2016 Hanspeter Portner (dev@open-music-kontrollers.ch)
3  *
4  * This is free software: you can redistribute it and/or modify
5  * it under the terms of the Artistic License 2.0 as published by
6  * The Perl Foundation.
7  *
8  * This source is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * Artistic License 2.0 for more details.
12  *
13  * You should have received a copy of the Artistic License 2.0
14  * along the source as a COPYING file. If not, obtain it from
15  * http://www.perlfoundation.org/artistic_license_2_0.
16  */
17 
18 #ifndef _SANDBOX_SLAVE_H
19 #define _SANDBOX_SLAVE_H
20 
21 #include <sys/timespec.h> /* for struct timespec */
22 #include <lv2/lv2plug.in/ns/lv2core/lv2.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 typedef struct _sandbox_slave_t sandbox_slave_t;
29 typedef struct _sandbox_slave_driver_t sandbox_slave_driver_t;
30 
31 typedef int (*sandbox_slave_driver_init_t)(sandbox_slave_t *sb, void *data);
32 typedef void (*sandbox_slave_driver_run_t)(sandbox_slave_t *sb, float update_rate, void *data);
33 typedef void (*sandbox_slave_driver_deinit_t)(void *data);
34 typedef int (*sandbox_slave_driver_resize_t)(void *data, int width, int height);
35 
36 struct _sandbox_slave_driver_t {
37 	sandbox_slave_driver_init_t init_cb;
38 	sandbox_slave_driver_run_t run_cb;
39 	sandbox_slave_driver_deinit_t deinit_cb;
40 	sandbox_slave_driver_resize_t resize_cb;
41 };
42 
43 sandbox_slave_t *
44 sandbox_slave_new(int argc, char **argv, const sandbox_slave_driver_t *driver,
45 	void *data, int *res);
46 
47 void
48 sandbox_slave_free(sandbox_slave_t *sb);
49 
50 void *
51 sandbox_slave_instantiate(sandbox_slave_t *sb, const LV2_Feature *parent_feature, void *widget);
52 
53 int
54 sandbox_slave_recv(sandbox_slave_t *sb);
55 
56 void
57 sandbox_slave_wait(sandbox_slave_t *sb);
58 
59 bool
60 sandbox_slave_timedwait(sandbox_slave_t *sb, const struct timespec *abs_timeout);
61 
62 const void *
63 sandbox_slave_extension_data(sandbox_slave_t *sb, const char *URI);
64 
65 void
66 sandbox_slave_run(sandbox_slave_t *sb);
67 
68 const char *
69 sandbox_slave_title_get(sandbox_slave_t *sb);
70 
71 bool
72 sandbox_slave_no_user_resize_get(sandbox_slave_t *sb);
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif
79