File: internal.h

package info (click to toggle)
lv2dynparam1 2-7.1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,772 kB
  • sloc: sh: 9,039; ansic: 4,352; makefile: 26
file content (207 lines) | stat: -rw-r--r-- 5,900 bytes parent folder | download | duplicates (5)
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/* -*- Mode: C ; c-basic-offset: 2 -*- */
/*****************************************************************************
 *
 *   This file is part of lv2dynparam plugin library
 *
 *   Copyright (C) 2006,2007,2008,2009 Nedko Arnaudov <nedko@arnaudov.name>
 *
 *   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; 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *****************************************************************************/

#ifndef DYNPARAM_INTERNAL_H__1A466106_9E02_4FA2_9D30_888795C93BC9__INCLUDED
#define DYNPARAM_INTERNAL_H__1A466106_9E02_4FA2_9D30_888795C93BC9__INCLUDED

#define LV2DYNPARAM_PARAMETER_TYPE_COMMAND   0
#define LV2DYNPARAM_PARAMETER_TYPE_FLOAT     1
#define LV2DYNPARAM_PARAMETER_TYPE_INT       2
#define LV2DYNPARAM_PARAMETER_TYPE_NOTE      3
#define LV2DYNPARAM_PARAMETER_TYPE_STRING    4
#define LV2DYNPARAM_PARAMETER_TYPE_FILENAME  5
#define LV2DYNPARAM_PARAMETER_TYPE_BOOLEAN   6
#define LV2DYNPARAM_PARAMETER_TYPE_ENUM      7

#define LV2DYNPARAM_PENDING_NOTHING    0 /* nothing pending */
#define LV2DYNPARAM_PENDING_APPEAR     1 /* pending appear */
#define LV2DYNPARAM_PENDING_DISAPPEAR  2 /* pending disappear */
#define LV2DYNPARAM_PENDING_CHANGE     3 /* pending change */

struct lv2dynparam_plugin_group
{
  struct list_head siblings;    /* siblings in parent group child_parameters */

  struct lv2dynparam_plugin_group * group_ptr; /* parent group */

  struct lv2dynparam_hints hints;
  char name[LV2DYNPARAM_MAX_STRING_SIZE];
  struct list_head child_groups;
  struct list_head child_parameters;

  unsigned int pending;         /* One of LV2DYNPARAM_PENDING_XXX */

  void * host_context;
};

struct lv2dynparam_plugin_parameter
{
  struct list_head siblings;    /* siblings in parent group child_parameters */

  struct lv2dynparam_plugin_group * group_ptr; /* parent group */

  struct lv2dynparam_hints hints;
  unsigned int type;
  char name[LV2DYNPARAM_MAX_STRING_SIZE];
  union
  {
    struct
    {
      float value;
      float min;
      float max;
    } fpoint;
    struct
    {
      signed int value;
      signed int min;
      signed int max;
    } integer;
    struct
    {
      unsigned char value;
      unsigned char min;
      unsigned char max;
    } note;
/*     char string[??]; */
/*     char filename[??]; */
    struct
    {
      char ** values;
      unsigned int values_count;
      unsigned int selected_value;
    } enumeration;
    unsigned char boolean;
    struct
    {
      int (*callback)(void * context);
      void * context;
    } command;
  } data;
  union
  {
    lv2dynparam_plugin_param_boolean_changed boolean;
    lv2dynparam_plugin_param_float_changed fpoint;
    lv2dynparam_plugin_param_enum_changed enumeration;
    lv2dynparam_plugin_param_int_changed integer;
  } plugin_callback;
  void * plugin_callback_context;

  unsigned int pending;         /* One of LV2DYNPARAM_PENDING_XXX */

  void * host_context;
};

struct lv2dynparam_plugin_instance
{
  struct list_head siblings;
  rtsafe_memory_handle memory;
  LV2_Handle lv2instance;
  struct lv2dynparam_plugin_group root_group;
  struct lv2dynparam_host_callbacks * host_callbacks;
  void * host_context;

  unsigned int pending;

  rtsafe_memory_pool_handle groups_pool;
  rtsafe_memory_pool_handle parameters_pool;
};

unsigned char
lv2dynparam_plugin_host_attach(
  LV2_Handle instance,
  struct lv2dynparam_host_callbacks * host_callbacks,
  void * instance_host_context);

void
lv2dynparam_plugin_host_detach(
  LV2_Handle instance);

bool
lv2dynparam_plugin_group_init(
  struct lv2dynparam_plugin_instance * instance_ptr,
  struct lv2dynparam_plugin_group * group_ptr,
  struct lv2dynparam_plugin_group * parent_group_ptr,
  const struct lv2dynparam_hints * hints_ptr,
  const char * name);

void
lv2dynparam_plugin_group_clean(
  struct lv2dynparam_plugin_instance * instance_ptr,
  struct lv2dynparam_plugin_group * group_ptr);

void
lv2dynparam_plugin_group_free(
  struct lv2dynparam_plugin_instance * instance_ptr,
  struct lv2dynparam_plugin_group * group_ptr);

void
lv2dynparam_plugin_group_notify(
  struct lv2dynparam_plugin_instance * instance_ptr,
  struct lv2dynparam_plugin_group * group_ptr);

void
lv2dynparam_plugin_group_get_type_uri(
  lv2dynparam_group_handle group,
  char * buffer);

void
lv2dynparam_plugin_group_get_name(
  lv2dynparam_group_handle group,
  char * buffer);

void
lv2dynparam_plugin_parameter_free(
  struct lv2dynparam_plugin_instance * instance_ptr,
  struct lv2dynparam_plugin_parameter * param_ptr);

void
lv2dynparam_plugin_param_notify(
  struct lv2dynparam_plugin_instance * instance_ptr,
  struct lv2dynparam_plugin_parameter * param_ptr);

void
lv2dynparam_plugin_parameter_get_type_uri(
  lv2dynparam_parameter_handle parameter,
  char * buffer);

void
lv2dynparam_plugin_parameter_get_name(
  lv2dynparam_parameter_handle parameter,
  char * buffer);

void
lv2dynparam_plugin_parameter_get_value(
  lv2dynparam_parameter_handle parameter,
  void ** value_buffer);

void
lv2dynparam_plugin_parameter_get_range(
  lv2dynparam_parameter_handle parameter,
  void ** value_min_buffer,
  void ** value_max_buffer);

unsigned char
lv2dynparam_plugin_parameter_change(
  lv2dynparam_parameter_handle parameter);

#endif /* #ifndef DYNPARAM_INTERNAL_H__1A466106_9E02_4FA2_9D30_888795C93BC9__INCLUDED */